From: <mu...@us...> - 2013-08-01 11:40:19
|
Revision: 2783 http://sourceforge.net/p/jfreechart/code/2783 Author: mungady Date: 2013-08-01 11:40:17 +0000 (Thu, 01 Aug 2013) Log Message: ----------- Updates for change to SWTGraphics2D. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-01 11:29:37 UTC (rev 2782) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-01 11:40:17 UTC (rev 2783) @@ -1,3 +1,23 @@ +2013-08-01 David Gilbert <dav...@ob...> + + * org/jfree/experimental/swt/SWTGraphics2D.java + (SWTGraphics2D): Set default stroke, + (setPaint): Do nothing for null, + (setColor): Likewise, + (setBackground): Store color for later, don't update GC now, + (getBackground): Return stored color, + (setComposite): Throw IllegalArgumentException for null, + (setStroke): Likewise, + (clipRect): Fix to apply intersect operation, + (rotate(double)): Reimplemented, + (rotate(double, double, double)): Implemented, + (shear): Reimplemented, + (clearRect): Do nothing if background color is null, + (drawGlyphVector): Implemented, + (drawString(String, int, int)): Delegate, + (drawString(String, float, float)): Check for null string, + (hit): Implemented. + 2013-07-25 David Gilbert <dav...@ob...> * org/jfree/chart/axis/CategoryAxis.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-08-01 11:29:37 UTC (rev 2782) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-08-01 11:40:17 UTC (rev 2783) @@ -2,6 +2,9 @@ ----------------- Not yet released +Improved the consistency of the SWTGraphics2D implementation, plus various +bug fixes. + Bug Fixes: 1107 : Fixed TimeZone issue in PeriodAxis. Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2013-08-01 11:29:37 UTC (rev 2782) +++ branches/jfreechart-1.0.x-branch/README.txt 2013-08-01 11:40:17 UTC (rev 2783) @@ -90,10 +90,6 @@ The JUnit tests included with JFreeChart have been created using JUnit 4.3.1. -In the distribution, we also include iText-2.1.5.jar. This is only required by -the JFreeChart demo applications, and is not a direct dependency for -JFreeChart. - ----------- 5. SUPPORT ----------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2013-08-04 06:39:29
|
Revision: 2836 http://sourceforge.net/p/jfreechart/code/2836 Author: mungady Date: 2013-08-04 06:39:27 +0000 (Sun, 04 Aug 2013) Log Message: ----------- 2013-08-04 David Gilbert <dav...@ob...> * org/jfree/chart/ChartFactory.java (createPieChart): Simplified version (less parameters), (createPieChart3D): Likewise, (createBarChart): Likewise, (createStackedBarChart): Likewise, (createBarChart3D): Likewise, (createStackedBarChart3D): Likewise, (createAreaChart): Likewise, (createStackedAreaChart): Likewise, (createLineChart): Likewise, (createLineChart3D): Likewise, (createGanttChart): Likewise, (createScatterPlot): Likewise, (createXYBarChart): Likewise, (createXYAreaChart): Likewise, (createStackedXYAreaChart): Likewise, (createXYLineChart): Likewise, (createXYStepChart): Likewise, (createXYStepAreaChart): Likewise, (createTimeSeriesChart): Likewise, (createBubbleChart): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-04 06:38:12 UTC (rev 2835) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-04 06:39:27 UTC (rev 2836) @@ -1,3 +1,27 @@ +2013-08-04 David Gilbert <dav...@ob...> + + * org/jfree/chart/ChartFactory.java + (createPieChart): Simplified version (less parameters), + (createPieChart3D): Likewise, + (createBarChart): Likewise, + (createStackedBarChart): Likewise, + (createBarChart3D): Likewise, + (createStackedBarChart3D): Likewise, + (createAreaChart): Likewise, + (createStackedAreaChart): Likewise, + (createLineChart): Likewise, + (createLineChart3D): Likewise, + (createGanttChart): Likewise, + (createScatterPlot): Likewise, + (createXYBarChart): Likewise, + (createXYAreaChart): Likewise, + (createStackedXYAreaChart): Likewise, + (createXYLineChart): Likewise, + (createXYStepChart): Likewise, + (createXYStepAreaChart): Likewise, + (createTimeSeriesChart): Likewise, + (createBubbleChart): Likewise. + 2013-08-01 David Gilbert <dav...@ob...> * org/jfree/chart/axis/Axis.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-08-04 06:38:12 UTC (rev 2835) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-08-04 06:39:27 UTC (rev 2836) @@ -2,7 +2,8 @@ ----------------- Not yet released -Provided subscript/superscript support for axis labels (via AttributedString), +Provided subscript/superscript support for axis labels (via AttributedString), +new axis label positioning options, simplified ChartFactory methods, added URLs to labels on CategoryAxis, improved the consistency of the SWTGraphics2D implementation, and various bug fixes. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2013-08-01 15:08:18
|
Revision: 2784 http://sourceforge.net/p/jfreechart/code/2784 Author: mungady Date: 2013-08-01 15:08:14 +0000 (Thu, 01 Aug 2013) Log Message: ----------- 2013-08-01 David Gilbert <dav...@ob...> * org/jfree/chart/axis/Axis.java (attributedLabel): New field, (setLabel): Simplified, (getAttributedLabel): New method, (setAttributedLabel(String)): Likewise, (setAttributedLabel(AttributedString)): Likewise, (createAttributedLabel(String)): New private method, (getLabelEnclosure): Use attributedLabel if not null,?\194?\168 (drawAttributedLabel): New method, (equals): Check new attributedLabel field, (hashCode): Call super, (writeObject): Write attributedLabel, (readObject): Read attributedLabel, * org/jfree/chart/axis/NumberAxis.java (draw): Use attributedLabel if not null, * org/jfree/chart/axis/NumberAxis3D.java: Likewise, * org/jfree/chart/axis/CategoryAxis.java: Likewise, * org/jfree/chart/axis/CategoryAxis3D.java: Likewise, * org/jfree/chart/axis/SubCategoryAxis.java: Likewise, * org/jfree/chart/axis/DateAxis.java: Likewise, * org/jfree/chart/axis/LogAxis.java: Likewise, * org/jfree/chart/axis/PeriodAxis.java: Likewise, * org/jfree/chart/utils/AttrStringUtils.java: New class. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/Axis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis3D.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis3D.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/PeriodAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/SubCategoryAxis.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/AttrStringUtils.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-01 15:08:14 UTC (rev 2784) @@ -1,5 +1,31 @@ 2013-08-01 David Gilbert <dav...@ob...> + * org/jfree/chart/axis/Axis.java + (attributedLabel): New field, + (setLabel): Simplified, + (getAttributedLabel): New method, + (setAttributedLabel(String)): Likewise, + (setAttributedLabel(AttributedString)): Likewise, + (createAttributedLabel(String)): New private method, + (getLabelEnclosure): Use attributedLabel if not null,¨ + (drawAttributedLabel): New method, + (equals): Check new attributedLabel field, + (hashCode): Call super, + (writeObject): Write attributedLabel, + (readObject): Read attributedLabel, + * org/jfree/chart/axis/NumberAxis.java + (draw): Use attributedLabel if not null, + * org/jfree/chart/axis/NumberAxis3D.java: Likewise, + * org/jfree/chart/axis/CategoryAxis.java: Likewise, + * org/jfree/chart/axis/CategoryAxis3D.java: Likewise, + * org/jfree/chart/axis/SubCategoryAxis.java: Likewise, + * org/jfree/chart/axis/DateAxis.java: Likewise, + * org/jfree/chart/axis/LogAxis.java: Likewise, + * org/jfree/chart/axis/PeriodAxis.java: Likewise, + * org/jfree/chart/utils/AttrStringUtils.java: New class. + +2013-08-01 David Gilbert <dav...@ob...> + * org/jfree/experimental/swt/SWTGraphics2D.java (SWTGraphics2D): Set default stroke, (setPaint): Do nothing for null, Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-08-01 15:08:14 UTC (rev 2784) @@ -2,8 +2,9 @@ ----------------- Not yet released -Improved the consistency of the SWTGraphics2D implementation, plus various -bug fixes. +Provided subscript/superscript support for axis labels (via AttributedString), +added URLs to labels on CategoryAxis, improved the consistency of the +SWTGraphics2D implementation, and various bug fixes. Bug Fixes: 1107 : Fixed TimeZone issue in PeriodAxis. Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/Axis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/Axis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/Axis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -83,7 +83,8 @@ * 26-Sep-2008 : Added fireChangeEvent() method (DG); * 19-Mar-2009 : Added entity support - see patch 2603321 by Peter Kolb (DG); * 02-Jul-2013 : Use ParamChecks (DG); - * + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); */ package org.jfree.chart.axis; @@ -96,6 +97,7 @@ import java.awt.Paint; import java.awt.Shape; import java.awt.Stroke; +import java.awt.font.TextLayout; import java.awt.geom.AffineTransform; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; @@ -103,6 +105,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.text.AttributedString; import java.util.Arrays; import java.util.EventListener; import java.util.List; @@ -115,12 +118,14 @@ import org.jfree.chart.event.AxisChangeListener; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotRenderingInfo; +import org.jfree.chart.util.AttrStringUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.io.SerialUtilities; import org.jfree.text.TextUtilities; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; import org.jfree.ui.TextAnchor; +import org.jfree.util.AttributedStringUtilities; import org.jfree.util.ObjectUtilities; import org.jfree.util.PaintUtilities; @@ -188,6 +193,12 @@ /** The label for the axis. */ private String label; + + /** + * An attributed label for the axis (overrides label if non-null). + * We have to use this override method to preserve the API compatibility. + */ + private transient AttributedString attributedLabel; /** The font for displaying the axis label. */ private Font labelFont; @@ -373,23 +384,65 @@ * @see #setLabelPaint(Paint) */ public void setLabel(String label) { + this.label = label; + fireChangeEvent(); + } - String existing = this.label; - if (existing != null) { - if (!existing.equals(label)) { - this.label = label; - fireChangeEvent(); - } + /** + * Returns the attributed label. The default value is <code>null</code>. + * + * @return The attributed label (possibly <code>null</code>). + * + * @since 1.0.16 + */ + public AttributedString getAttributedLabel() { + return this.attributedLabel; + } + + /** + * Sets the attributed label for the axis and sends an + * {@link AxisChangeEvent} to all registered listeners. This is a + * convenience method that converts the string into an + * AttributedString using the current font attributes. + * + * @param label the label (<code>null</<code> permitted). + * + * @since 1.0.16 + */ + public void setAttributedLabel(String label) { + setAttributedLabel(createAttributedLabel(label)); + } + + /** + * Sets the attributed label for the axis and sends an + * {@link AxisChangeEvent} to all registered listeners. + * + * @param label the label (<code>null</code> permitted). + * + * @since 1.0.16 + */ + public void setAttributedLabel(AttributedString label) { + this.attributedLabel = label; + fireChangeEvent(); + } + + /** + * Creates and returns an <code>AttributedString</code> with the specified + * text and the labelFont and labelPaint applied as attributes. + * + * @param label the label (<code>null</code> permitted). + * + * @return An attributed string or <code>null</code>. + */ + private AttributedString createAttributedLabel(String label) { + if (label == null) { + return null; } - else { - if (label != null) { - this.label = label; - fireChangeEvent(); - } - } - + AttributedString s = new AttributedString(label); + s.addAttributes(this.labelFont.getAttributes(), 0, label.length()); + return s; } - + /** * Returns the font for the axis label. * @@ -1149,12 +1202,21 @@ * @return The enclosing rectangle. */ protected Rectangle2D getLabelEnclosure(Graphics2D g2, RectangleEdge edge) { - Rectangle2D result = new Rectangle2D.Double(); - String axisLabel = getLabel(); - if (axisLabel != null && !axisLabel.equals("")) { - FontMetrics fm = g2.getFontMetrics(getLabelFont()); - Rectangle2D bounds = TextUtilities.getTextBounds(axisLabel, g2, fm); + Rectangle2D bounds = null;; + if (this.attributedLabel != null) { + TextLayout layout = new TextLayout( + this.attributedLabel.getIterator(), + g2.getFontRenderContext()); + bounds = layout.getBounds(); + } else { + String axisLabel = getLabel(); + if (axisLabel != null && !axisLabel.equals("")) { + FontMetrics fm = g2.getFontMetrics(getLabelFont()); + bounds = TextUtilities.getTextBounds(axisLabel, g2, fm); + } + } + if (bounds != null) { RectangleInsets insets = getLabelInsets(); bounds = insets.createOutsetRectangle(bounds); double angle = getLabelAngle(); @@ -1168,9 +1230,7 @@ Shape labelBounds = transformer.createTransformedShape(bounds); result = labelBounds.getBounds2D(); } - return result; - } /** @@ -1271,6 +1331,101 @@ } /** + * Draws the axis label. + * + * @param label the label text. + * @param g2 the graphics device. + * @param plotArea the plot area. + * @param dataArea the area inside the axes. + * @param edge the location of the axis. + * @param state the axis state (<code>null</code> not permitted). + * + * @return Information about the axis. + * + * @since 1.0.16 + */ + protected AxisState drawAttributedLabel(AttributedString label, + Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, + RectangleEdge edge, AxisState state) { + + // it is unlikely that 'state' will be null, but check anyway... + ParamChecks.nullNotPermitted(state, "state"); + + if (label == null) { + return state; + } + + RectangleInsets insets = getLabelInsets(); + g2.setFont(getLabelFont()); + g2.setPaint(getLabelPaint()); + TextLayout layout = new TextLayout(this.attributedLabel.getIterator(), + g2.getFontRenderContext()); + Rectangle2D labelBounds = layout.getBounds(); + + if (edge == RectangleEdge.TOP) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + double labelx = dataArea.getCenterX(); + double labely = state.getCursor() - insets.getBottom() + - labelBounds.getHeight() / 2.0; + AttrStringUtils.drawRotatedString(label, g2, (float) labelx, + (float) labely, TextAnchor.CENTER, getLabelAngle(), + TextAnchor.CENTER); + state.cursorUp(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.BOTTOM) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + double labelx = dataArea.getCenterX(); + double labely = state.getCursor() + + insets.getTop() + labelBounds.getHeight() / 2.0; + AttrStringUtils.drawRotatedString(label, g2, (float) labelx, + (float) labely, TextAnchor.CENTER, getLabelAngle(), + TextAnchor.CENTER); + state.cursorDown(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.LEFT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() - Math.PI / 2.0, labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + double labelx = state.getCursor() + - insets.getRight() - labelBounds.getWidth() / 2.0; + double labely = dataArea.getCenterY(); + AttrStringUtils.drawRotatedString(label, g2, (float) labelx, + (float) labely, TextAnchor.CENTER, + getLabelAngle() - Math.PI / 2.0, TextAnchor.CENTER); + state.cursorLeft(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + else if (edge == RectangleEdge.RIGHT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() + Math.PI / 2.0, + labelBounds.getCenterX(), labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + double labelx = state.getCursor() + + insets.getLeft() + labelBounds.getWidth() / 2.0; + double labely = dataArea.getY() + dataArea.getHeight() / 2.0; + AttrStringUtils.drawRotatedString(label, g2, (float) labelx, + (float) labely, TextAnchor.CENTER, + getLabelAngle() + Math.PI / 2.0, TextAnchor.CENTER); + state.cursorRight(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + return state; + } + + /** * Draws an axis line at the current cursor position and edge. * * @param g2 the graphics device. @@ -1341,6 +1496,10 @@ if (!ObjectUtilities.equal(this.label, that.label)) { return false; } + if (!AttributedStringUtilities.equal(this.attributedLabel, + that.attributedLabel)) { + return false; + } if (!ObjectUtilities.equal(this.labelFont, that.labelFont)) { return false; } @@ -1406,6 +1565,15 @@ } return true; } + + @Override + public int hashCode() { + int hash = 3; + if (this.label != null) { + hash = 83 * hash + this.label.hashCode(); + } + return hash; + } /** * Provides serialization support. @@ -1416,6 +1584,7 @@ */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); + SerialUtilities.writeAttributedString(this.attributedLabel, stream); SerialUtilities.writePaint(this.labelPaint, stream); SerialUtilities.writePaint(this.tickLabelPaint, stream); SerialUtilities.writeStroke(this.axisLineStroke, stream); @@ -1435,6 +1604,7 @@ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); + this.attributedLabel = SerialUtilities.readAttributedString(stream); this.labelPaint = SerialUtilities.readPaint(stream); this.tickLabelPaint = SerialUtilities.readPaint(stream); this.axisLineStroke = SerialUtilities.readStroke(stream); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -95,7 +95,8 @@ * 16-Apr-2009 : Added tick mark drawing (DG); * 29-Jun-2009 : Fixed bug where axis entity is hiding label entities (DG); * 25-Jul-2013 : Added support for URLs on category labels (DG); - * + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); */ package org.jfree.chart.axis; @@ -222,7 +223,6 @@ this.tickLabelPaintMap = new HashMap(); this.categoryLabelToolTips = new HashMap(); this.categoryLabelURLs = new HashMap(); - } /** @@ -650,9 +650,8 @@ * @see #getCategoryMiddle(int, int, Rectangle2D, RectangleEdge) * @see #getCategoryEnd(int, int, Rectangle2D, RectangleEdge) */ - public double getCategoryStart(int category, int categoryCount, - Rectangle2D area, - RectangleEdge edge) { + public double getCategoryStart(int category, int categoryCount, + Rectangle2D area, RectangleEdge edge) { double result = 0.0; if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) { @@ -669,7 +668,6 @@ result = result + category * (categorySize + categoryGapWidth); return result; - } /** @@ -686,7 +684,7 @@ * @see #getCategoryEnd(int, int, Rectangle2D, RectangleEdge) */ public double getCategoryMiddle(int category, int categoryCount, - Rectangle2D area, RectangleEdge edge) { + Rectangle2D area, RectangleEdge edge) { if (category < 0 || category >= categoryCount) { throw new IllegalArgumentException("Invalid category index: " @@ -711,11 +709,9 @@ * @see #getCategoryMiddle(int, int, Rectangle2D, RectangleEdge) */ public double getCategoryEnd(int category, int categoryCount, - Rectangle2D area, RectangleEdge edge) { - + Rectangle2D area, RectangleEdge edge) { return getCategoryStart(category, categoryCount, area, edge) + calculateCategorySize(categoryCount, area, edge); - } /** @@ -825,8 +821,7 @@ * @return The category size. */ protected double calculateCategorySize(int categoryCount, Rectangle2D area, - RectangleEdge edge) { - + RectangleEdge edge) { double result; double available = 0.0; @@ -846,7 +841,6 @@ result = available * (1 - getLowerMargin() - getUpperMargin()); } return result; - } /** @@ -876,9 +870,7 @@ if (categoryCount > 1) { result = available * getCategoryMargin() / (categoryCount - 1); } - return result; - } /** @@ -892,9 +884,8 @@ * * @return The space required to draw the axis. */ - public AxisSpace reserveSpace(Graphics2D g2, Plot plot, - Rectangle2D plotArea, - RectangleEdge edge, AxisSpace space) { + public AxisSpace reserveSpace(Graphics2D g2, Plot plot, + Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { // create a new space object if one wasn't supplied... if (space == null) { @@ -942,7 +933,6 @@ + this.categoryLabelPositionOffset, edge); } return space; - } /** @@ -990,7 +980,13 @@ // draw the category labels and axis label state = drawCategoryLabels(g2, plotArea, dataArea, edge, state, plotState); - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } return state; } @@ -999,34 +995,6 @@ * Draws the category labels and returns the updated axis state. * * @param g2 the graphics device (<code>null</code> not permitted). - * @param dataArea the area inside the axes (<code>null</code> not - * permitted). - * @param edge the axis location (<code>null</code> not permitted). - * @param state the axis state (<code>null</code> not permitted). - * @param plotState collects information about the plot (<code>null</code> - * permitted). - * - * @return The updated axis state (never <code>null</code>). - * - * @deprecated Use {@link #drawCategoryLabels(Graphics2D, Rectangle2D, - * Rectangle2D, RectangleEdge, AxisState, PlotRenderingInfo)}. - */ - protected AxisState drawCategoryLabels(Graphics2D g2, - Rectangle2D dataArea, - RectangleEdge edge, - AxisState state, - PlotRenderingInfo plotState) { - - // this method is deprecated because we really need the plotArea - // when drawing the labels - see bug 1277726 - return drawCategoryLabels(g2, dataArea, dataArea, edge, state, - plotState); - } - - /** - * Draws the category labels and returns the updated axis state. - * - * @param g2 the graphics device (<code>null</code> not permitted). * @param plotArea the plot area (<code>null</code> not permitted). * @param dataArea the area inside the axes (<code>null</code> not * permitted). @@ -1149,10 +1117,8 @@ * * @return A list of ticks. */ - public List refreshTicks(Graphics2D g2, - AxisState state, - Rectangle2D dataArea, - RectangleEdge edge) { + public List refreshTicks(Graphics2D g2, AxisState state, + Rectangle2D dataArea, RectangleEdge edge) { List ticks = new java.util.ArrayList(); @@ -1299,7 +1265,7 @@ * @return A label. */ protected TextBlock createLabel(Comparable category, float width, - RectangleEdge edge, Graphics2D g2) { + RectangleEdge edge, Graphics2D g2) { TextBlock label = TextUtilities.createTextBlock(category.toString(), getTickLabelFont(category), getTickLabelPaint(category), width, this.maximumCategoryLabelLines, new G2TextMeasurer(g2)); @@ -1317,7 +1283,6 @@ */ protected double calculateTextBlockWidth(TextBlock block, CategoryLabelPosition position, Graphics2D g2) { - RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), @@ -1327,7 +1292,6 @@ double w = rotatedBox.getBounds2D().getWidth() + insets.getLeft() + insets.getRight(); return w; - } /** @@ -1340,9 +1304,7 @@ * @return The height. */ protected double calculateTextBlockHeight(TextBlock block, - CategoryLabelPosition position, - Graphics2D g2) { - + CategoryLabelPosition position, Graphics2D g2) { RectangleInsets insets = getTickLabelInsets(); Size2D size = block.calculateDimensions(g2); Rectangle2D box = new Rectangle2D.Double(0.0, 0.0, size.getWidth(), @@ -1352,7 +1314,6 @@ double h = rotatedBox.getBounds2D().getHeight() + insets.getTop() + insets.getBottom(); return h; - } /** @@ -1435,10 +1396,7 @@ * @return A hash code. */ public int hashCode() { - if (getLabel() != null) { - return getLabel().hashCode(); - } - return 0; + return super.hashCode(); } /** @@ -1552,4 +1510,28 @@ return true; } + /** + * Draws the category labels and returns the updated axis state. + * + * @param g2 the graphics device (<code>null</code> not permitted). + * @param dataArea the area inside the axes (<code>null</code> not + * permitted). + * @param edge the axis location (<code>null</code> not permitted). + * @param state the axis state (<code>null</code> not permitted). + * @param plotState collects information about the plot (<code>null</code> + * permitted). + * + * @return The updated axis state (never <code>null</code>). + * + * @deprecated Use {@link #drawCategoryLabels(Graphics2D, Rectangle2D, + * Rectangle2D, RectangleEdge, AxisState, PlotRenderingInfo)}. + */ + protected AxisState drawCategoryLabels(Graphics2D g2, Rectangle2D dataArea, + RectangleEdge edge, AxisState state, PlotRenderingInfo plotState) { + // this method is deprecated because we really need the plotArea + // when drawing the labels - see bug 1277726 + return drawCategoryLabels(g2, dataArea, dataArea, edge, state, + plotState); + } + } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis3D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis3D.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/CategoryAxis3D.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -27,7 +27,7 @@ * ------------------- * CategoryAxis3D.java * ------------------- - * (C) Copyright 2003-2009, by Klaus Rheinwald and Contributors. + * (C) Copyright 2003-2013, by Klaus Rheinwald and Contributors. * * Original Author: Klaus Rheinwald; * Contributor(s): Tin Luu, @@ -50,6 +50,8 @@ * 18-Aug-2006 : Fix for bug drawing category labels, thanks to Adriaan * Joubert (1277726) (DG); * 16-Apr-2009 : Draw axis line and tick marks (DG); + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); * */ @@ -69,8 +71,8 @@ * An axis that displays categories and has a 3D effect. * Used for bar charts and line charts. */ -public class CategoryAxis3D extends CategoryAxis - implements Cloneable, Serializable { +public class CategoryAxis3D extends CategoryAxis implements Cloneable, + Serializable { /** For serialization. */ private static final long serialVersionUID = 4114732251353700972L; @@ -107,12 +109,9 @@ * * @return The axis state (never <code>null</code>). */ - public AxisState draw(Graphics2D g2, - double cursor, - Rectangle2D plotArea, - Rectangle2D dataArea, - RectangleEdge edge, - PlotRenderingInfo plotState) { + public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, + Rectangle2D dataArea, RectangleEdge edge, + PlotRenderingInfo plotState) { // if the axis is not visible, don't draw it... if (!isVisible()) { @@ -155,10 +154,14 @@ } state = drawCategoryLabels(g2, plotArea, adjustedDataArea, edge, state, plotState); - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); - + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } return state; - } /** @@ -172,11 +175,9 @@ * * @return The coordinate. */ - public double getCategoryJava2DCoordinate(CategoryAnchor anchor, - int category, - int categoryCount, - Rectangle2D area, - RectangleEdge edge) { + public double getCategoryJava2DCoordinate(CategoryAnchor anchor, + int category, int categoryCount, Rectangle2D area, + RectangleEdge edge) { double result = 0.0; Rectangle2D adjustedArea = area; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -127,6 +127,9 @@ * 19-Mar-2009 : Added entity support - see patch 2603321 by Peter Kolb (DG); * 08-Feb-2012 : Bugfix for endless-loop, bug 3484403 by rbrabe (MH); * 25-Jul-2013 : Update event notification to use fireChangeEvent() (DG); + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); + * */ package org.jfree.chart.axis; @@ -639,7 +642,7 @@ * @see #getMinimumDate() */ public Date getMaximumDate() { - Date result = null; + Date result; Range range = getRange(); if (range instanceof DateRange) { DateRange r = (DateRange) range; @@ -733,7 +736,7 @@ * @return The coordinate corresponding to the supplied data value. */ public double valueToJava2D(double value, Rectangle2D area, - RectangleEdge edge) { + RectangleEdge edge) { value = this.timeline.toTimelineValue((long) value); @@ -766,7 +769,6 @@ } } return result; - } /** @@ -780,8 +782,8 @@ * * @return The coordinate corresponding to the supplied date. */ - public double dateToJava2D(Date date, Rectangle2D area, - RectangleEdge edge) { + public double dateToJava2D(Date date, Rectangle2D area, + RectangleEdge edge) { double value = date.getTime(); return valueToJava2D(value, area, edge); } @@ -798,8 +800,8 @@ * * @return A data value. */ - public double java2DToValue(double java2DValue, Rectangle2D area, - RectangleEdge edge) { + public double java2DToValue(double java2DValue, Rectangle2D area, + RectangleEdge edge) { DateRange range = (DateRange) getRange(); double axisMin = this.timeline.toTimelineValue(range.getLowerMillis()); @@ -1106,25 +1108,6 @@ * from the {@link ValueAxis} class). * * @param zone the time zone (<code>null</code> not permitted). - * - * @return A collection of standard date tick units. - * - * @deprecated Since 1.0.11, use {@link #createStandardDateTickUnits( - * TimeZone, Locale)} to explicitly set the locale as well as the - * time zone. - */ - public static TickUnitSource createStandardDateTickUnits(TimeZone zone) { - return createStandardDateTickUnits(zone, Locale.getDefault()); - } - - /** - * Returns a collection of standard date tick units. This collection will - * be used by default, but you are free to create your own collection if - * you want to (see the - * {@link ValueAxis#setStandardTickUnits(TickUnitSource)} method inherited - * from the {@link ValueAxis} class). - * - * @param zone the time zone (<code>null</code> not permitted). * @param locale the locale (<code>null</code> not permitted). * * @return A collection of standard date tick units. @@ -1425,8 +1408,8 @@ * * @return The estimated maximum width of the tick labels. */ - private double estimateMaximumTickLabelWidth(Graphics2D g2, - DateTickUnit unit) { + private double estimateMaximumTickLabelWidth(Graphics2D g2, + DateTickUnit unit) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); @@ -1841,7 +1824,13 @@ // draw the axis label (note that 'state' is passed in *and* // returned)... - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } createAndAddEntity(cursor, state, dataArea, edge, plotState); return state; @@ -1915,12 +1904,7 @@ * @return A hash code. */ public int hashCode() { - if (getLabel() != null) { - return getLabel().hashCode(); - } - else { - return 0; - } + return super.hashCode(); } /** @@ -1941,5 +1925,24 @@ // 'tickMarkPosition' is immutable : no need to clone return clone; } + + /** + * Returns a collection of standard date tick units. This collection will + * be used by default, but you are free to create your own collection if + * you want to (see the + * {@link ValueAxis#setStandardTickUnits(TickUnitSource)} method inherited + * from the {@link ValueAxis} class). + * + * @param zone the time zone (<code>null</code> not permitted). + * + * @return A collection of standard date tick units. + * + * @deprecated Since 1.0.11, use {@link #createStandardDateTickUnits( + * TimeZone, Locale)} to explicitly set the locale as well as the + * time zone. + */ + public static TickUnitSource createStandardDateTickUnits(TimeZone zone) { + return createStandardDateTickUnits(zone, Locale.getDefault()); + } } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -56,8 +56,8 @@ * 30-Mar-2009 : Added pan(double) method (DG); * 28-Oct-2011 : Fixed endless loop for 0 TickUnit, # 3429707 (MH); * 02-Jul-2013 : Use ParamChecks (DG); - * - */ + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); */ package org.jfree.chart.axis; @@ -221,7 +221,7 @@ * @see #getTickUnit() */ public void setTickUnit(NumberTickUnit unit, boolean notify, - boolean turnOffAutoSelect) { + boolean turnOffAutoSelect) { ParamChecks.nullNotPermitted(unit, "unit"); this.tickUnit = unit; @@ -455,7 +455,13 @@ return state; } state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } createAndAddEntity(cursor, state, dataArea, edge, plotState); return state; } @@ -474,7 +480,6 @@ */ public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) { - List result = new java.util.ArrayList(); if (RectangleEdge.isTopOrBottom(edge)) { result = refreshTicksHorizontal(g2, dataArea, edge); @@ -483,7 +488,6 @@ result = refreshTicksVertical(g2, dataArea, edge); } return result; - } /** @@ -687,9 +691,8 @@ * * @since 1.0.7 */ - protected void selectVerticalAutoTickUnit(Graphics2D g2, - Rectangle2D dataArea, - RectangleEdge edge) { + protected void selectVerticalAutoTickUnit(Graphics2D g2, + Rectangle2D dataArea, RectangleEdge edge) { double tickLabelHeight = estimateMaximumTickLabelHeight(g2); @@ -752,8 +755,8 @@ * * @since 1.0.7 */ - protected double estimateMaximumTickLabelWidth(Graphics2D g2, - TickUnit unit) { + protected double estimateMaximumTickLabelWidth(Graphics2D g2, + TickUnit unit) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -96,6 +96,8 @@ * collection (DG); * 19-Mar-2009 : Added entity support - see patch 2603321 by Peter Kolb (DG); * 02-Jul-2013 : Use ParamChecks (DG); + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); * */ @@ -339,7 +341,7 @@ * @param turnOffAutoSelect turn off the auto-tick selection? */ public void setTickUnit(NumberTickUnit unit, boolean notify, - boolean turnOffAutoSelect) { + boolean turnOffAutoSelect) { ParamChecks.nullNotPermitted(unit, "unit"); this.tickUnit = unit; @@ -519,7 +521,7 @@ * @see #java2DToValue(double, Rectangle2D, RectangleEdge) */ public double valueToJava2D(double value, Rectangle2D area, - RectangleEdge edge) { + RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); @@ -559,7 +561,7 @@ * @see #valueToJava2D(double, Rectangle2D, RectangleEdge) */ public double java2DToValue(double java2DValue, Rectangle2D area, - RectangleEdge edge) { + RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); @@ -658,16 +660,13 @@ // draw the tick marks and labels... state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); -// // draw the marker band (if there is one)... -// if (getMarkerBand() != null) { -// if (edge == RectangleEdge.BOTTOM) { -// cursor = cursor - getMarkerBand().getHeight(g2); -// } -// getMarkerBand().draw(g2, plotArea, dataArea, 0, cursor); -// } - - // draw the axis label... - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } createAndAddEntity(cursor, state, dataArea, edge, plotState); return state; @@ -1186,8 +1185,7 @@ else { tickLabel = getTickUnit().valueToString(currentTickValue); } - TextAnchor anchor = null; - TextAnchor rotationAnchor = null; + TextAnchor anchor, rotationAnchor; double angle = 0.0; if (isVerticalTickLabels()) { anchor = TextAnchor.CENTER_RIGHT; @@ -1389,12 +1387,7 @@ * @return A hash code. */ public int hashCode() { - if (getLabel() != null) { - return getLabel().hashCode(); - } - else { - return 0; - } + return super.hashCode(); } } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis3D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis3D.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/NumberAxis3D.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -64,7 +64,8 @@ * ------------- JFREECHART 1.0.x --------------------------------------------- * 18-Jan-2006 : Fixed bug 1408904 (axis assumes CategoryPlot) (DG): * 16-Apr-2009 : Changed axis line visibility default (DG); - * + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); * */ package org.jfree.chart.axis; @@ -167,9 +168,12 @@ AxisState info = drawTickMarksAndLabels(g2, cursor, plotArea, adjustedDataArea, edge); - // draw the axis label... - info = drawLabel(getLabel(), g2, plotArea, dataArea, edge, info); - + if (getAttributedLabel() != null) { + info = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, info); + } else { + info = drawLabel(getLabel(), g2, plotArea, dataArea, edge, info); + } return info; } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/PeriodAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/PeriodAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/PeriodAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -58,6 +58,8 @@ * 19-May-2009 : Fixed FindBugs warnings, patch by Michal Wozniak (DG); * 02-Jul-2013 : Use ParamChecks (DG); * 25-Jul-2013 : Fix for axis timezone and label formatting, bug 1107 (DG); + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); * */ @@ -215,9 +217,8 @@ * @deprecated As of version 1.0.13, you should use the constructor that * specifies a Locale also. */ - public PeriodAxis(String label, - RegularTimePeriod first, RegularTimePeriod last, - TimeZone timeZone) { + public PeriodAxis(String label, RegularTimePeriod first, + RegularTimePeriod last, TimeZone timeZone) { this(label, first, last, timeZone, Locale.getDefault()); } @@ -547,8 +548,8 @@ * @param notify a flag that controls whether or not listeners are * notified. */ - public void setRange(Range range, boolean turnOffAutoRange, - boolean notify) { + public void setRange(Range range, boolean turnOffAutoRange, + boolean notify) { long upper = Math.round(range.getUpperBound()); long lower = Math.round(range.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, @@ -583,9 +584,8 @@ * @return The space required to draw the axis (including pre-reserved * space). */ - public AxisSpace reserveSpace(Graphics2D g2, Plot plot, - Rectangle2D plotArea, RectangleEdge edge, - AxisSpace space) { + public AxisSpace reserveSpace(Graphics2D g2, Plot plot, + Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { // create a new space object if one wasn't supplied... if (space == null) { space = new AxisSpace(); @@ -667,10 +667,13 @@ } } - // draw the axis label (note that 'state' is passed in *and* - // returned)... - axisState = drawLabel(getLabel(), g2, plotArea, dataArea, edge, - axisState); + if (getAttributedLabel() != null) { + axisState = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, axisState); + } else { + axisState = drawLabel(getLabel(), g2, plotArea, dataArea, edge, + axisState); + } return axisState; } @@ -683,9 +686,8 @@ * @param dataArea the data area. * @param edge the edge. */ - protected void drawTickMarks(Graphics2D g2, AxisState state, - Rectangle2D dataArea, - RectangleEdge edge) { + protected void drawTickMarks(Graphics2D g2, AxisState state, + Rectangle2D dataArea, RectangleEdge edge) { if (RectangleEdge.isTopOrBottom(edge)) { drawTickMarksHorizontal(g2, state, dataArea, edge); } @@ -704,8 +706,7 @@ * @param edge the edge. */ protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state, - Rectangle2D dataArea, - RectangleEdge edge) { + Rectangle2D dataArea, RectangleEdge edge) { List ticks = new ArrayList(); double x0; double y0 = state.getCursor(); @@ -792,8 +793,7 @@ * @param edge the edge. */ protected void drawTickMarksVertical(Graphics2D g2, AxisState state, - Rectangle2D dataArea, - RectangleEdge edge) { + Rectangle2D dataArea, RectangleEdge edge) { // FIXME: implement this... } @@ -1129,12 +1129,7 @@ * @return A hash code. */ public int hashCode() { - if (getLabel() != null) { - return getLabel().hashCode(); - } - else { - return 0; - } + return super.hashCode(); } /** Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/SubCategoryAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/SubCategoryAxis.java 2013-08-01 11:40:17 UTC (rev 2783) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/SubCategoryAxis.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -46,7 +46,8 @@ * 13-Nov-2008 : Fix NullPointerException when dataset is null - see bug * report 2275695 (DG); * 02-Jul-2013 : Use ParamChecks (DG); - * + * 01-Aug-2013 : Added attributedLabel override to support superscripts, + * subscripts and more (DG); * */ package org.jfree.chart.axis; @@ -63,6 +64,7 @@ import java.io.Serializable; import java.util.Iterator; import java.util.List; +import java.util.Objects; import org.jfree.chart.event.AxisChangeEvent; import org.jfree.chart.plot.CategoryPlot; @@ -265,8 +267,12 @@ plotState); state = drawCategoryLabels(g2, plotArea, dataArea, edge, state, plotState); - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); - + if (getAttributedLabel() != null) { + state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, + dataArea, edge, state); + } else { + state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); + } return state; } @@ -407,6 +413,11 @@ return false; } + @Override + public int hashCode() { + return super.hashCode(); + } + /** * Provides serialization support. * Added: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/AttrStringUtils.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/AttrStringUtils.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/AttrStringUtils.java 2013-08-01 15:08:14 UTC (rev 2784) @@ -0,0 +1,301 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * -------------------- + * AttrStringUtils.java + * -------------------- + * (C) Copyright 2013 by Object Refinery Limited and Contributors. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes: + * -------- + * 01-Aug-2013 : Version 1, backported from JFreeChart-FSE (DG); + * + */ + +package org.jfree.chart.util; + +import java.awt.Graphics2D; +import java.awt.font.TextLayout; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.text.AttributedString; +import org.jfree.ui.TextAnchor; + +/** + * Some <code>AttributedString</code> utilities. + */ +public class AttrStringUtils { + + private AttrStringUtils() { + // no need to instantiate this class + } + + /** + * Draws the attributed string at <code>(x, y)</code>, rotated by the + * specified angle about <code>(x, y)</code>. + * + * @param text the attributed string (<code>null</code> not permitted). + * @param g2 the graphics output target. + * @param angle the angle. + * @param x the x-coordinate. + * @param y the y-coordinate. + */ + public static void drawRotatedString(AttributedString text, Graphics2D g2, + double angle, float x, float y) { + drawRotatedString(text, g2, x, y, angle, x, y); + } + + /** + * Draws the attributed string at <code>(textX, textY)</code>, rotated by + * the specified angle about <code>(rotateX, rotateY)</code>. + * + * @param text the attributed string (<code>null</code> not permitted). + * @param g2 the graphics output target. + * @param textX + * @param textY + * @param angle + * @param rotateX + * @param rotateY + */ + public static void drawRotatedString(AttributedString text, Graphics2D g2, + float textX, float textY, double angle, float rotateX, + float rotateY) { + ParamChecks.nullNotPermitted(text, "text"); + + AffineTransform saved = g2.getTransform(); + AffineTransform rotate = AffineTransform.getRotateInstance(angle, + rotateX, rotateY); + g2.transform(rotate); + TextLayout tl = new TextLayout(text.getIterator(), + g2.getFontRenderContext()); + tl.draw(g2, textX, textY); + + g2.setTransform(saved); + } + + /** + * + * @param text + * @param g2 + * @param x + * @param y + * @param textAnchor + * @param angle + * @param rotationX + * @param rotationY + */ + public static void drawRotatedString(AttributedString text, Graphics2D g2, + float x, float y, TextAnchor textAnchor, + final double angle, float rotationX, float rotationY) { + ParamChecks.nullNotPermitted(text, "text"); + float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor, + null); + drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1], angle, + rotationX, rotationY); + } + + /** + * + * @param text + * @param g2 + * @param x + * @param y + * @param textAnchor + * @param angle + * @param rotationAnchor + */ + public static void drawRotatedString(AttributedString text, Graphics2D g2, + float x, float y, TextAnchor textAnchor, + double angle, TextAnchor rotationAnchor) { + ParamChecks.nullNotPermitted(text, "text"); + float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor, + null); + float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, + rotationAnchor); + drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1], + angle, x + textAdj[0] + rotateAdj[0], + y + textAdj[1] + rotateAdj[1]); + } + + private static float[] deriveTextBoundsAnchorOffsets(Graphics2D g2, + AttributedString text, TextAnchor anchor, Rectangle2D textBounds) { + + TextLayout layout = new TextLayout(text.getIterator(), g2.getFontRenderContext()); + Rectangle2D bounds = layout.getBounds(); + + float[] result = new float[3]; + float ascent = layout.getAscent(); + result[2] = -ascent; + float halfAscent = ascent / 2.0f; + float descent = layout.getDescent(); + float leading = layout.getLeading(); + float xAdj = 0.0f; + float yAdj = 0.0f; + + if (isHorizontalCenter(anchor)) { + xAdj = (float) -bounds.getWidth() / 2.0f; + } + else if (isHorizontalRight(anchor)) { + xAdj = (float) -bounds.getWidth(); + } + + if (isTop(anchor)) { + yAdj = -descent - leading + (float) bounds.getHeight(); + } + else if (isHalfAscent(anchor)) { + yAdj = halfAscent; + } + else if (isHalfHeight(anchor)) { + yAdj = -descent - leading + (float) (bounds.getHeight() / 2.0); + } + else if (isBaseline(anchor)) { + yAdj = 0.0f; + } + else if (isBottom(anchor)) { + yAdj = -descent - leading; + } + if (textBounds != null) { + textBounds.setRect(bounds); + } + result[0] = xAdj; + result[1] = yAdj; + return result; + } + + /** + * A utility method that calculates the rotation anchor offsets for a + * string. These offsets are relative to the text starting coordinate + * (BASELINE_LEFT). + * + * @param g2 the graphics device. + * @param text the text. + * @param anchor the anchor point. + * + * @return The offsets. + */ + private static float[] deriveRotationAnchorOffsets(Graphics2D g2, + AttributedString text, TextAnchor anchor) { + + float[] result = new float[2]; + + TextLayout layout = new TextLayout(text.getIterator(), + g2.getFontRenderContext()); + Rectangle2D bounds = layout.getBounds(); + float ascent = layout.getAscent(); + float halfAscent = ascent / 2.0f; + float descent = layout.getDescent(); + float leading = layout.getLeading(); + float xAdj = 0.0f; + float yAdj = 0.0f; + + if (isHorizontalLeft(anchor)) { + xAdj = 0.0f; + } + else if (isHorizontalCenter(anchor)) { + xAdj = (float) bounds.getWidth() / 2.0f; + } + else if (isHorizontalRight(anchor)) { + xAdj = (float) bounds.getWidth(); + } + + if (isTop(anchor)) { + yAdj = descent + leading - (float) bounds.getHeight(); + } + else if (isHalfHeight(anchor)) { + yAdj = descent + leading - (float) (bounds.getHeight() / 2.0); + } + else if (isHalfAscent(anchor)) { + yAdj = -halfAscent; + } + else if (isBaseline(anchor)) { + yAdj = 0.0f; + } + else if (isBottom(anchor)) { + yAdj = descent + leading; + } + result[0] = xAdj; + result[1] = yAdj; + return result; + + } + + private static boolean isTop(TextAnchor anchor) { + return anchor.equals(TextAnchor.TOP_LEFT) + || anchor.equals(TextAnchor.TOP_CENTER) + || anchor.equals(TextAnchor.TOP_RIGHT); + } + + private static boolean isBaseline(TextAnchor anchor) { + return anchor.equals(TextAnchor.BASELINE_LEFT) + || anchor.equals(TextAnchor.BASELINE_CENTER) + || anchor.equals(TextAnchor.BASELINE_RIGHT); + } + + private static boolean isHalfAscent(TextAnchor anchor) { + return anchor.equals(TextAnchor.HALF_ASCENT_LEFT) + || anchor.equals(TextAnchor.HALF_ASCENT_CENTER) + || anchor.equals(TextAnchor.HALF_ASCENT_RIGHT); + } + + private static boolean isHalfHeight(TextAnchor anchor) { + return anchor.equals(TextAnchor.CENTER_LEFT) + || anchor.equals(TextAnchor.CENTER) + || anchor.equals(TextAnchor.CENTER_RIGHT); + } + + private static boolean isBottom(TextAnchor anchor) { + return anchor.equals(TextAnchor.BOTTOM_LEFT) + || anchor.equals(TextAnchor.BOTTOM_CENTER) + || anchor.equals(TextAnchor.BOTTOM_RIGHT); + } + + private static boolean isHorizontalLeft(TextAnchor anchor) { + return anchor.equals(TextAnchor.TOP_LEFT) + || anchor.equals(TextAnchor.CENTER_LEFT) + || anchor.equals(TextAnchor.HALF_ASCENT_LEFT) + || anchor.equals(TextAnchor.BASELINE_LEFT) + || anchor.equals(TextAnchor.BOTTOM_LEFT); + } + + private static boolean isHorizontalCenter(TextAnchor anchor) { + return anchor.equals(TextAnchor.TOP_CENTER) + || anchor.equals(TextAnchor.CENTER) + || anchor.equals(TextAnchor.HALF_ASCENT_CENTER) + || anchor.equals(TextAnchor.BASELINE_CENTER) + || anchor.equals(TextAnchor.BOTTOM_CENTER); + } + + private static boolean isHorizontalRight(TextAnchor anchor) { + return anchor.equals(TextAnchor.TOP_RIGH... [truncated message content] |
From: <mu...@us...> - 2013-08-10 10:30:21
|
Revision: 2893 http://sourceforge.net/p/jfreechart/code/2893 Author: mungady Date: 2013-08-10 10:30:17 +0000 (Sat, 10 Aug 2013) Log Message: ----------- 2013-08-10 David Gilbert <dav...@ob...> * org/jfree/data/general/DatasetUtilities.java (findYValue): New method, (findItemIndicesForX): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-10 10:29:34 UTC (rev 2892) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-10 10:30:17 UTC (rev 2893) @@ -1,3 +1,9 @@ +2013-08-10 David Gilbert <dav...@ob...> + + * org/jfree/data/general/DatasetUtilities.java + (findYValue): New method, + (findItemIndicesForX): Likewise. + 2013-08-04 David Gilbert <dav...@ob...> * org/jfree/chart/ChartFactory.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-08-10 10:29:34 UTC (rev 2892) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-08-10 10:30:17 UTC (rev 2893) @@ -4,8 +4,10 @@ Provided subscript/superscript support for axis labels (via AttributedString), new axis label positioning options, simplified ChartFactory methods, +added new methods to DatasetUtilities to interpolate y-values in XYDatasets, added URLs to labels on CategoryAxis, improved the consistency of the -SWTGraphics2D implementation, and various bug fixes. +SWTGraphics2D implementation, and fixed various bugs. All the JUnit tests +have been upgraded to JUnit 4. Bug Fixes: 1107 : Fixed TimeZone issue in PeriodAxis. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2013-08-30 13:12:44
|
Revision: 2902 http://sourceforge.net/p/jfreechart/code/2902 Author: mungady Date: 2013-08-30 13:12:40 +0000 (Fri, 30 Aug 2013) Log Message: ----------- Updated ChangeLog and NEWS. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-30 13:03:59 UTC (rev 2901) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-08-30 13:12:40 UTC (rev 2902) @@ -1,3 +1,19 @@ +2013-08-30 David Gilbert <dav...@ob...> + + * org/jfree/chart/renderer/xy/StackedXYAreaRenderer.java + (drawItem): Set stroke and paint for drawing lines (bugfix). + +2013-08-16 David Gilbert <dav...@ob...> + + * org/jfree/chart/plot/CombinedDomainCategoryPlot.java + (setShadowGenerator): New method override, + * org/jfree/chart/plot/CombinedRangeCategoryPlot.java + (setShadowGenerator): Likewise, + * org/jfree/chart/plot/CombinedDomainXYPlot.java + (setShadowGenerator): Likewise, + * org/jfree/chart/plot/CombinedRangeXYPlot.java + (setShadowGenerator): Likewise. + 2013-08-15 David Gilbert <dav...@ob...> * org/jfree/chart/plot/PiePlot.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-08-30 13:03:59 UTC (rev 2901) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-08-30 13:12:40 UTC (rev 2902) @@ -14,7 +14,8 @@ Bug Fixes: 1107 : Fixed TimeZone issue in PeriodAxis. -Also fixed a memory leak in the SWT ChartComposite class. +Also fixed a line drawing issue with the StackedXYAreaRenderer, and a memory +leak in the SWT ChartComposite class. JFreeChart 1.0.15 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2013-09-12 16:12:38
|
Revision: 2916 http://sourceforge.net/p/jfreechart/code/2916 Author: mungady Date: 2013-09-12 16:12:35 +0000 (Thu, 12 Sep 2013) Log Message: ----------- Updates for the 1.0.16 release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2013-09-12 15:55:00 UTC (rev 2915) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2013-09-12 16:12:35 UTC (rev 2916) @@ -1,3 +1,38 @@ +2013-09-12 David Gilbert <dav...@ob...> + + * org/jfree/chart/LocalizationBundle.properties + (FILE_EXISTS_CONFIRM_OVERWRITE): New entry, + (PDF_Files): Likewise, + (SVG_Files): Likewise, + * org/jfree/chart/ChartPanel.java + (SAVE_AS_PNG_COMMAND): New field, + (SAVE_AS_SVG_COMMAND): Likewise, + (SAVE_AS_PDF_COMMAND): Likewise, + (actionPerformed): Handle SVG and PDF options, + (saveAsSVG): New private method, + (generateSVG): New method, + (createSVGGraphics2D): New private method, + (saveAsPDF): Likewise, + (isOrsonPDFAvailable): Likewise, + (writeAsPDF): Likewise, + (createPopupMenu): Add SVG and PDF options when available, + * org/jfree/chart/plot/PiePlot.java + (draw): Check for KEY_SUPPRESS_SHADOW_GENERATION rendering hint, + * org/jfree/chart/plot/CategoryPlot.java + (draw): Likewise, + * org/jfree/chart/plot/XYPlot.java + (draw): Likewise. + +2013-09-12 David Gilbert <dav...@ob...> + + * org/jfree/chart/JFreeChart.java + (KEY_SUPPRESS_SHADOW_GENERATION): new field. + +2013-09-12 David Gilbert <dav...@ob...> + + * org/jfree/chart/axis/DateAxis.java + (zoomRange): Prevent axis range from falling below 1 millisecond. + 2013-08-30 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/xy/StackedXYAreaRenderer.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-09-12 15:55:00 UTC (rev 2915) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-09-12 16:12:35 UTC (rev 2916) @@ -1,14 +1,16 @@ JFreeChart 1.0.16 ----------------- -Not yet released +13 September 2013 -THIS RELEASE REQUIRES JDK/JRE 1.6.0 OR LATER. +*** THIS RELEASE REQUIRES JDK/JRE 1.6.0 OR LATER. *** Provided subscript/superscript support for axis labels (via AttributedString), new axis label positioning options, simplified ChartFactory methods, added new methods to DatasetUtilities to interpolate y-values in XYDatasets, -added URLs to labels on CategoryAxis, improved the consistency of the -SWTGraphics2D implementation, and fixed various bugs. All the JUnit tests +added URLs to labels on CategoryAxis, seamless integration with +JFreeSVG (http://www.jfree.org/jfreesvg/) and OrsonPDF +(http://www.object-refinery.com/pdf/), improved the consistency of the +SWTGraphics2D implementation, and fixed various bugs. All the JUnit tests have been upgraded to JUnit 4. Bug Fixes: @@ -17,7 +19,13 @@ Also fixed a line drawing issue with the StackedXYAreaRenderer, and a memory leak in the SWT ChartComposite class. +IMPORTANT: Funding is vital to the continued success of the JFreeChart project. +Please ask/persuade/beg your company to support us buy purchasing the +JFreeChart Developer Guide and demo source code (site license options are +available for big companies)...and also please take a look at JFreeSVG and +OrsonPDF, useful products that we are charging money for! + JFreeChart 1.0.15 ----------------- 4-July-2013 Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2013-09-12 15:55:00 UTC (rev 2915) +++ branches/jfreechart-1.0.x-branch/README.txt 2013-09-12 16:12:35 UTC (rev 2916) @@ -2,7 +2,7 @@ * JFREECHART: Version 1.0.16 * ******************************** -?? ??? 2013 +13 September 2013 (C)opyright 2000-2013, by Object Refinery Limited and Contributors. @@ -62,10 +62,11 @@ JFreeChart has the following dependencies: (a) JRE/JDK 1.6.0 or higher - note that the previous release of JFreeChart -worked with JRE/JDK 1.4.2 or later. It may be possible to get JFreeChart -working on these older versions, but we are no longer actively checking. +worked with JRE/JDK 1.4.2 or later. With a bit of hacking, it may be possible +to get JFreeChart working on these older versions, but we are no longer +supporting it. -(b) JCommon - version 1.0.0 or later. The runtime jar file (version 1.0.18) +(b) JCommon - version 1.0.0 or later. The runtime jar file (version 1.0.20) is included in the JFreeChart distribution. You can obtain the complete source code for JCommon from: @@ -127,12 +128,6 @@ The complete source code for the demo application is available for download when you purchase the JFreeChart Developer Guide. -The demo application uses iText, a library for creating PDF documents. -iText is licensed under the terms of the GNU Lesser General Public Licence -and is available to download from: - - http://www.lowagie.com/iText/ - --------------- 8. LIMITATIONS --------------- @@ -156,7 +151,7 @@ -------------- A list of changes in recent versions: -1.0.16 : (?-???-2013) +1.0.16 : (13-Sep-2013) - see the NEWS and ChangeLog files for details. 1.0.15 : (4-Jul-2013) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2013-11-24 05:48:23
|
Revision: 3064 http://sourceforge.net/p/jfreechart/code/3064 Author: mungady Date: 2013-11-24 05:48:10 +0000 (Sun, 24 Nov 2013) Log Message: ----------- Updates for release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2013-11-24 05:13:49 UTC (rev 3063) +++ branches/jfreechart-1.0.x-branch/NEWS 2013-11-24 05:48:10 UTC (rev 3064) @@ -1,6 +1,6 @@ JFreeChart 1.0.17 ----------------- -23 November 2013 +24 November 2013 Enhanced XYSplineRenderer with new area fill (contributed by Klaus Rheinwald), added a notify flag to all datasets that extend AbstractDataset, extended @@ -30,8 +30,8 @@ > http://www.object-refinery.com/orsoncharts > > We've also added a tab to the JFreeChart demo application so you can see -> Orson Charts in action. Orson Charts is not free, but provides a very -> nice complement to the extensive 2D charting capabilities of JFreeChart. +> Orson Charts in action. Orson Charts is not free, but provides a superb +> complement to the extensive 2D charting capabilities of JFreeChart. JFreeChart 1.0.16 Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2013-11-24 05:13:49 UTC (rev 3063) +++ branches/jfreechart-1.0.x-branch/README.txt 2013-11-24 05:48:10 UTC (rev 3064) @@ -2,7 +2,7 @@ * JFREECHART: Version 1.0.17 * ******************************** -22 November 2013 +24 November 2013 (C)opyright 2000-2013, by Object Refinery Limited and Contributors. @@ -132,6 +132,12 @@ provide export facilities to the SVG and PDF formats. These fast, lightweight libraries are not free, licenses can be purchased from Object Refinery Limited. +An additional tab added to the demo application in version 1.0.17 showcases +Orson Charts 3D, a new library by Object Refinery Limited. You can find out +more about Orson Charts at: + + http://www.object-refinery.com/orsoncharts/ + --------------- 8. LIMITATIONS --------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-09 09:28:05
|
Revision: 3124 http://sourceforge.net/p/jfreechart/code/3124 Author: mungady Date: 2014-04-09 09:28:02 +0000 (Wed, 09 Apr 2014) Log Message: ----------- 2013-04-07 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeriesCollection.java (getRangeBounds(List, Range, boolean)): Observe the xRange, * org/jfree/data/Range.java (combineIgnoringNaN): Improve NaN handling consistency. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-09 09:28:02 UTC (rev 3124) @@ -1,3 +1,25 @@ +2013-04-07 David Gilbert <dav...@ob...> + + * org/jfree/data/time/TimeSeriesCollection.java + (getRangeBounds(List, Range, boolean)): Observe the xRange, + * org/jfree/data/Range.java + (combineIgnoringNaN): Improve NaN handling consistency. + +2013-04-07 David Gilbert <dav...@ob...> + + * org/jfree/chart/labels/StandardPieSectionLabelGenerator.java + (attributedLabels): Change from ObjectList to Map, + (StandardPieSectionLabelGenerator): Modify initialisation of storage, + (setAttributedLabel): Storage changed to map, + (equals): Simplification, + (clone): Clone the attributed labels, + * org/jfree/chart/StrokeMap.java + (clone): Clone the storage, + * org/jfree/chart/PaintMap.java + (clone): Likewise, + * org/jfree/chart/plot/PiePlot.java + (clone): Clone required fields. + 2013-03-19 David Gilbert <dav...@ob...> * org/jfree/chart/axis/SymbolAxis.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java 2014-04-09 09:28:02 UTC (rev 3124) @@ -239,16 +239,34 @@ */ public static Range combineIgnoringNaN(Range range1, Range range2) { if (range1 == null) { + if (range2 != null && range2.isNaNRange()) { + return null; + } return range2; } if (range2 == null) { + if (range1.isNaNRange()) { + return null; + } return range1; } double l = min(range1.getLowerBound(), range2.getLowerBound()); double u = max(range1.getUpperBound(), range2.getUpperBound()); + if (Double.isNaN(l) && Double.isNaN(u)) { + return null; + } return new Range(l, u); } + /** + * Returns the minimum value. If either value is NaN, the other value is + * returned. If both are NaN, NaN is returned. + * + * @param d1 value 1. + * @param d2 value 2. + * + * @return The minimum of the two values. + */ private static double min(double d1, double d2) { if (Double.isNaN(d1)) { return d2; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java 2014-04-09 09:28:02 UTC (rev 3124) @@ -737,8 +737,8 @@ while (iterator.hasNext()) { Comparable seriesKey = (Comparable) iterator.next(); TimeSeries series = getSeries(seriesKey); - Range r = new Range(series.getMinY(), series.getMaxY()); - // FIXME: Here we are ignoring the xRange + Range r = series.findValueRange(xRange, this.xPosition, + this.workingCalendar.getTimeZone()); result = Range.combineIgnoringNaN(result, r); } return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-20 23:15:12
|
Revision: 3128 http://sourceforge.net/p/jfreechart/code/3128 Author: mungady Date: 2014-06-20 23:15:02 +0000 (Fri, 20 Jun 2014) Log Message: ----------- 2014-06-21 David Gilbert <dav...@ob...> * org/jfree/chart/JFreeChart.java (JFreeChart): Add new rendering hint, (setAntiAlias): Simplify, (readObject): Update initialisation of rendering hints. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-11 15:08:18 UTC (rev 3127) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-20 23:15:02 UTC (rev 3128) @@ -1,11 +1,18 @@ -2013-04-07 David Gilbert <dav...@ob...> +2014-06-21 David Gilbert <dav...@ob...> + + * org/jfree/chart/JFreeChart.java + (JFreeChart): Add new rendering hint, + (setAntiAlias): Simplify, + (readObject): Update initialisation of rendering hints. + +2014-04-07 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeriesCollection.java (getRangeBounds(List, Range, boolean)): Observe the xRange, * org/jfree/data/Range.java (combineIgnoringNaN): Improve NaN handling consistency. -2013-04-07 David Gilbert <dav...@ob...> +2014-04-07 David Gilbert <dav...@ob...> * org/jfree/chart/labels/StandardPieSectionLabelGenerator.java (attributedLabels): Change from ObjectList to Map, @@ -20,13 +27,13 @@ * org/jfree/chart/plot/PiePlot.java (clone): Clone required fields. -2013-03-19 David Gilbert <dav...@ob...> +2014-03-19 David Gilbert <dav...@ob...> * org/jfree/chart/axis/SymbolAxis.java (drawGridBandsHorizontal): Take into account inverted axis, (drawGridBandsVertical): Likewise. -2013-03-18 David Gilbert <dav...@ob...> +2014-03-18 David Gilbert <dav...@ob...> * org/jfree/chart/utils/AttrStringUtils.java (getTextBounds): New method, Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java 2014-04-11 15:08:18 UTC (rev 3127) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java 2014-06-20 23:15:02 UTC (rev 3128) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------- * JFreeChart.java * --------------- - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Andrzej Porebski; @@ -149,6 +149,7 @@ * 19-May-2009 : Fixed FindBugs warnings, patch by Michal Wozniak (DG); * 29-Jun-2009 : Check visibility flag in main title (DG); * 02-Jul-2013 : Use ParamChecks class (DG); + * 21-Jun-2014 : Set default hint value for stroke control (DG); * */ @@ -402,7 +403,11 @@ this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - + // added the following hint because of + // http://stackoverflow.com/questions/7785082/ + this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_PURE); + this.borderVisible = false; this.borderStroke = new BasicStroke(1.0f); this.borderPaint = Color.black; @@ -877,26 +882,10 @@ * @see #getAntiAlias() */ public void setAntiAlias(boolean flag) { - - Object val = this.renderingHints.get(RenderingHints.KEY_ANTIALIASING); - if (val == null) { - val = RenderingHints.VALUE_ANTIALIAS_DEFAULT; - } - if (!flag && RenderingHints.VALUE_ANTIALIAS_OFF.equals(val) - || flag && RenderingHints.VALUE_ANTIALIAS_ON.equals(val)) { - // no change, do nothing - return; - } - if (flag) { - this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } - else { - this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_OFF); - } + Object hint = flag ? RenderingHints.VALUE_ANTIALIAS_ON + : RenderingHints.VALUE_ANTIALIAS_OFF; + this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, hint); fireChartChanged(); - } /** @@ -1148,9 +1137,8 @@ * (<code>null</code> permitted). * @param info records info about the drawing (null means collect no info). */ - public void draw(Graphics2D g2, - Rectangle2D chartArea, Point2D anchor, - ChartRenderingInfo info) { + public void draw(Graphics2D g2, Rectangle2D chartArea, Point2D anchor, + ChartRenderingInfo info) { notifyListeners(new ChartProgressEvent(this, this, ChartProgressEvent.DRAWING_STARTED, 0)); @@ -1678,7 +1666,9 @@ this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - + this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_PURE); + // register as a listener with sub-components... if (this.title != null) { this.title.addChangeListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-07-03 20:28:56
|
Revision: 3246 http://sourceforge.net/p/jfreechart/code/3246 Author: mungady Date: 2014-07-03 20:28:47 +0000 (Thu, 03 Jul 2014) Log Message: ----------- Updates for release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-07-03 20:26:42 UTC (rev 3245) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-07-03 20:28:47 UTC (rev 3246) @@ -1,3 +1,25 @@ +2014-07-03 David Gilbert <dav...@ob...> + + * org/jfree/chart/axis/NumberTickUnitSource.java + (integers): New field, + (formatter): New field, + (NumberTickUnitSource(boolean)): New constructor, + (NumberTickUnitSource(boolean, NumberFormatter): Likewise, + (getCeilingTickUnit): Update for factors and integer setting, + (next): Add factor 2 and limits, + (previous): Likewise, + (getTickLabelFormat): Add override, + (equals): Take account of new fields, + * org/jfree/chart/axis/LogAxis.java + (java2DToValue): Use minimum value if required, + (selectHorizontalAutoTickUnit): Likewise, + (selectVerticalAutoTickUnit): Likewise, + * org/jfree/chart/axis/NumberAxis.java + (createStandardTickUnits): Return a NumberTickUnitSource, + (createIntegerTickUnits): Likewise, + * org/jfree/chart/axis/ValueAxis.java + (zoomRange): Handle limits. + 2014-07-01 David Gilbert <dav...@ob...> * org/jfree/chart/plot/CategoryPlot.java: Numerous changes to fix iteration Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2014-07-03 20:26:42 UTC (rev 3245) +++ branches/jfreechart-1.0.x-branch/NEWS 2014-07-03 20:28:47 UTC (rev 3246) @@ -1,17 +1,19 @@ JFreeChart 1.0.18 ----------------- -?? July 2014 +3 July 2014 Added JavaFX support with a new ChartViewer control that supports tooltips, mouse clicks, panning, zooming and a context menu. Modified LogAxis to -support super-scripted labels, enhanced XYStepAreaRenderer to support a -'stepPoint' attribute (patch from Lukasz Rzeszotarski), provided -configurable direction labels in CompassFormat (patch from Simon Legner), -added methods to add data item objects to VectorSeries, XIntervalSeries, -YIntervalSeries and XYIntervalSeries (for consistency with other data series -objects), improved the TimeSeries range calculations, provided center text -support for the RingPlot class, and updated JCommon to version 1.0.22 (this -fixes a bug in pie label rendering). +support super-scripted labels, improved the tick label generation for +NumberAxis, added a new ProbabilityAxis (patch from John St. Ledger), +enhanced XYStepAreaRenderer to support a 'stepPoint' attribute (patch from +Lukasz Rzeszotarski), provided configurable direction labels in +CompassFormat (patch from Simon Legner), added methods to add data item +objects to VectorSeries, XIntervalSeries, YIntervalSeries and +XYIntervalSeries (for consistency with other data series objects), +improved the TimeSeries range calculations, provided center text support +for the RingPlot class, and updated JCommon to version 1.0.22 (this fixes +a bug in pie label rendering). Bug Fixes: Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2014-07-03 20:26:42 UTC (rev 3245) +++ branches/jfreechart-1.0.x-branch/README.txt 2014-07-03 20:28:47 UTC (rev 3246) @@ -2,7 +2,7 @@ * JFREECHART: Version 1.0.18 * ******************************** -?? July 2014 +3 July 2014 (C)opyright 2000-2014, by Object Refinery Limited and Contributors. @@ -161,9 +161,10 @@ -------------- A list of changes in recent versions: -1.0.18 : (??-Jul-2014) - - added JavaFX support; +1.0.18 : (3-Jul-2014) + - added JavaFX support via FXGraphics2D; - improved LogAxis labelling; + - improved numeric tick labelling; - center text support in RingPlot; - 'stepPoint' attribute in the XYStepAreaRenderer; - other minor improvements and bug fixes, see the NEWS and ChangeLog This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-07-31 08:38:33
|
Revision: 3276 http://sourceforge.net/p/jfreechart/code/3276 Author: mungady Date: 2014-07-31 08:38:25 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Updates for 1.0.19 release Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-07-31 08:30:10 UTC (rev 3275) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-07-31 08:38:25 UTC (rev 3276) @@ -1,3 +1,28 @@ +2014-07-29 David Gilbert <dav...@ob...> + + * org/jfree/chart/axis/Axis.java + (drawAxisLine): Add rendering hint, + * org/jfree/chart/axis/CategoryAxis.java + (drawTickMarks): Add rendering hint, + * org/jfree/chart/axis/ValueAxis.java + (drawAxisLine): Add rendering hint, + (drawTickMarksAndLabels): Likewise, + * org/jfree/chart/block/LineBorder.java + (draw): Add rendering hint, + * org/jfree/chart/plot/FastScatterPlot.java + (drawDomainGridlines): Add rendering hint, + (drawRangeGridlines): Likewise, + * org/jfree/chart/plot/Plot.java + (drawOutline): Add rendering hint, + * org/jfree/chart/plot/XYPlot.java + (drawDomainCrosshair): Add rendering hint, + (drawRangeCrosshair): Likewise, + * org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java + (drawRangeLine): Add rendering hint, + * org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java + (drawDomainLine): Add rendering hint, + (drawRangeLine): Likewise. + 2014-07-21 David Gilbert <dav...@ob...> * org/jfree/chart/fx/FXGraphics2D.java Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2014-07-31 08:30:10 UTC (rev 3275) +++ branches/jfreechart-1.0.x-branch/NEWS 2014-07-31 08:38:25 UTC (rev 3276) @@ -1,3 +1,21 @@ +JFreeChart 1.0.19 +----------------- +31 July 2014 + +This maintenance release corrects some issues in the new JavaFX support that +was added in the 1.0.18 release, as well as some general issues. + +Bug Fixes: + +- fixed clipping issues for combined plots in JavaFX; +- fix a memory leak in the new JavaFX ChartCanvas class; +- CombinedDomainXYPlot and CombinedRangeXYPlot now take into account the + pannable flags in the subplots; +- FastScatterPlot panning direction is corrected; +- added rendering hints to sharpen gridlines and borders in most output formats; +- JFreeSVG updated to version 2.0. + + JFreeChart 1.0.18 ----------------- 3 July 2014 Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2014-07-31 08:30:10 UTC (rev 3275) +++ branches/jfreechart-1.0.x-branch/README.txt 2014-07-31 08:38:25 UTC (rev 3276) @@ -1,8 +1,8 @@ ******************************** -* JFREECHART: Version 1.0.18 * +* JFREECHART: Version 1.0.19 * ******************************** -3 July 2014 +31 July 2014 (C)opyright 2000-2014, by Object Refinery Limited and Contributors. @@ -11,7 +11,8 @@ ----------------- JFreeChart is a free chart library for the Java(tm) platform. It runs on the Java 2 Platform (JRE 1.6.0 or later) and uses the Java 2D API for -drawing. +drawing. There is also JavaFX support available, but requiring JDK 1.8.0 or +later. JFreeChart is licensed under the terms of the GNU Lesser General Public Licence (LGPL). A copy of the licence is included in the @@ -38,8 +39,8 @@ 3. DOCUMENTATION ----------------- You can download installation instructions -(jfreechart-1.0.18-install.pdf) from the JFreeChart home -page or the project page on SourceForge. +(jfreechart-1.0.19-install.pdf) from the JFreeChart home page or the project +page on SourceForge. Further documentation for JFreeChart (the JFreeChart Developer Guide) is available to purchase from by Object Refinery Limited, a company owned and @@ -65,9 +66,9 @@ JavaFX support (and you will need to rebuild the library using the ant/build-fx.xml script). -(b) JCommon - version 1.0.0 or later. The runtime jar file (version 1.0.22) -is included in the JFreeChart distribution. You can obtain the complete -source code for JCommon from: +(b) JCommon - the runtime jar file (version 1.0.23) is included in the +JFreeChart distribution. You can obtain the complete source code for JCommon +from: http://www.jfree.org/jcommon/ @@ -115,30 +116,53 @@ use this script as it includes certain files (for example, .properties files) that you MUST have in the jar file for JFreeChart to function correctly. +----------------- +7. MAVEN POM.XML +----------------- +A Maven pom.xml is included in the distribution, and you can use this to +build JFreeChart *without* JavaFX support. If you want to include the JavaFX +support classes, you'll need to modify the pom.xml file accordingly. + +Both JFreeChart and JCommon are available on the Central Repository: + +<dependency> + <groupId>org.jfree</groupId> + <artifactId>jfreechart</artifactId> + <version>1.0.19</version> +</dependency> + +<dependency> + <groupId>org.jfree</groupId> + <artifactId>jcommon</artifactId> + <version>1.0.23</version> +</dependency> + ------------------------ -7. THE DEMO APPLICATION +8. THE DEMO APPLICATION ------------------------ A demo application that shows a selection of the charts that can be generated is included in the JFreeChart distribution. To run the demo (using JDK 1.6.0 or later), use the following command: - java -jar jfreechart-1.0.18-demo.jar + java -jar jfreechart-1.0.19-demo.jar The complete source code for the demo application is available for download when you purchase the JFreeChart Developer Guide. The demo application also links to the JFreeSVG and OrsonPDF libraries, to provide export facilities to the SVG and PDF formats. These fast, lightweight -libraries are not free, licenses can be purchased from Object Refinery Limited. +libraries are independent from JFreeChart. JFreeSVG is dual licensed under +the GNU GPLv3 and a commercial license, while OrsonPDF is commercially licensed. +Licenses can be purchased from Object Refinery Limited. -An additional tab added to the demo application in version 1.0.18 showcases -Orson Charts, a new 3D chart library by Object Refinery Limited. You can find -out more about Orson Charts at: +An additional tab added to the demo application showcases Orson Charts, a +3D chart library by Object Refinery Limited. You can find out more about +Orson Charts at: http://www.object-refinery.com/orsoncharts/ --------------- -8. LIMITATIONS +9. LIMITATIONS --------------- JFreeChart has some known limitations that will hopefully be addressed in the future: @@ -156,10 +180,20 @@ please post a bug report. -------------- -9. WHAT's NEW +10. WHAT's NEW -------------- A list of changes in recent versions: +1.0.19 : (31-Jul-2014) + - fixed clipping issues for combined plots in JavaFX; + - fix a memory leak in the new JavaFX ChartCanvas class; + - CombinedDomainXYPlot and CombinedRangeXYPlot now take into account the + pannable flags in the subplots; + - FastScatterPlot panning direction is corrected; + - added rendering hints to sharpen gridlines and borders in most output + formats; + - JFreeSVG updated to version 2.0. + 1.0.18 : (3-Jul-2014) - added JavaFX support via FXGraphics2D; - improved LogAxis labelling; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-07-31 09:56:24
|
Revision: 3277 http://sourceforge.net/p/jfreechart/code/3277 Author: mungady Date: 2014-07-31 09:56:07 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Preview of JSFreeChart. Added Paths: ----------- branches/jfreechart-1.0.x-branch/jsfreechart/ branches/jfreechart-1.0.x-branch/jsfreechart/BarChartDemo.html branches/jfreechart-1.0.x-branch/jsfreechart/LineChartDemo.html branches/jfreechart-1.0.x-branch/jsfreechart/README.txt branches/jfreechart-1.0.x-branch/jsfreechart/ScatterChartDemo.html branches/jfreechart-1.0.x-branch/jsfreechart/lib/ branches/jfreechart-1.0.x-branch/jsfreechart/lib/gpl-3.0.txt branches/jfreechart-1.0.x-branch/jsfreechart/lib/jsfreechart.js Added: branches/jfreechart-1.0.x-branch/jsfreechart/BarChartDemo.html =================================================================== --- branches/jfreechart-1.0.x-branch/jsfreechart/BarChartDemo.html (rev 0) +++ branches/jfreechart-1.0.x-branch/jsfreechart/BarChartDemo.html 2014-07-31 09:56:07 UTC (rev 3277) @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<html> + <head> + <title>Bar Chart Demo</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <script type="text/javascript" src="lib/jsfreechart.js"></script> + <style> + .chart_container { height: 100%; width: 100%; } + body { margin: 0; border: 2px; padding: 5px; } + .row, .col { overflow: hidden; position: absolute; } + .row { left: 0; right: 0; } + .col { top: 0; bottom: 0; } + .scroll-x { overflow-x: none; } + .scroll-y { overflow-y: none; } + + .header.row { height: 105px; top: 0; } + .body.row { top: 105px; bottom: 50px; } + .footer.row { height: 50px; bottom: 0; } + </style> + </head> + <body onload="installChart();"> + <script type="application/javascript"> + function installChart() { + var dataset = new jsfc.KeyedValues2DDataset(); + dataset.add("Warm-up", "JFreeSVG", 7445); + dataset.add("Warm-up", "Batik", 24448); + dataset.add("Test", "JFreeSVG", 4297); + dataset.add("Test", "Batik", 21022); + var chart = jsfc.Charts.createBarChart("Performance: JFreeSVG vs Batik", + "Time to generate 1000 charts in SVG (lower bars = better performance)", + dataset, null, "Milliseconds"); + chart.setSize(600, 400); + var svg = document.getElementById("chart_svg"); + document.chartManager = new jsfc.ChartManager(svg, chart); + document.chartManager.refreshDisplay(); + var win = document.defaultView || document.parentWindow; + win.onresize = resize; + }; + function resize(evt) { + var element = document.getElementById("bar_chart_1"); + var w = Math.max(300, element.clientWidth); + var h = Math.max(200, element.clientHeight); + document.chartManager.getChart().setSize(w, h); + document.chartManager.refreshDisplay(); + } + + </script> + <div class="header row"> + <h4>Resizing Chart Demo:</h4> + <p>In this demo we have a chart that resizes according to the resizing + of its container.</p> + </div> + <div class="body row scroll-x scroll-y"> + <div id="bar_chart_1" class="chart_container"> + <svg id="chart_svg" width="100%" height="100%"></svg> + </div> + </div> + <div class="footer row"> + <p id="debug">This is a footer, part of the HTML not the chart.</p> + </div> + </body> +</html> Added: branches/jfreechart-1.0.x-branch/jsfreechart/LineChartDemo.html =================================================================== --- branches/jfreechart-1.0.x-branch/jsfreechart/LineChartDemo.html (rev 0) +++ branches/jfreechart-1.0.x-branch/jsfreechart/LineChartDemo.html 2014-07-31 09:56:07 UTC (rev 3277) @@ -0,0 +1,372 @@ + <!DOCTYPE html> +<html> + <head> + <title>Line Plot drawn to a 2D context</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <script type="text/javascript" src="lib/jsfreechart.js"></script> + <style> + .chart_container { height: 100%; width: 100%; } + body { margin: 0; border: 2px; padding: 5px; } + .row, .col { overflow: hidden; position: absolute; } + .row { left: 0; right: 0; } + .col { top: 0; bottom: 0; } + .scroll-x { overflow-x: none; } + .scroll-y { overflow-y: none; } + + .header.row { height: 75px; top: 0; } + .body.row { top: 75px; bottom: 50px;} + .footer.row { height: 50px; bottom: 0; } + </style> + </head> + <body onload="installChart();"> + <script type="application/javascript"> + function installChart() { + var dataset = new jsfc.StandardXYDataset(); + + var JAN = 0, FEB = 1, MAR = 2, APR = 3, MAY = 4, JUN = 5, + JUL = 6, AUG = 7, SEP = 8, OCT = 9, NOV = 10, DEC = 11; + + dataset.add("Indicator Price", new Date(2010, JAN).getTime(), 126.80); + dataset.add("Indicator Price", new Date(2010, FEB).getTime(), 123.37); + dataset.add("Indicator Price", new Date(2010, MAR).getTime(), 125.30); + dataset.add("Indicator Price", new Date(2010, APR).getTime(), 126.89); + dataset.add("Indicator Price", new Date(2010, MAY).getTime(), 128.10); + dataset.add("Indicator Price", new Date(2010, JUN).getTime(), 142.20); + dataset.add("Indicator Price", new Date(2010, JUL).getTime(), 153.41); + dataset.add("Indicator Price", new Date(2010, AUG).getTime(), 157.46); + dataset.add("Indicator Price", new Date(2010, SEP).getTime(), 163.61); + dataset.add("Indicator Price", new Date(2010, OCT).getTime(), 161.56); + dataset.add("Indicator Price", new Date(2010, NOV).getTime(), 173.90); + dataset.add("Indicator Price", new Date(2010, DEC).getTime(), 184.26); + dataset.add("Indicator Price", new Date(2011, JAN).getTime(), 197.35); + dataset.add("Indicator Price", new Date(2011, FEB).getTime(), 216.03); + dataset.add("Indicator Price", new Date(2011, MAR).getTime(), 224.33); + dataset.add("Indicator Price", new Date(2011, APR).getTime(), 231.24); + dataset.add("Indicator Price", new Date(2011, MAY).getTime(), 227.97); + dataset.add("Indicator Price", new Date(2011, JUN).getTime(), 215.58); + dataset.add("Indicator Price", new Date(2011, JUL).getTime(), 210.36); + dataset.add("Indicator Price", new Date(2011, AUG).getTime(), 212.19); + dataset.add("Indicator Price", new Date(2011, SEP).getTime(), 213.04); + dataset.add("Indicator Price", new Date(2011, OCT).getTime(), 193.90); + dataset.add("Indicator Price", new Date(2011, NOV).getTime(), 193.66); + dataset.add("Indicator Price", new Date(2011, DEC).getTime(), 189.02); + dataset.add("Indicator Price", new Date(2012, JAN).getTime(), 188.90); + dataset.add("Indicator Price", new Date(2012, FEB).getTime(), 182.29); + dataset.add("Indicator Price", new Date(2012, MAR).getTime(), 167.77); + dataset.add("Indicator Price", new Date(2012, APR).getTime(), 160.46); + dataset.add("Indicator Price", new Date(2012, MAY).getTime(), 157.68); + dataset.add("Indicator Price", new Date(2012, JUN).getTime(), 145.31); + dataset.add("Indicator Price", new Date(2012, JUL).getTime(), 159.07); + dataset.add("Indicator Price", new Date(2012, AUG).getTime(), 148.50); + dataset.add("Indicator Price", new Date(2012, SEP).getTime(), 151.28); + dataset.add("Indicator Price", new Date(2012, OCT).getTime(), 147.12); + dataset.add("Indicator Price", new Date(2012, NOV).getTime(), 136.35); + dataset.add("Indicator Price", new Date(2012, DEC).getTime(), 131.31); + dataset.add("Indicator Price", new Date(2013, JAN).getTime(), 135.38); + dataset.add("Indicator Price", new Date(2013, FEB).getTime(), 131.51); + dataset.add("Indicator Price", new Date(2013, MAR).getTime(), 131.38); + + dataset.add("Columbian Milds", new Date(2010, JAN).getTime(), 207.51); + dataset.add("Columbian Milds", new Date(2010, FEB).getTime(), 204.71); + dataset.add("Columbian Milds", new Date(2010, MAR).getTime(), 205.71); + dataset.add("Columbian Milds", new Date(2010, APR).getTime(), 200.00); + dataset.add("Columbian Milds", new Date(2010, MAY).getTime(), 200.54); + dataset.add("Columbian Milds", new Date(2010, JUN).getTime(), 224.49); + dataset.add("Columbian Milds", new Date(2010, JUL).getTime(), 235.52); + dataset.add("Columbian Milds", new Date(2010, AUG).getTime(), 243.98); + dataset.add("Columbian Milds", new Date(2010, SEP).getTime(), 247.77); + dataset.add("Columbian Milds", new Date(2010, OCT).getTime(), 230.02); + dataset.add("Columbian Milds", new Date(2010, NOV).getTime(), 244.02); + dataset.add("Columbian Milds", new Date(2010, DEC).getTime(), 261.97); + dataset.add("Columbian Milds", new Date(2011, JAN).getTime(), 279.88); + dataset.add("Columbian Milds", new Date(2011, FEB).getTime(), 296.44); + dataset.add("Columbian Milds", new Date(2011, MAR).getTime(), 300.68); + dataset.add("Columbian Milds", new Date(2011, APR).getTime(), 312.95); + dataset.add("Columbian Milds", new Date(2011, MAY).getTime(), 302.17); + dataset.add("Columbian Milds", new Date(2011, JUN).getTime(), 287.95); + dataset.add("Columbian Milds", new Date(2011, JUL).getTime(), 285.21); + dataset.add("Columbian Milds", new Date(2011, AUG).getTime(), 286.97); + dataset.add("Columbian Milds", new Date(2011, SEP).getTime(), 287.54); + dataset.add("Columbian Milds", new Date(2011, OCT).getTime(), 257.66); + dataset.add("Columbian Milds", new Date(2011, NOV).getTime(), 256.99); + dataset.add("Columbian Milds", new Date(2011, DEC).getTime(), 251.60); + dataset.add("Columbian Milds", new Date(2012, JAN).getTime(), 255.91); + dataset.add("Columbian Milds", new Date(2012, FEB).getTime(), 244.14); + dataset.add("Columbian Milds", new Date(2012, MAR).getTime(), 222.84); + dataset.add("Columbian Milds", new Date(2012, APR).getTime(), 214.46); + dataset.add("Columbian Milds", new Date(2012, MAY).getTime(), 207.32); + dataset.add("Columbian Milds", new Date(2012, JUN).getTime(), 184.67); + dataset.add("Columbian Milds", new Date(2012, JUL).getTime(), 202.56); + dataset.add("Columbian Milds", new Date(2012, AUG).getTime(), 187.14); + dataset.add("Columbian Milds", new Date(2012, SEP).getTime(), 190.10); + dataset.add("Columbian Milds", new Date(2012, OCT).getTime(), 181.39); + dataset.add("Columbian Milds", new Date(2012, NOV).getTime(), 170.08); + dataset.add("Columbian Milds", new Date(2012, DEC).getTime(), 164.40); + dataset.add("Columbian Milds", new Date(2013, JAN).getTime(), 169.19); + dataset.add("Columbian Milds", new Date(2013, FEB).getTime(), 161.70); + dataset.add("Columbian Milds", new Date(2013, MAR).getTime(), 161.53); + + dataset.add("Other Milds", new Date(2010, JAN).getTime(), 158.90); + dataset.add("Other Milds", new Date(2010, FEB).getTime(), 157.86); + dataset.add("Other Milds", new Date(2010, MAR).getTime(), 164.50); + dataset.add("Other Milds", new Date(2010, APR).getTime(), 169.55); + dataset.add("Other Milds", new Date(2010, MAY).getTime(), 173.38); + dataset.add("Other Milds", new Date(2010, JUN).getTime(), 190.90); + dataset.add("Other Milds", new Date(2010, JUL).getTime(), 203.21); + dataset.add("Other Milds", new Date(2010, AUG).getTime(), 211.59); + dataset.add("Other Milds", new Date(2010, SEP).getTime(), 222.71); + dataset.add("Other Milds", new Date(2010, OCT).getTime(), 217.64); + dataset.add("Other Milds", new Date(2010, NOV).getTime(), 233.48); + dataset.add("Other Milds", new Date(2010, DEC).getTime(), 248.17); + dataset.add("Other Milds", new Date(2011, JAN).getTime(), 263.77); + dataset.add("Other Milds", new Date(2011, FEB).getTime(), 287.89); + dataset.add("Other Milds", new Date(2011, MAR).getTime(), 292.07); + dataset.add("Other Milds", new Date(2011, APR).getTime(), 300.12); + dataset.add("Other Milds", new Date(2011, MAY).getTime(), 291.09); + dataset.add("Other Milds", new Date(2011, JUN).getTime(), 274.98); + dataset.add("Other Milds", new Date(2011, JUL).getTime(), 268.02); + dataset.add("Other Milds", new Date(2011, AUG).getTime(), 270.44); + dataset.add("Other Milds", new Date(2011, SEP).getTime(), 274.88); + dataset.add("Other Milds", new Date(2011, OCT).getTime(), 247.82); + dataset.add("Other Milds", new Date(2011, NOV).getTime(), 245.09); + dataset.add("Other Milds", new Date(2011, DEC).getTime(), 236.71); + dataset.add("Other Milds", new Date(2012, JAN).getTime(), 237.21); + dataset.add("Other Milds", new Date(2012, FEB).getTime(), 224.16); + dataset.add("Other Milds", new Date(2012, MAR).getTime(), 201.26); + dataset.add("Other Milds", new Date(2012, APR).getTime(), 191.45); + dataset.add("Other Milds", new Date(2012, MAY).getTime(), 184.65); + dataset.add("Other Milds", new Date(2012, JUN).getTime(), 168.69); + dataset.add("Other Milds", new Date(2012, JUL).getTime(), 190.45); + dataset.add("Other Milds", new Date(2012, AUG).getTime(), 174.82); + dataset.add("Other Milds", new Date(2012, SEP).getTime(), 178.98); + dataset.add("Other Milds", new Date(2012, OCT).getTime(), 173.32); + dataset.add("Other Milds", new Date(2012, NOV).getTime(), 159.91); + dataset.add("Other Milds", new Date(2012, DEC).getTime(), 152.74); + dataset.add("Other Milds", new Date(2013, JAN).getTime(), 157.29); + dataset.add("Other Milds", new Date(2013, FEB).getTime(), 149.46); + dataset.add("Other Milds", new Date(2013, MAR).getTime(), 149.78); + + dataset.add("Brazilian Naturals", new Date(2010, JAN).getTime(), 131.67); + dataset.add("Brazilian Naturals", new Date(2010, FEB).getTime(), 124.57); + dataset.add("Brazilian Naturals", new Date(2010, MAR).getTime(), 126.21); + dataset.add("Brazilian Naturals", new Date(2010, APR).getTime(), 126.07); + dataset.add("Brazilian Naturals", new Date(2010, MAY).getTime(), 127.45); + dataset.add("Brazilian Naturals", new Date(2010, JUN).getTime(), 143.20); + dataset.add("Brazilian Naturals", new Date(2010, JUL).getTime(), 156.87); + dataset.add("Brazilian Naturals", new Date(2010, AUG).getTime(), 163.21); + dataset.add("Brazilian Naturals", new Date(2010, SEP).getTime(), 175.15); + dataset.add("Brazilian Naturals", new Date(2010, OCT).getTime(), 175.38); + dataset.add("Brazilian Naturals", new Date(2010, NOV).getTime(), 190.62); + dataset.add("Brazilian Naturals", new Date(2010, DEC).getTime(), 204.25); + dataset.add("Brazilian Naturals", new Date(2011, JAN).getTime(), 219.77); + dataset.add("Brazilian Naturals", new Date(2011, FEB).getTime(), 247.00); + dataset.add("Brazilian Naturals", new Date(2011, MAR).getTime(), 260.98); + dataset.add("Brazilian Naturals", new Date(2011, APR).getTime(), 273.40); + dataset.add("Brazilian Naturals", new Date(2011, MAY).getTime(), 268.66); + dataset.add("Brazilian Naturals", new Date(2011, JUN).getTime(), 250.59); + dataset.add("Brazilian Naturals", new Date(2011, JUL).getTime(), 245.69); + dataset.add("Brazilian Naturals", new Date(2011, AUG).getTime(), 249.83); + dataset.add("Brazilian Naturals", new Date(2011, SEP).getTime(), 255.64); + dataset.add("Brazilian Naturals", new Date(2011, OCT).getTime(), 234.28); + dataset.add("Brazilian Naturals", new Date(2011, NOV).getTime(), 236.75); + dataset.add("Brazilian Naturals", new Date(2011, DEC).getTime(), 228.79); + dataset.add("Brazilian Naturals", new Date(2012, JAN).getTime(), 228.21); + dataset.add("Brazilian Naturals", new Date(2012, FEB).getTime(), 215.40); + dataset.add("Brazilian Naturals", new Date(2012, MAR).getTime(), 192.03); + dataset.add("Brazilian Naturals", new Date(2012, APR).getTime(), 180.90); + dataset.add("Brazilian Naturals", new Date(2012, MAY).getTime(), 174.17); + dataset.add("Brazilian Naturals", new Date(2012, JUN).getTime(), 156.17); + dataset.add("Brazilian Naturals", new Date(2012, JUL).getTime(), 175.98); + dataset.add("Brazilian Naturals", new Date(2012, AUG).getTime(), 160.05); + dataset.add("Brazilian Naturals", new Date(2012, SEP).getTime(), 166.53); + dataset.add("Brazilian Naturals", new Date(2012, OCT).getTime(), 161.20); + dataset.add("Brazilian Naturals", new Date(2012, NOV).getTime(), 148.25); + dataset.add("Brazilian Naturals", new Date(2012, DEC).getTime(), 140.69); + dataset.add("Brazilian Naturals", new Date(2013, JAN).getTime(), 145.17); + dataset.add("Brazilian Naturals", new Date(2013, FEB).getTime(), 136.63); + dataset.add("Brazilian Naturals", new Date(2013, MAR).getTime(), 133.61); + + dataset.add("Robustas", new Date(2010, JAN).getTime(), 69.92); + dataset.add("Robustas", new Date(2010, FEB).getTime(), 67.88); + dataset.add("Robustas", new Date(2010, MAR).getTime(), 67.25); + dataset.add("Robustas", new Date(2010, APR).getTime(), 71.59); + dataset.add("Robustas", new Date(2010, MAY).getTime(), 70.70); + dataset.add("Robustas", new Date(2010, JUN).getTime(), 76.92); + dataset.add("Robustas", new Date(2010, JUL).getTime(), 85.27); + dataset.add("Robustas", new Date(2010, AUG).getTime(), 82.68); + dataset.add("Robustas", new Date(2010, SEP).getTime(), 81.28); + dataset.add("Robustas", new Date(2010, OCT).getTime(), 85.27); + dataset.add("Robustas", new Date(2010, NOV).getTime(), 92.04); + dataset.add("Robustas", new Date(2010, DEC).getTime(), 94.09); + dataset.add("Robustas", new Date(2011, JAN).getTime(), 101.09); + dataset.add("Robustas", new Date(2011, FEB).getTime(), 109.35); + dataset.add("Robustas", new Date(2011, MAR).getTime(), 118.13); + dataset.add("Robustas", new Date(2011, APR).getTime(), 117.37); + dataset.add("Robustas", new Date(2011, MAY).getTime(), 121.98); + dataset.add("Robustas", new Date(2011, JUN).getTime(), 117.95); + dataset.add("Robustas", new Date(2011, JUL).getTime(), 112.73); + dataset.add("Robustas", new Date(2011, AUG).getTime(), 112.07); + dataset.add("Robustas", new Date(2011, SEP).getTime(), 106.06); + dataset.add("Robustas", new Date(2011, OCT).getTime(), 98.10); + dataset.add("Robustas", new Date(2011, NOV).getTime(), 97.24); + dataset.add("Robustas", new Date(2011, DEC).getTime(), 98.41); + dataset.add("Robustas", new Date(2012, JAN).getTime(), 96.72); + dataset.add("Robustas", new Date(2012, FEB).getTime(), 101.93); + dataset.add("Robustas", new Date(2012, MAR).getTime(), 103.57); + dataset.add("Robustas", new Date(2012, APR).getTime(), 101.80); + dataset.add("Robustas", new Date(2012, MAY).getTime(), 106.88); + dataset.add("Robustas", new Date(2012, JUN).getTime(), 105.70); + dataset.add("Robustas", new Date(2012, JUL).getTime(), 107.06); + dataset.add("Robustas", new Date(2012, AUG).getTime(), 106.52); + dataset.add("Robustas", new Date(2012, SEP).getTime(), 104.95); + dataset.add("Robustas", new Date(2012, OCT).getTime(), 104.47); + dataset.add("Robustas", new Date(2012, NOV).getTime(), 97.67); + dataset.add("Robustas", new Date(2012, DEC).getTime(), 96.59); + dataset.add("Robustas", new Date(2013, JAN).getTime(), 99.69); + dataset.add("Robustas", new Date(2013, FEB).getTime(), 104.03); + dataset.add("Robustas", new Date(2013, MAR).getTime(), 106.26); + + dataset.add("Futures (London)", new Date(2010, JAN).getTime(), 62.66); + dataset.add("Futures (London)", new Date(2010, FEB).getTime(), 60.37); + dataset.add("Futures (London)", new Date(2010, MAR).getTime(), 58.64); + dataset.add("Futures (London)", new Date(2010, APR).getTime(), 62.21); + dataset.add("Futures (London)", new Date(2010, MAY).getTime(), 62.46); + dataset.add("Futures (London)", new Date(2010, JUN).getTime(), 69.72); + dataset.add("Futures (London)", new Date(2010, JUL).getTime(), 78.17); + dataset.add("Futures (London)", new Date(2010, AUG).getTime(), 78.42); + dataset.add("Futures (London)", new Date(2010, SEP).getTime(), 75.87); + dataset.add("Futures (London)", new Date(2010, OCT).getTime(), 80.08); + dataset.add("Futures (London)", new Date(2010, NOV).getTime(), 86.40); + dataset.add("Futures (London)", new Date(2010, DEC).getTime(), 88.70); + dataset.add("Futures (London)", new Date(2011, JAN).getTime(), 96.02); + dataset.add("Futures (London)", new Date(2011, FEB).getTime(), 104.53); + dataset.add("Futures (London)", new Date(2011, MAR).getTime(), 111.36); + dataset.add("Futures (London)", new Date(2011, APR).getTime(), 111.34); + dataset.add("Futures (London)", new Date(2011, MAY).getTime(), 116.76); + dataset.add("Futures (London)", new Date(2011, JUN).getTime(), 110.51); + dataset.add("Futures (London)", new Date(2011, JUL).getTime(), 103.36); + dataset.add("Futures (London)", new Date(2011, AUG).getTime(), 102.71); + dataset.add("Futures (London)", new Date(2011, SEP).getTime(), 96.10); + dataset.add("Futures (London)", new Date(2011, OCT).getTime(), 88.64); + dataset.add("Futures (London)", new Date(2011, NOV).getTime(), 85.78); + dataset.add("Futures (London)", new Date(2011, DEC).getTime(), 87.65); + dataset.add("Futures (London)", new Date(2012, JAN).getTime(), 84.19); + dataset.add("Futures (London)", new Date(2012, FEB).getTime(), 88.69); + dataset.add("Futures (London)", new Date(2012, MAR).getTime(), 91.37); + dataset.add("Futures (London)", new Date(2012, APR).getTime(), 91.81); + dataset.add("Futures (London)", new Date(2012, MAY).getTime(), 96.82); + dataset.add("Futures (London)", new Date(2012, JUN).getTime(), 94.75); + dataset.add("Futures (London)", new Date(2012, JUL).getTime(), 96.14); + dataset.add("Futures (London)", new Date(2012, AUG).getTime(), 96.12); + dataset.add("Futures (London)", new Date(2012, SEP).getTime(), 94.65); + dataset.add("Futures (London)", new Date(2012, OCT).getTime(), 94.66); + dataset.add("Futures (London)", new Date(2012, NOV).getTime(), 87.32); + dataset.add("Futures (London)", new Date(2012, DEC).getTime(), 85.94); + dataset.add("Futures (London)", new Date(2013, JAN).getTime(), 88.85); + dataset.add("Futures (London)", new Date(2013, FEB).getTime(), 94.41); + dataset.add("Futures (London)", new Date(2013, MAR).getTime(), 97.22); + + dataset.add("Futures (New York)", new Date(2010, JAN).getTime(), 142.76); + dataset.add("Futures (New York)", new Date(2010, FEB).getTime(), 134.35); + dataset.add("Futures (New York)", new Date(2010, MAR).getTime(), 134.97); + dataset.add("Futures (New York)", new Date(2010, APR).getTime(), 135.12); + dataset.add("Futures (New York)", new Date(2010, MAY).getTime(), 135.81); + dataset.add("Futures (New York)", new Date(2010, JUN).getTime(), 152.36); + dataset.add("Futures (New York)", new Date(2010, JUL).getTime(), 165.23); + dataset.add("Futures (New York)", new Date(2010, AUG).getTime(), 175.10); + dataset.add("Futures (New York)", new Date(2010, SEP).getTime(), 187.80); + dataset.add("Futures (New York)", new Date(2010, OCT).getTime(), 190.43); + dataset.add("Futures (New York)", new Date(2010, NOV).getTime(), 206.92); + dataset.add("Futures (New York)", new Date(2010, DEC).getTime(), 221.51); + dataset.add("Futures (New York)", new Date(2011, JAN).getTime(), 238.05); + dataset.add("Futures (New York)", new Date(2011, FEB).getTime(), 261.41); + dataset.add("Futures (New York)", new Date(2011, MAR).getTime(), 274.10); + dataset.add("Futures (New York)", new Date(2011, APR).getTime(), 285.58); + dataset.add("Futures (New York)", new Date(2011, MAY).getTime(), 277.72); + dataset.add("Futures (New York)", new Date(2011, JUN).getTime(), 262.52); + dataset.add("Futures (New York)", new Date(2011, JUL).getTime(), 255.90); + dataset.add("Futures (New York)", new Date(2011, AUG).getTime(), 260.39); + dataset.add("Futures (New York)", new Date(2011, SEP).getTime(), 261.39); + dataset.add("Futures (New York)", new Date(2011, OCT).getTime(), 236.74); + dataset.add("Futures (New York)", new Date(2011, NOV).getTime(), 235.25); + dataset.add("Futures (New York)", new Date(2011, DEC).getTime(), 227.23); + dataset.add("Futures (New York)", new Date(2012, JAN).getTime(), 227.50); + dataset.add("Futures (New York)", new Date(2012, FEB).getTime(), 212.09); + dataset.add("Futures (New York)", new Date(2012, MAR).getTime(), 188.78); + dataset.add("Futures (New York)", new Date(2012, APR).getTime(), 181.75); + dataset.add("Futures (New York)", new Date(2012, MAY).getTime(), 176.50); + dataset.add("Futures (New York)", new Date(2012, JUN).getTime(), 159.93); + dataset.add("Futures (New York)", new Date(2012, JUL).getTime(), 183.20); + dataset.add("Futures (New York)", new Date(2012, AUG).getTime(), 169.77); + dataset.add("Futures (New York)", new Date(2012, SEP).getTime(), 175.36); + dataset.add("Futures (New York)", new Date(2012, OCT).getTime(), 170.43); + dataset.add("Futures (New York)", new Date(2012, NOV).getTime(), 155.72); + dataset.add("Futures (New York)", new Date(2012, DEC).getTime(), 149.58); + dataset.add("Futures (New York)", new Date(2013, JAN).getTime(), 154.28); + dataset.add("Futures (New York)", new Date(2013, FEB).getTime(), 144.89); + dataset.add("Futures (New York)", new Date(2013, MAR).getTime(), 141.43); + + var plot = new jsfc.XYPlot(dataset); + var xAxis = plot.getXAxis(); + var yAxis = plot.getYAxis(); + //plot.xAxis.label = "x-axis"; + xAxis.labelFont = new jsfc.Font("sans-serif", 12, true); + xAxis.tickLabelFont = new jsfc.Font("sans-serif", 10); + xAxis.setTickLabelFormatOverride(new jsfc.DateFormat("mmm-yyyy")); + yAxis.setLabel("US cents/lb"); + yAxis.labelFont = new jsfc.Font("sans-serif", 12, true); + yAxis.tickLabelFont = new jsfc.Font("sans-serif", 10); + + var renderer = new jsfc.XYLineRenderer(plot); + var colors = [new jsfc.Color(255, 0, 0)]; + colors.push(new jsfc.Color(24, 123, 58)); + colors.push(new jsfc.Color(149, 201, 136)); + colors.push(new jsfc.Color(1, 62, 29)); + colors.push(new jsfc.Color(81, 176, 86)); + colors.push(new jsfc.Color(0, 55, 122)); + colors.push(new jsfc.Color(0, 92, 165)); + renderer.setLineColorSource(new jsfc.ColorSource(colors)); + plot.setRenderer(renderer); + plot.setAxisOffsets(new jsfc.Insets(4, 4, 4, 4)); + var chart = new jsfc.Chart(plot); + var titleAnchor = new jsfc.Anchor2D(jsfc.RefPt2D.TOP_LEFT); + chart.setTitleAnchor(titleAnchor); + chart.setTitle("International Coffee Organisation: Coffee Prices", + "Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf", + titleAnchor); + //var canvas = document.getElementById("chart_canvas"); + chart.setSize(600, 400); + var svg = document.getElementById("chart_svg"); + chartManager = new jsfc.ChartManager(svg, chart); + chartManager.refreshDisplay(); + //var ctx = canvas.getContext('2d'); + var win = document.defaultView || document.parentWindow; + win.onresize = resize; + + }; + function resize(evt) { + var element = document.getElementById("scatter_chart_1"); + var w = Math.max(300, element.clientWidth); + var h = Math.max(200, element.clientHeight); + chartManager.getChart().setSize(w, h); + chartManager.refreshDisplay(); + } + + + </script> + <div class="header row"> + <h4>Resizing Chart Demo:</h4> + <p>In this demo we have a chart that resizes according to the resizing + of its container.</p> + </div> + <div class="body row scroll-x scroll-y"> + <div id="scatter_chart_1" class="chart_container"> + <svg id="chart_svg" width="100%" height="100%"></svg> + </div> + </div> + <div class="footer row"> + <p id="debug">This is a footer, part of the HTML not the chart.</p> + </div> + </body> +</html> Added: branches/jfreechart-1.0.x-branch/jsfreechart/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/jsfreechart/README.txt (rev 0) +++ branches/jfreechart-1.0.x-branch/jsfreechart/README.txt 2014-07-31 09:56:07 UTC (rev 3277) @@ -0,0 +1,25 @@ +JSFreeChart +----------- + +This folder contains a preview of JSFreeChart, a free 2D chart library written +in JavaScript. To see how it works, simply open one of the HTML files in a +browser. JSFreeChart features: + + - multiple chart types supported out-of-the-box: bar charts (regular and + stacked), scatter plots, line charts and histograms; + - clean separation between data sources and the presentation layer with + dataset interfaces (with standard implementations provided); + - interactivity with built-in panning, zooming and selection; + - a flexible architecture; + - complete source code freely available; + +For the latest information about JSFreeChart, please refer to the home page at: + + http://www.jfree.org/jsfreechart + +JSFreeChart has been developed by Object Refinery Ltd +(http://www.object-refinery.com) in collaboration with KNIME.com AG +(https://www.knime.org/). + +David Gilbert +Object Refinery Limited Added: branches/jfreechart-1.0.x-branch/jsfreechart/ScatterChartDemo.html =================================================================== --- branches/jfreechart-1.0.x-branch/jsfreechart/ScatterChartDemo.html (rev 0) +++ branches/jfreechart-1.0.x-branch/jsfreechart/ScatterChartDemo.html 2014-07-31 09:56:07 UTC (rev 3277) @@ -0,0 +1,87 @@ +<!DOCTYPE html> +<html> + <head> + <title>Scatter Plot drawn to a 2D context</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <script src="lib/jsfreechart.js"></script> + </head> + <body onload="installChart();"> + <script type="application/javascript"> + function updateShow() { + var checkBox = document.getElementById("showcb"); + if (checkBox.checked) { + var snapCheckBox = document.getElementById("snapcb"); + document.crosshairHandler = new jsfc.XYCrosshairHandler(document.chartManager); + document.crosshairHandler.setSnapToItem(snapCheckBox.checked); + document.chartManager.addAuxiliaryHandler(document.crosshairHandler); + } else { + document.chartManager.removeAuxiliaryHandler(document.crosshairHandler); + document.crosshairHandler = null; + } + } + function updateSnap() { + var checkBox = document.getElementById("snapcb"); + if (document.crosshairHandler) { + document.crosshairHandler.setSnapToItem(checkBox.checked); + } + } + function installChart() { + var dataset = new jsfc.StandardXYDataset(); + var factor = 1; + for (var i = 0; i < 20; i++) { + dataset.add("Series 1", Math.random() * factor, Math.random() * factor); + dataset.add("Series 2", Math.random() * factor, Math.random() *factor); + dataset.add("Series 3", Math.random() * factor, Math.random() *factor); + dataset.add("Series 4", Math.random() * factor, Math.random() *factor); + dataset.add("Series 5", Math.random() * factor, Math.random() *factor); + dataset.add("Series 6", Math.random() * factor, Math.random() *factor); + dataset.add("Series 7", Math.random() * factor, Math.random() *factor); + dataset.add("Series 8", Math.random() * factor, Math.random() *factor); + dataset.add("Series 9", Math.random() * factor, Math.random() *factor); + dataset.add("Series 10", Math.random() * factor, Math.random() *factor); + } + var itemKey = dataset.getItemKey(0, 1); + dataset.setItemProperty("Series 1", itemKey, "color", "#FF0000"); + + var plot = new jsfc.XYPlot(dataset); + plot.setAxisOffsets(new jsfc.Insets(4, 4, 4, 4)); + var xAxis = plot.getXAxis(); + var yAxis = plot.getYAxis(); + xAxis.setLabel("x-axis"); + xAxis.labelFont = new jsfc.Font("sans-serif", 12, true); + xAxis.tickLabelFont = new jsfc.Font("sans-serif", 10); + yAxis.setLabel("y-axis"); + yAxis.labelFont = new jsfc.Font("sans-serif", 12, true); + yAxis.tickLabelFont = new jsfc.Font("sans-serif", 10); + + plot.renderer = new jsfc.ScatterRenderer(plot); + var chart = new jsfc.Chart(plot); + var titleAnchor = new jsfc.Anchor2D(jsfc.RefPt2D.TOP_LEFT); + chart.setTitleAnchor(titleAnchor); + chart.setTitle("Scatter Chart in SVG", "http://www.jfree.org/", + titleAnchor); + chart.setSize(600, 400); + var svg = document.getElementById("chart_svg"); + var manager = new jsfc.ChartManager(svg, chart); + document.chartManager = manager; + + // add a mouse handler to draw crosshairs + //var crosshairHandler = new jsfc.CrosshairHandler(manager); + //document.chartManager.addAuxiliaryHandler(crosshairHandler); + var modifiers = new jsfc.Modifier(false, false, true, false); + var selectHandler = new jsfc.PolygonSelectionHandler(manager, modifiers); + manager.addLiveHandler(selectHandler); + document.chartManager.refreshDisplay(); + }; + + </script> + <h4>Scatter Chart with Crosshairs:</h4> + <p>In this demo we have a scatter chart with crosshairs. Click and drag the mouse pointer to select a region to zoom. Hold the ALT-key and drag the mouse pointer to pan. Hold the META key and drag the mouse pointer to define a selection region.</p> + <input id="showcb" type="checkbox" onchange="updateShow()" />Show crosshairs? + <input id="snapcb" type="checkbox" onchange="updateSnap()" />Snap to data points? + <div id="scatter_chart_1" class="chart_container"> + <svg id="chart_svg" width="600px" height="400px"></svg> + </div> + </body> +</html> Added: branches/jfreechart-1.0.x-branch/jsfreechart/lib/gpl-3.0.txt =================================================================== --- branches/jfreechart-1.0.x-branch/jsfreechart/lib/gpl-3.0.txt (rev 0) +++ branches/jfreechart-1.0.x-branch/jsfreechart/lib/gpl-3.0.txt 2014-07-31 09:56:07 UTC (rev 3277) @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not s... [truncated message content] |
From: <mu...@us...> - 2014-08-04 21:38:21
|
Revision: 3295 http://sourceforge.net/p/jfreechart/code/3295 Author: mungady Date: 2014-08-04 21:38:11 +0000 (Mon, 04 Aug 2014) Log Message: ----------- Add JavaScript support files for enhanced SVG export (work in progress). Added Paths: ----------- branches/jfreechart-1.0.x-branch/svg/ branches/jfreechart-1.0.x-branch/svg/EQTBarChartDemo1.html branches/jfreechart-1.0.x-branch/svg/js/ branches/jfreechart-1.0.x-branch/svg/js/README.txt branches/jfreechart-1.0.x-branch/svg/js/build.sh branches/jfreechart-1.0.x-branch/svg/js/jfreechart_utils.js branches/jfreechart-1.0.x-branch/svg/js/src/ branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValueLabels.js branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValuesDataset.js branches/jfreechart-1.0.x-branch/svg/js/src/Utils.js branches/jfreechart-1.0.x-branch/svg/lib/ branches/jfreechart-1.0.x-branch/svg/lib/jfreechart_utils.js Added: branches/jfreechart-1.0.x-branch/svg/EQTBarChartDemo1.html =================================================================== --- branches/jfreechart-1.0.x-branch/svg/EQTBarChartDemo1.html (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/EQTBarChartDemo1.html 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html> +<head> +<title>EQTBarChartDemo1</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<script src="lib/opentip-native.js"></script><link href="css/opentip.css" rel="stylesheet" type="text/css" /><script src="lib/jfreechart_utils.js"></script></head> +<body> +<h1>EQTBarChartDemo1</h1> +<p>Click on an item in the chart or just hover and look at the tooltip (the reference is a string in JSON format that should contain enough information to identify the chart element):</p> + <script type="application/javascript"> + function barChartData() { + return {"columnKeys": ["Warm-up", "Test"], "rows": [["JFreeSVG", [7445.0, 4297.0]], ["Batik", [24448.0, 21022.0]]]} + } + </script> + <script type="application/javascript"> + // wait until all the resources are loaded + window.addEventListener("load", initialise, false); + function initialise() { + var barSVG = document.getElementById("chart1"); + barSVG.onclick = handleClick; + } + function handleClick(evt) { + var element = evt.target; + var ref = jfc.Utils.findChartRef(element); + var chartId = jfc.Utils.findChartId(element); + alert('You clicked on the item ' + ref + ' for the chart [' + chartId + ']'); + } +</script> +<p> +<svg id="chart1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:jfreesvg="http://www.jfree.org/jfreesvg/svg" width="600" height="370" text-rendering="auto" shape-rendering="auto"> +<defs><linearGradient id="defs2_gp0" x1="107.3" y1="0" x2="114" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,85,85);"/><stop offset="100%" style="stop-color: rgb(255,255,255);"/></linearGradient> +<linearGradient id="defs2_gp13" x1="506" y1="0" x2="512" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,255,255);"/><stop offset="100%" style="stop-color: rgb(85,85,255);"/></linearGradient> +<linearGradient id="defs2_gp14" x1="512" y1="0" x2="550" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(85,85,255);"/><stop offset="100%" style="stop-color: rgb(121,121,255);"/></linearGradient> +<linearGradient id="defs2_gp8" x1="385.6" y1="0" x2="392" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,85,85);"/><stop offset="100%" style="stop-color: rgb(255,255,255);"/></linearGradient> +<linearGradient id="defs2_gp6" x1="234" y1="0" x2="272" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(85,85,255);"/><stop offset="100%" style="stop-color: rgb(121,121,255);"/></linearGradient> +<linearGradient id="defs2_gp10" x1="398" y1="0" x2="436" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,85,85);"/><stop offset="100%" style="stop-color: rgb(255,121,121);"/></linearGradient> +<linearGradient id="defs2_gp2" x1="120" y1="0" x2="158" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,85,85);"/><stop offset="100%" style="stop-color: rgb(255,121,121);"/></linearGradient> +<linearGradient id="defs2_gp9" x1="392" y1="0" x2="398" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,255,255);"/><stop offset="100%" style="stop-color: rgb(255,85,85);"/></linearGradient> +<linearGradient id="defs2_gp7" x1="272" y1="0" x2="284.4" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(121,121,255);"/><stop offset="100%" style="stop-color: rgb(85,85,255);"/></linearGradient> +<linearGradient id="defs2_gp11" x1="436" y1="0" x2="448.85" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,121,121);"/><stop offset="100%" style="stop-color: rgb(255,85,85);"/></linearGradient> +<linearGradient id="defs2_gp3" x1="158" y1="0" x2="170.55" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,121,121);"/><stop offset="100%" style="stop-color: rgb(255,85,85);"/></linearGradient> +<linearGradient id="defs2_gp15" x1="550" y1="0" x2="562.7" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(121,121,255);"/><stop offset="100%" style="stop-color: rgb(85,85,255);"/></linearGradient> +<linearGradient id="defs2_gp12" x1="499.45" y1="0" x2="506" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(85,85,255);"/><stop offset="100%" style="stop-color: rgb(255,255,255);"/></linearGradient> +<linearGradient id="defs2_gp1" x1="114" y1="0" x2="120" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,255,255);"/><stop offset="100%" style="stop-color: rgb(255,85,85);"/></linearGradient> +<linearGradient id="defs2_gp4" x1="221.15" y1="0" x2="227" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(85,85,255);"/><stop offset="100%" style="stop-color: rgb(255,255,255);"/></linearGradient> +<linearGradient id="defs2_gp5" x1="227" y1="0" x2="234" y2="0" gradientUnits="userSpaceOnUse"><stop offset="0%" style="stop-color: rgb(255,255,255);"/><stop offset="100%" style="stop-color: rgb(85,85,255);"/></linearGradient> +<clipPath id="defs2_clip-0"><path d="M 0 0 L 600 0 L 600 370 L 0 370 L 0 0 M 0 0"/></clipPath> +<clipPath id="defs2_clip-1"><path d="M 203.55 164.45 L 203.55 764.45 L -166.45 764.45 L -166.45 164.45 L 203.55 164.45 M 203.55 164.45"/></clipPath> +<clipPath id="defs2_clip-2"><path d="M 82 51 L 82 317 L 588 317 L 588 51 M 82 51"/></clipPath> +</defs> +<g id="chart1" jfreesvg:ref="JFREECHART_TOP_LEVEL"><rect x="0" y="0" width="600" height="370" style="fill: rgb(255,255,255); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="137.5" y="21.01" style="fill: rgb(0,0,0); fill-opacity: 1.0; font-family: Tahoma; font-size: 20px; font-weight: bold; " clip-path="url(#defs2_clip-0)">Performance: JFreeSVG vs Batik</text></g><rect x="244.5" y="348.52" width="111" height="20.48" style="fill: rgb(255,255,255); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g style="fill: rgb(255,85,85); fill-opacity: 1.0; stroke: none" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"><path d="M 247.5 354.76 L 255.5 354.76 L 255.5 362.76 L 247.5 362.76 L 247.5 354.76 M 247.5 354.76"/></g><g transform="matrix(1,0,0,1,0,0)"><text x="259.5" y="363.52" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">JFreeSVG</text></g><g style="fill: rgb(85,85,255); fill-opacity: 1.0; stroke: none" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"><path d="M 314.5 354.76 L 322.5 354.76 L 322.5 362.76 L 314.5 362.76 L 314.5 354.76 M 314.5 354.76"/></g><g transform="matrix(1,0,0,1,0,0)"><text x="326.5" y="363.52" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">Batik</text></g><g transform="matrix(1,0,0,1,0,0)"><text x="56" y="38.74" style="fill: rgb(0,0,0); fill-opacity: 1.0; font-family: sans-serif; font-size: 12px; font-weight: bold; " clip-path="url(#defs2_clip-0)">Time to generate 1000 charts in SVG format (lower bars = better performance)</text></g><rect x="82" y="51" width="506" height="266" style="fill: rgb(192,192,192); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><line x1="82" y1="321" x2="588" y2="321" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><line x1="195.85" y1="321" x2="195.85" y2="321" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><line x1="195.85" y1="321" x2="195.85" y2="323" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><line x1="474.15" y1="321" x2="474.15" y2="321" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><line x1="474.15" y1="321" x2="474.15" y2="323" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="171.35" y="339.01" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">Warm-up</text></g><g transform="matrix(1,0,0,1,0,0)"><text x="463.15" y="339.01" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">Test</text></g><line x1="78" y1="51" x2="78" y2="317" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="65" y="321.76" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">0</text></g><line x1="76" y1="317" x2="78" y2="317" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="40" y="301.04" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">2,000</text></g><line x1="76" y1="296.28" x2="78" y2="296.28" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="40" y="280.32" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">4,000</text></g><line x1="76" y1="275.55" x2="78" y2="275.55" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="40" y="259.59" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">6,000</text></g><line x1="76" y1="254.83" x2="78" y2="254.83" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="40" y="238.87" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">8,000</text></g><line x1="76" y1="234.1" x2="78" y2="234.1" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="218.14" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">10,000</text></g><line x1="76" y1="213.38" x2="78" y2="213.38" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="197.42" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">12,000</text></g><line x1="76" y1="192.65" x2="78" y2="192.65" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="176.69" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">14,000</text></g><line x1="76" y1="171.93" x2="78" y2="171.93" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="155.97" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">16,000</text></g><line x1="76" y1="151.21" x2="78" y2="151.21" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="135.25" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">18,000</text></g><line x1="76" y1="130.48" x2="78" y2="130.48" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="114.52" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">20,000</text></g><line x1="76" y1="109.76" x2="78" y2="109.76" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="93.8" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">22,000</text></g><line x1="76" y1="89.03" x2="78" y2="89.03" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(1,0,0,1,0,0)"><text x="33" y="73.07" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 12px; " clip-path="url(#defs2_clip-0)">24,000</text></g><line x1="76" y1="68.31" x2="78" y2="68.31" style="stroke-width: 0.5;stroke: rgb(128,128,128);stroke-opacity: 1.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/><g transform="matrix(0,-1,1,0,-164.449219,203.550781)"><text x="-22.95" y="189.56" style="fill: rgb(64,64,64); fill-opacity: 1.0; font-family: Tahoma; font-size: 14px; font-weight: bold; " clip-path="url(#defs2_clip-1)">Milliseconds</text></g><line x1="82" y1="317" x2="588" y2="317" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="296.28" x2="588" y2="296.28" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="275.55" x2="588" y2="275.55" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="254.83" x2="588" y2="254.83" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="234.1" x2="588" y2="234.1" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="213.38" x2="588" y2="213.38" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="192.65" x2="588" y2="192.65" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="171.93" x2="588" y2="171.93" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="151.21" x2="588" y2="151.21" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="130.48" x2="588" y2="130.48" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="109.76" x2="588" y2="109.76" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="89.03" x2="588" y2="89.03" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><line x1="82" y1="68.31" x2="588" y2="68.31" style="stroke-width: 0.5;stroke: rgb(255,255,255);stroke-opacity: 1.0;stroke-dasharray: 2.0, 2.0;shape-rendering:crispEdges;" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><g jfreesvg:ref="{"rowKey": "JFreeSVG", "columnKey": "Warm-up"}"><rect x="107.3" y="239.85" width="6.7" height="77.15" style="fill: url(#defs2_gp0); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="114" y="239.85" width="6" height="77.15" style="fill: url(#defs2_gp1); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="120" y="239.85" width="38" height="77.15" style="fill: url(#defs2_gp2); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="158" y="239.85" width="12.55" height="77.15" style="fill: url(#defs2_gp3); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/></g> +<g jfreesvg:ref="{"rowKey": "Batik", "columnKey": "Warm-up"}"><rect x="221.15" y="63.67" width="5.85" height="253.33" style="fill: url(#defs2_gp4); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="227" y="63.67" width="7" height="253.33" style="fill: url(#defs2_gp5); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="234" y="63.67" width="38" height="253.33" style="fill: url(#defs2_gp6); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="272" y="63.67" width="12.4" height="253.33" style="fill: url(#defs2_gp7); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/></g> +<g jfreesvg:ref="{"rowKey": "JFreeSVG", "columnKey": "Test"}"><rect x="385.6" y="272.47" width="6.4" height="44.53" style="fill: url(#defs2_gp8); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="392" y="272.47" width="6" height="44.53" style="fill: url(#defs2_gp9); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="398" y="272.47" width="38" height="44.53" style="fill: url(#defs2_gp10); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="436" y="272.47" width="12.85" height="44.53" style="fill: url(#defs2_gp11); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/></g> +<g jfreesvg:ref="{"rowKey": "Batik", "columnKey": "Test"}"><rect x="499.45" y="99.17" width="6.55" height="217.83" style="fill: url(#defs2_gp12); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="506" y="99.17" width="6" height="217.83" style="fill: url(#defs2_gp13); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="512" y="99.17" width="38" height="217.83" style="fill: url(#defs2_gp14); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/><rect x="550" y="99.17" width="12.7" height="217.83" style="fill: url(#defs2_gp15); fill-opacity: 1.0" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-2)"/></g> +<rect x="82" y="51" width="506" height="266" style="stroke-width: 0.5;stroke: rgb(0,0,0);stroke-opacity: 1.0;shape-rendering:crispEdges;; fill: none" transform="matrix(1,0,0,1,0,0)" clip-path="url(#defs2_clip-0)"/></g> +</svg> +</p> +</body> +</html> Added: branches/jfreechart-1.0.x-branch/svg/js/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/README.txt (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/README.txt 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,8 @@ +JavaScript Utilities +-------------------- + +This directory contains some JavaScript utility code that can be used when exporting charts to SVG format with JFreeSVG. The build.sh script will build the library, but note that it requires the Google Closure Compiler jar file to be on the classpath (please edit the script accordingly). + +https://developers.google.com/closure/compiler/ + +Look in the '???' directory (open ???.html) to see a demo that uses this JavaScript code. Added: branches/jfreechart-1.0.x-branch/svg/js/build.sh =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/build.sh (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/build.sh 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,7 @@ +#!/bin/bash + +java -jar ~/jars/compiler.jar --warning_level VERBOSE --compilation_level WHITESPACE_ONLY \ +--js src/Utils.js \ +--js src/KeyedValuesDataset.js \ +--js src/KeyedValueLabels.js \ +--js_output_file jfreechart_utils.js \ No newline at end of file Property changes on: branches/jfreechart-1.0.x-branch/svg/js/build.sh ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: branches/jfreechart-1.0.x-branch/svg/js/jfreechart_utils.js =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/jfreechart_utils.js (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/jfreechart_utils.js 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,9 @@ +var jfc;if(!jfc)jfc={};jfc.Utils={};jfc.Utils.makeArrayOf=function(value,length){var arr=[],i=length;while(i--)arr[i]=value;return arr};jfc.Utils.findChartRef=function(element){var id=element.getAttribute("jfreesvg:ref");var found=false;var current=element;while(!found){current=current.parentNode;if(current!=null){id=current.getAttribute("jfreesvg:ref");found=id!=null}else found=true}return id}; +jfc.Utils.findChartId=function(element){var id=null;var found=false;var current=element;while(!found){current=current.parentNode;if(current!=null){var ref=current.getAttribute("jfreesvg:ref");if(ref=="JFREECHART_TOP_LEVEL"){found=true;id=current.getAttribute("id")}}else found=true}return id};if(!jfc)jfc={};orsoncharts.KeyedValuesDataset=function(){if(!(this instanceof jfc.KeyedValuesDataset))return new orsoncharts.KeyedValuesDataset;this.data=[];this.listeners=[]};orsoncharts.KeyedValuesDataset.prototype.itemCount=function(){return this.data.length};orsoncharts.KeyedValuesDataset.prototype.isEmpty=function(){return this.data.length===0};orsoncharts.KeyedValuesDataset.prototype.key=function(index){return this.data[index][0]};orsoncharts.KeyedValuesDataset.prototype.keys=function(){return this.data.map(function(d){return d[0]})}; +orsoncharts.KeyedValuesDataset.prototype.indexOf=function(sectionKey){var arrayLength=this.data.length;for(var i=0;i<arrayLength;i++)if(this.data[i][0]===sectionKey)return i;return-1};orsoncharts.KeyedValuesDataset.prototype.valueByIndex=function(index){return this.data[index][1]};orsoncharts.KeyedValuesDataset.prototype.valueByKey=function(sectionKey){var sectionIndex=this.indexOf(sectionKey);if(sectionIndex<0)return null;return this.valueByIndex(sectionIndex)}; +orsoncharts.KeyedValuesDataset.prototype.addListener=function(listenerMethod){this.listeners.push(listenerMethod)};orsoncharts.KeyedValuesDataset.prototype.removeListener=function(listenerMethod){var i=this.listeners.indexOf(listenerMethod);if(i>=0)this.listeners.splice(i,1)};orsoncharts.KeyedValuesDataset.prototype.notifyListeners=function(){};orsoncharts.KeyedValuesDataset.prototype.add=function(sectionKey,value){this.data.push([sectionKey,value])}; +orsoncharts.KeyedValuesDataset.prototype.remove=function(sectionKey){if(!sectionKey)throw new Error("The 'sectionKey' must be defined.");var i=this.indexOf(sectionKey);if(i<0)throw new Error("The sectionKey '"+sectionKey.toString()+"' is not recognised.");this.data.splice(i,1)};orsoncharts.KeyedValuesDataset.prototype.dataFromJSON=function(jsonStr){this.data=JSON.parse(jsonStr);this.notifyListeners()}; +orsoncharts.KeyedValuesDataset.prototype.removeByIndex=function(itemIndex){this.data.splice(itemIndex,1)};orsoncharts.KeyedValuesDataset.prototype.totalForDataset=function(dataset){var total=0;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)total=total+v}return total}; +orsoncharts.KeyedValuesDataset.prototype.minForDataset=function(dataset){var min=null;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)if(min)min=Math.min(min,v);else min=v}return min};orsoncharts.KeyedValuesDataset.prototype.maxForDataset=function(dataset){var max=null;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)if(max)max=Math.max(max,v);else max=v}return max}; +orsoncharts.KeyedValuesDataset.prototype.total=function(){return this.totalForDataset(this)};orsoncharts.KeyedValuesDataset.prototype.min=function(){return this.minForDataset(this)};orsoncharts.KeyedValuesDataset.prototype.max=function(){return this.maxForDataset(this)};if(!jfc)jfc={};jfc.KeyedValueLabels=function(){if(!(this instanceof orsoncharts.KeyedValueLabels))return new orsoncharts.KeyedValueLabels;this.format="{K} = {V}";this.valueDP=2;this.percentDP=2}; +jfc.KeyedValueLabels.prototype.itemLabel=function(keyedValues,itemIndex){var labelStr=new String(this.format);var keyStr=keyedValues.key(itemIndex);var value=keyedValues.valueByIndex(itemIndex);var valueStr=value.toFixed(this.valueDP);var total=keyedValues.total();var percentStr=(value/total*100).toFixed(this.percentDP);labelStr=labelStr.replace(/{K}/g,keyStr);labelStr=labelStr.replace(/{V}/g,valueStr);labelStr=labelStr.replace(/{P}/g,percentStr);return labelStr}; Added: branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValueLabels.js =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValueLabels.js (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValueLabels.js 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,36 @@ +/* + * JFreeChart + * ---------- + * Copyright (C) 2014 Object Refinery Limited. + */ + +"use strict"; + +if (!jfc) jfc = {}; + +/** + * Constructor for a new KeyedValueLabels instance + * @constructor + */ +jfc.KeyedValueLabels = function() { + if (!(this instanceof orsoncharts.KeyedValueLabels)) { + return new orsoncharts.KeyedValueLabels(); + } + this.format = "{K} = {V}"; + this.valueDP = 2; + this.percentDP = 2; +}; + +// Generates a label for an item in a KeyedValuesDataset. +jfc.KeyedValueLabels.prototype.itemLabel = function(keyedValues, itemIndex) { + var labelStr = new String(this.format); + var keyStr = keyedValues.key(itemIndex); + var value = keyedValues.valueByIndex(itemIndex); + var valueStr = value.toFixed(this.valueDP); + var total = keyedValues.total(); + var percentStr = (value / total * 100).toFixed(this.percentDP); + labelStr = labelStr.replace(/{K}/g, keyStr); + labelStr = labelStr.replace(/{V}/g, valueStr); + labelStr = labelStr.replace(/{P}/g, percentStr); + return labelStr; +}; Added: branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValuesDataset.js =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValuesDataset.js (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/src/KeyedValuesDataset.js 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2014 Object Refinery Limited + */ + +"use strict"; + +if (!jfc) jfc = {}; + +/** + * Constructor for a new KeyedValuesDataset + * @constructor + */ +orsoncharts.KeyedValuesDataset = function() { + if (!(this instanceof jfc.KeyedValuesDataset)) { + return new orsoncharts.KeyedValuesDataset(); + } + this.data = []; + this.listeners = []; +}; + +// returns the number of items in the dataset +orsoncharts.KeyedValuesDataset.prototype.itemCount = function() { + return this.data.length; +}; + +// Returns true if the dataset contains no items and false otherwise +orsoncharts.KeyedValuesDataset.prototype.isEmpty = function() { + return this.data.length === 0; +}; + +// returns the section key for the item with the specified index. +orsoncharts.KeyedValuesDataset.prototype.key = function(index) { + return this.data[index][0]; +}; + +// Returns a new array containing all the keys for the dataset. +orsoncharts.KeyedValuesDataset.prototype.keys = function() { + return this.data.map(function(d) { return d[0]; }); +}; + +// returns the index of the item with the specified key, or -1 +orsoncharts.KeyedValuesDataset.prototype.indexOf = function(sectionKey) { + var arrayLength = this.data.length; + for (var i = 0; i < arrayLength; i++) { + if (this.data[i][0] === sectionKey) { + return i; + } + } + return -1; +}; + +// returns the value for the item with the specified index. +orsoncharts.KeyedValuesDataset.prototype.valueByIndex = function(index) { + return this.data[index][1]; +}; + +// returns the value for the item with the specified key +orsoncharts.KeyedValuesDataset.prototype.valueByKey = function(sectionKey) { + var sectionIndex = this.indexOf(sectionKey); + if (sectionIndex < 0) return null; + return this.valueByIndex(sectionIndex); +}; + +// Adds a listener to the dataset (the listener method will be called whenever +// the dataset is modified) +orsoncharts.KeyedValuesDataset.prototype.addListener = function(listenerMethod) { + this.listeners.push(listenerMethod); +}; + +// Deregisters the specified listener so that it no longer receives +// notification of dataset changes +orsoncharts.KeyedValuesDataset.prototype.removeListener = function(listenerMethod) { + var i = this.listeners.indexOf(listenerMethod); + if (i >= 0) { + this.listeners.splice(i, 1); + } +}; + +// Notifies all registered listeners that there has been a change to this dataset +orsoncharts.KeyedValuesDataset.prototype.notifyListeners = function() { + // TODO: call each listenerMethod +}; + +// adds the specified (key, value) pair to the dataset or, if the key exists +// already, updates the value +orsoncharts.KeyedValuesDataset.prototype.add = function(sectionKey, value) { + this.data.push([sectionKey, value]); +}; + +// removes the item with the specified key +orsoncharts.KeyedValuesDataset.prototype.remove = function(sectionKey) { + if (!sectionKey) throw new Error("The 'sectionKey' must be defined."); + var i = this.indexOf(sectionKey); + if (i < 0) throw new Error("The sectionKey '" + sectionKey.toString() + + "' is not recognised."); + this.data.splice(i, 1); +}; + +// sets the data array based on the supplied JSON string +orsoncharts.KeyedValuesDataset.prototype.dataFromJSON = function(jsonStr) { + this.data = JSON.parse(jsonStr); + this.notifyListeners(); +}; + +orsoncharts.KeyedValuesDataset.prototype.removeByIndex = function(itemIndex) { + this.data.splice(itemIndex, 1); +}; + +// returns the total of all non-null values for the specified dataset +orsoncharts.KeyedValuesDataset.prototype.totalForDataset = function(dataset) { + var total = 0.0; + var itemCount = dataset.itemCount(); + for (var i = 0; i < itemCount; i++) { + var v = dataset.valueByIndex(i); + if (v) { + total = total + v; + } + } + return total; +}; + +// returns the minimum value for the specified dataset +orsoncharts.KeyedValuesDataset.prototype.minForDataset = function(dataset) { + var min = null; + var itemCount = dataset.itemCount(); + for (var i = 0; i < itemCount; i++) { + var v = dataset.valueByIndex(i); + if (v) { + if (min) { + min = Math.min(min, v); + } else { + min = v; + } + } + } + return min; +}; + +// returns the maximum value for the specified dataset +orsoncharts.KeyedValuesDataset.prototype.maxForDataset = function(dataset) { + var max = null; + var itemCount = dataset.itemCount(); + for (var i = 0; i < itemCount; i++) { + var v = dataset.valueByIndex(i); + if (v) { + if (max) { + max = Math.max(max, v); + } else { + max = v; + } + } + } + return max; +}; + +// returns the total of all values in this dataset (ignoring null values) +orsoncharts.KeyedValuesDataset.prototype.total = function() { + return this.totalForDataset(this); +}; + +// returns the minimum value in this dataset (ignoring null values) +orsoncharts.KeyedValuesDataset.prototype.min = function() { + return this.minForDataset(this); +}; + +// returns the maximum value in this dataset (ignoring null values) +orsoncharts.KeyedValuesDataset.prototype.max = function() { + return this.maxForDataset(this); +}; + Added: branches/jfreechart-1.0.x-branch/svg/js/src/Utils.js =================================================================== --- branches/jfreechart-1.0.x-branch/svg/js/src/Utils.js (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/js/src/Utils.js 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2014 Object Refinery Limited + */ + +var jfc; +if (!jfc) jfc = {}; + +jfc.Utils = {}; + +jfc.Utils.makeArrayOf = function(value, length) { + var arr = [], i = length; + while (i--) { + arr[i] = value; + } + return arr; +}; + +// returns the chart entity reference for this element +jfc.Utils.findChartRef = function(element) { + var id = element.getAttribute("jfreesvg:ref"); + var found = false; + var current = element; + while (!found) { + current = current.parentNode; + if (current != null) { + id = current.getAttribute("jfreesvg:ref"); + found = (id != null); + } else { + found = true; + } + } + return id; +} + +// find the chart id by finding the group that is written for the entire chart +jfc.Utils.findChartId = function(element) { + var id = null; + var found = false; + var current = element; + while (!found) { + current = current.parentNode; + if (current != null) { + var ref = current.getAttribute("jfreesvg:ref"); + if (ref == 'JFREECHART_TOP_LEVEL') { + found = true; + id = current.getAttribute("id"); + } + } else { + found = true; + } + } + return id; +} \ No newline at end of file Added: branches/jfreechart-1.0.x-branch/svg/lib/jfreechart_utils.js =================================================================== --- branches/jfreechart-1.0.x-branch/svg/lib/jfreechart_utils.js (rev 0) +++ branches/jfreechart-1.0.x-branch/svg/lib/jfreechart_utils.js 2014-08-04 21:38:11 UTC (rev 3295) @@ -0,0 +1,9 @@ +var jfc;if(!jfc)jfc={};jfc.Utils={};jfc.Utils.makeArrayOf=function(value,length){var arr=[],i=length;while(i--)arr[i]=value;return arr};jfc.Utils.findChartRef=function(element){var id=element.getAttribute("jfreesvg:ref");var found=false;var current=element;while(!found){current=current.parentNode;if(current!=null){id=current.getAttribute("jfreesvg:ref");found=id!=null}else found=true}return id}; +jfc.Utils.findChartId=function(element){var id=null;var found=false;var current=element;while(!found){current=current.parentNode;if(current!=null){var ref=current.getAttribute("jfreesvg:ref");if(ref=="JFREECHART_TOP_LEVEL"){found=true;id=current.getAttribute("id")}}else found=true}return id};if(!jfc)jfc={};orsoncharts.KeyedValuesDataset=function(){if(!(this instanceof jfc.KeyedValuesDataset))return new orsoncharts.KeyedValuesDataset;this.data=[];this.listeners=[]};orsoncharts.KeyedValuesDataset.prototype.itemCount=function(){return this.data.length};orsoncharts.KeyedValuesDataset.prototype.isEmpty=function(){return this.data.length===0};orsoncharts.KeyedValuesDataset.prototype.key=function(index){return this.data[index][0]};orsoncharts.KeyedValuesDataset.prototype.keys=function(){return this.data.map(function(d){return d[0]})}; +orsoncharts.KeyedValuesDataset.prototype.indexOf=function(sectionKey){var arrayLength=this.data.length;for(var i=0;i<arrayLength;i++)if(this.data[i][0]===sectionKey)return i;return-1};orsoncharts.KeyedValuesDataset.prototype.valueByIndex=function(index){return this.data[index][1]};orsoncharts.KeyedValuesDataset.prototype.valueByKey=function(sectionKey){var sectionIndex=this.indexOf(sectionKey);if(sectionIndex<0)return null;return this.valueByIndex(sectionIndex)}; +orsoncharts.KeyedValuesDataset.prototype.addListener=function(listenerMethod){this.listeners.push(listenerMethod)};orsoncharts.KeyedValuesDataset.prototype.removeListener=function(listenerMethod){var i=this.listeners.indexOf(listenerMethod);if(i>=0)this.listeners.splice(i,1)};orsoncharts.KeyedValuesDataset.prototype.notifyListeners=function(){};orsoncharts.KeyedValuesDataset.prototype.add=function(sectionKey,value){this.data.push([sectionKey,value])}; +orsoncharts.KeyedValuesDataset.prototype.remove=function(sectionKey){if(!sectionKey)throw new Error("The 'sectionKey' must be defined.");var i=this.indexOf(sectionKey);if(i<0)throw new Error("The sectionKey '"+sectionKey.toString()+"' is not recognised.");this.data.splice(i,1)};orsoncharts.KeyedValuesDataset.prototype.dataFromJSON=function(jsonStr){this.data=JSON.parse(jsonStr);this.notifyListeners()}; +orsoncharts.KeyedValuesDataset.prototype.removeByIndex=function(itemIndex){this.data.splice(itemIndex,1)};orsoncharts.KeyedValuesDataset.prototype.totalForDataset=function(dataset){var total=0;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)total=total+v}return total}; +orsoncharts.KeyedValuesDataset.prototype.minForDataset=function(dataset){var min=null;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)if(min)min=Math.min(min,v);else min=v}return min};orsoncharts.KeyedValuesDataset.prototype.maxForDataset=function(dataset){var max=null;var itemCount=dataset.itemCount();for(var i=0;i<itemCount;i++){var v=dataset.valueByIndex(i);if(v)if(max)max=Math.max(max,v);else max=v}return max}; +orsoncharts.KeyedValuesDataset.prototype.total=function(){return this.totalForDataset(this)};orsoncharts.KeyedValuesDataset.prototype.min=function(){return this.minForDataset(this)};orsoncharts.KeyedValuesDataset.prototype.max=function(){return this.maxForDataset(this)};if(!jfc)jfc={};jfc.KeyedValueLabels=function(){if(!(this instanceof orsoncharts.KeyedValueLabels))return new orsoncharts.KeyedValueLabels;this.format="{K} = {V}";this.valueDP=2;this.percentDP=2}; +jfc.KeyedValueLabels.prototype.itemLabel=function(keyedValues,itemIndex){var labelStr=new String(this.format);var keyStr=keyedValues.key(itemIndex);var value=keyedValues.valueByIndex(itemIndex);var valueStr=value.toFixed(this.valueDP);var total=keyedValues.total();var percentStr=(value/total*100).toFixed(this.percentDP);labelStr=labelStr.replace(/{K}/g,keyStr);labelStr=labelStr.replace(/{V}/g,valueStr);labelStr=labelStr.replace(/{P}/g,percentStr);return labelStr}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-08-22 17:13:03
|
Revision: 3298 http://sourceforge.net/p/jfreechart/code/3298 Author: mungady Date: 2014-08-22 17:12:54 +0000 (Fri, 22 Aug 2014) Log Message: ----------- 2014-08-22 David Gilbert <dav...@ob...> Change suggested by Ulrich Voigt: * org/jfree/data/time/FixedMillisecond.java (FixedMillisecond()): Avoid Date creation, (FixedMillisecond(long)): Likewise, (FixedMillisecond(Date)): Redirect to other constructor. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/FixedMillisecond.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-22 13:25:34 UTC (rev 3297) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-22 17:12:54 UTC (rev 3298) @@ -1,3 +1,11 @@ +2014-08-22 David Gilbert <dav...@ob...> + + Change suggested by Ulrich Voigt: + * org/jfree/data/time/FixedMillisecond.java + (FixedMillisecond()): Avoid Date creation, + (FixedMillisecond(long)): Likewise, + (FixedMillisecond(Date)): Redirect to other constructor. + 2014-08-04 David Gilbert <dav...@ob...> Patch #312 by Ulrich Voigt: Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/FixedMillisecond.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/FixedMillisecond.java 2014-08-22 13:25:34 UTC (rev 3297) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/FixedMillisecond.java 2014-08-22 17:12:54 UTC (rev 3298) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,10 +27,10 @@ * --------------------- * FixedMillisecond.java * --------------------- - * (C) Copyright 2002-2008, by Object Refinery Limited. + * (C) Copyright 2002-2014, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); - * Contributor(s): -; + * Contributor(s): Ulrich Voigt; * * Changes * ------- @@ -44,6 +44,7 @@ * ------------- JFREECHART 1.0.x --------------------------------------------- * 06-Oct-2006 : Added peg() method (DG); * 28-May-2008 : Fixed immutability problem (DG); + * 20-Aug-2014 : Remove unnecessary Date object creation in constructors (UV); * */ @@ -65,13 +66,13 @@ private static final long serialVersionUID = 7867521484545646931L; /** The millisecond. */ - private long time; + private final long time; /** * Constructs a millisecond based on the current system time. */ public FixedMillisecond() { - this(new Date()); + this(System.currentTimeMillis()); } /** @@ -80,20 +81,21 @@ * @param millisecond the millisecond (same encoding as java.util.Date). */ public FixedMillisecond(long millisecond) { - this(new Date(millisecond)); + this.time = millisecond; } /** * Constructs a millisecond. * - * @param time the time. + * @param time the time ({@code null} not permitted). */ public FixedMillisecond(Date time) { - this.time = time.getTime(); + this(time.getTime()); } /** - * Returns the date/time. + * Returns the date/time (creates a new {@code Date} instance each time + * this method is called). * * @return The date/time. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-08-24 05:32:59
|
Revision: 3299 http://sourceforge.net/p/jfreechart/code/3299 Author: mungady Date: 2014-08-24 05:32:49 +0000 (Sun, 24 Aug 2014) Log Message: ----------- 2014-08-24 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/AbstractRenderer.java (beginElementGroup): New method, (endElementGroup): Likewise, * org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java (beginElementGroup): Call superclass, (endElementGroup): Moved to superclass, * org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java (beginElementGroup): New method, * org/jfree/chart/renderer/xy/XYBarRenderer.java (drawItem): Add element hinting, * org/jfree/data/KeyedValuesItemKey.java: New file, * org/jfree/data/xy/XYItemKey.java: New file. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYBarRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/KeyedValuesItemKey.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYItemKey.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-22 17:12:54 UTC (rev 3298) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-24 05:32:49 UTC (rev 3299) @@ -1,3 +1,18 @@ +2014-08-24 David Gilbert <dav...@ob...> + + * org/jfree/chart/renderer/AbstractRenderer.java + (beginElementGroup): New method, + (endElementGroup): Likewise, + * org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java + (beginElementGroup): Call superclass, + (endElementGroup): Moved to superclass, + * org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java + (beginElementGroup): New method, + * org/jfree/chart/renderer/xy/XYBarRenderer.java + (drawItem): Add element hinting, + * org/jfree/data/KeyedValuesItemKey.java: New file, + * org/jfree/data/xy/XYItemKey.java: New file. + 2014-08-22 David Gilbert <dav...@ob...> Change suggested by Ulrich Voigt: Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java 2014-08-22 17:12:54 UTC (rev 3298) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -92,6 +92,7 @@ * 05-Jul-2012 : No need for BooleanUtilities now that min JDK = 1.4.2 (DG); * 03-Jul-2013 : Use ParamChecks (DG); * 09-Apr-2014 : Remove use of ObjectList (DG); + * 24-Aug-2014 : Add begin/endElementGroup() (DG); * */ @@ -100,6 +101,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; +import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Shape; import java.awt.Stroke; @@ -117,6 +119,7 @@ import javax.swing.event.EventListenerList; +import org.jfree.chart.ChartHints; import org.jfree.chart.HashUtilities; import org.jfree.chart.event.RendererChangeEvent; import org.jfree.chart.event.RendererChangeListener; @@ -127,6 +130,7 @@ import org.jfree.chart.title.LegendTitle; import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; +import org.jfree.data.ItemKey; import org.jfree.io.SerialUtilities; import org.jfree.ui.TextAnchor; import org.jfree.util.BooleanList; @@ -481,6 +485,36 @@ */ public abstract DrawingSupplier getDrawingSupplier(); + /** + * Adds a {@code KEY_BEGIN_ELEMENT} hint to the graphics target. This + * hint is recognised by <b>JFreeSVG</b> (in theory it could be used by + * other {@code Graphics2D} implementations also). + * + * @param g2 the graphics target ({@code null} not permitted). + * @param key the key ({@code null} not permitted). + * + * @see #endElementGroup(java.awt.Graphics2D) + * @since 1.0.20 + */ + protected void beginElementGroup(Graphics2D g2, ItemKey key) { + ParamChecks.nullNotPermitted(key, "key"); + Map m = new HashMap(1); + m.put("ref", key.toJSONString()); + g2.setRenderingHint(ChartHints.KEY_BEGIN_ELEMENT, m); + } + + /** + * Adds a {@code KEY_END_ELEMENT} hint to the graphics target. + * + * @param g2 the graphics target ({@code null} not permitted). + * + * @see #beginElementGroup(java.awt.Graphics2D, org.jfree.data.ItemKey) + * @since 1.0.20 + */ + protected void endElementGroup(Graphics2D g2) { + g2.setRenderingHint(ChartHints.KEY_END_ELEMENT, Boolean.TRUE); + } + // SERIES VISIBLE (not yet respected by all renderers) /** Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2014-08-22 17:12:54 UTC (rev 3298) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -130,7 +130,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.jfree.chart.ChartHints; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.axis.CategoryAxis; @@ -157,7 +156,7 @@ import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.chart.util.TextUtils; -import org.jfree.data.ItemKey; +import org.jfree.data.KeyedValues2DItemKey; import org.jfree.data.Range; import org.jfree.data.category.CategoryDataset; import org.jfree.data.general.DatasetUtilities; @@ -599,8 +598,7 @@ if (data != null) { this.rowCount = data.getRowCount(); this.columnCount = data.getColumnCount(); - } - else { + } else { this.rowCount = 0; this.columnCount = 0; } @@ -623,34 +621,23 @@ /** * Adds a {@code KEY_BEGIN_ELEMENT} hint to the graphics target. This - * hint is recognised by <b>JFreeSVG</b>. + * hint is recognised by <b>JFreeSVG</b> (in theory it could be used by + * other {@code Graphics2D} implementations also). * * @param g2 the graphics target ({@code null} not permitted). - * @param key the key ({@code null} not permitted). + * @param rowKey the row key that identifies the element ({@code null} not + * permitted). + * @param columnKey the column key that identifies the element + * ({@code null} not permitted). * - * @see #endElementGroup(java.awt.Graphics2D) * @since 1.0.20 */ - protected void beginElementGroup(Graphics2D g2, ItemKey key) { - ParamChecks.nullNotPermitted(key, "key"); - Map m = new HashMap(1); - m.put("ref", key.toJSONString()); - g2.setRenderingHint(ChartHints.KEY_BEGIN_ELEMENT, m); + protected void beginElementGroup(Graphics2D g2, Comparable rowKey, + Comparable columnKey) { + beginElementGroup(g2, new KeyedValues2DItemKey(rowKey, columnKey)); } /** - * Adds a {@code KEY_END_ELEMENT} hint to the graphics target. - * - * @param g2 the graphics target ({@code null} not permitted). - * - * @see #beginElementGroup(java.awt.Graphics2D, org.jfree.data.ItemKey) - * @since 1.0.20 - */ - protected void endElementGroup(Graphics2D g2) { - g2.setRenderingHint(ChartHints.KEY_END_ELEMENT, Boolean.TRUE); - } - - /** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java 2014-08-22 17:12:54 UTC (rev 3298) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -122,7 +122,8 @@ * 11-Jan-2014 : Fix error in fillDomainGridBand method (DG); * 07-Apr-2014 : Don't use ObjectList anymore (DG); * 29-Jul-2014 : Add rendering hint to normalise domain and range lines (DG); - * + * 24-Aug-2014 : Add beginElementGroup() method, part of JFreeSVG support (DG); + * */ package org.jfree.chart.renderer.xy; @@ -180,6 +181,7 @@ import org.jfree.data.Range; import org.jfree.data.general.DatasetUtilities; import org.jfree.data.xy.XYDataset; +import org.jfree.data.xy.XYItemKey; import org.jfree.text.TextUtilities; import org.jfree.ui.GradientPaintTransformer; import org.jfree.ui.Layer; @@ -300,7 +302,7 @@ * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. - * @param data the data. + * @param dataset the dataset. * @param info an optional info collection object to return data back to * the caller. * @@ -308,10 +310,28 @@ */ @Override public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, - XYPlot plot, XYDataset data, PlotRenderingInfo info) { - return new XYItemRendererState(info); + XYPlot plot, XYDataset dataset, PlotRenderingInfo info) { + XYItemRendererState state = new XYItemRendererState(info); + return state; } + /** + * Adds a {@code KEY_BEGIN_ELEMENT} hint to the graphics target. This + * hint is recognised by <b>JFreeSVG</b> (in theory it could be used by + * other {@code Graphics2D} implementations also). + * + * @param g2 the graphics target ({@code null} not permitted). + * @param seriesKey the series key that identifies the element + * ({@code null} not permitted). + * @param itemIndex the item index. + * + * @since 1.0.20 + */ + protected void beginElementGroup(Graphics2D g2, Comparable seriesKey, + int itemIndex) { + beginElementGroup(g2, new XYItemKey(seriesKey, itemIndex)); + } + // ITEM LABEL GENERATOR /** Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYBarRenderer.java 2014-08-22 17:12:54 UTC (rev 3298) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYBarRenderer.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -99,6 +99,7 @@ * 10-May-2012 : Fix findDomainBounds() and findRangeBounds() to account for * non-visible series (DG); * 03-Jul-2013 : Use ParamChecks (DG); + * 24-Aug-2014 : Add begin/endElementGroup() (DG); * */ @@ -813,8 +814,7 @@ if (this.useYInterval) { value0 = intervalDataset.getStartYValue(series, item); value1 = intervalDataset.getEndYValue(series, item); - } - else { + } else { value0 = this.base; value1 = intervalDataset.getYValue(series, item); } @@ -825,8 +825,7 @@ if (!rangeAxis.getRange().intersects(value0, value1)) { return; } - } - else { + } else { if (!rangeAxis.getRange().intersects(value1, value0)) { return; } @@ -851,8 +850,7 @@ if (!domainAxis.getRange().intersects(startX, endX)) { return; } - } - else { + } else { if (!domainAxis.getRange().intersects(endX, startX)) { return; } @@ -884,14 +882,13 @@ Rectangle2D bar = null; PlotOrientation orientation = plot.getOrientation(); - if (orientation == PlotOrientation.HORIZONTAL) { + if (orientation.isHorizontal()) { // clip left and right bounds to data area bottom = Math.max(bottom, dataArea.getMinX()); top = Math.min(top, dataArea.getMaxX()); bar = new Rectangle2D.Double( bottom, left, top - bottom, translatedWidth); - } - else if (orientation == PlotOrientation.VERTICAL) { + } else if (orientation.isVertical()) { // clip top and bottom bounds to data area bottom = Math.max(bottom, dataArea.getMinY()); top = Math.min(top, dataArea.getMaxY()); @@ -902,27 +899,31 @@ boolean positive = (value1 > 0.0); boolean inverted = rangeAxis.isInverted(); RectangleEdge barBase; - if (orientation == PlotOrientation.HORIZONTAL) { + if (orientation.isHorizontal()) { if (positive && inverted || !positive && !inverted) { barBase = RectangleEdge.RIGHT; - } - else { + } else { barBase = RectangleEdge.LEFT; } - } - else { + } else { if (positive && !inverted || !positive && inverted) { barBase = RectangleEdge.BOTTOM; - } - else { + } else { barBase = RectangleEdge.TOP; } } + + if (state.getElementHinting()) { + beginElementGroup(g2, dataset.getSeriesKey(series), item); + } if (getShadowsVisible()) { this.barPainter.paintBarShadow(g2, this, series, item, bar, barBase, !this.useYInterval); } this.barPainter.paintBar(g2, this, series, item, bar, barBase); + if (state.getElementHinting()) { + endElementGroup(g2); + } if (isItemLabelVisible(series, item)) { XYItemLabelGenerator generator = getItemLabelGenerator(series, @@ -986,8 +987,7 @@ ItemLabelPosition position; if (!negative) { position = getPositiveItemLabelPosition(series, item); - } - else { + } else { position = getNegativeItemLabelPosition(series, item); } Added: branches/jfreechart-1.0.x-branch/source/org/jfree/data/KeyedValuesItemKey.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/KeyedValuesItemKey.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/KeyedValuesItemKey.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -0,0 +1,107 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * ----------------------- + * KeyedValuesItemKey.java + * ----------------------- + * (C) Copyright 2014, by Object Refinery Limited. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes: + * -------- + * 18-Aug-2014 : Version 1, based on code from Orson Charts (DG); + * + */ + +package org.jfree.data; + +import java.io.Serializable; +import org.jfree.chart.util.ParamChecks; + +public class KeyedValuesItemKey implements ItemKey, Serializable { + + /** The key for the item. */ + Comparable<? extends Object> key; + + /** + * Creates a new instance. + * + * @param key the key ({@code null} not permitted). + */ + public KeyedValuesItemKey(Comparable<? extends Object> key) { + ParamChecks.nullNotPermitted(key, "key"); + this.key = key; + } + + /** + * Returns the key. + * + * @return The key (never {@code null}). + */ + public Comparable<?> getKey() { + return this.key; + } + + /** + * Tests this instance for equality with an arbitrary object. + * + * @param obj the object ({@code null} not permitted). + * + * @return A boolean. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof KeyedValuesItemKey)) { + return false; + } + KeyedValuesItemKey that = (KeyedValuesItemKey) obj; + if (!this.key.equals(that.key)) { + return false; + } + return true; + } + + @Override + public String toJSONString() { + StringBuilder sb = new StringBuilder(); + sb.append("{\"key\": \"").append(this.key.toString()).append("\"}"); + return sb.toString(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("KeyedValuesItemKey["); + sb.append(this.key.toString()); + sb.append("]"); + return sb.toString(); + } +} Added: branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYItemKey.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYItemKey.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYItemKey.java 2014-08-24 05:32:49 UTC (rev 3299) @@ -0,0 +1,158 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * -------------- + * XYItemKey.java + * -------------- + * (C) Copyright 2014, by Object Refinery Limited. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes + * ------- + * 22-Aug-2014 : Version 1 (DG); + * + */ + +package org.jfree.data.xy; + +import java.io.Serializable; +import org.jfree.chart.util.ParamChecks; +import org.jfree.data.ItemKey; +import org.jfree.util.ObjectUtilities; + +/** + * An object that references one data item in an {@link XYZDataset}. This is + * used internally to track the data item that a 3D object is related to, if + * any (and later that link is used for chart interaction). Instances of + * this class are immutable. + * + * @param <S> the series key type. + * @since 1.0.20 + */ +public class XYItemKey<S extends Comparable<S>> implements ItemKey, + Comparable<XYItemKey<S>>, Serializable { + + /** A key identifying a series in the dataset. */ + private final S seriesKey; + + /** The index of an item within a series. */ + private final int itemIndex; + + /** + * Creates a new instance. + * + * @param seriesKey the series key. + * @param itemIndex the item index. + */ + public XYItemKey(S seriesKey, int itemIndex) { + ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); + this.seriesKey = seriesKey; + this.itemIndex = itemIndex; + } + + /** + * Returns the series key. + * + * @return The series key (never <code>null</code>). + */ + public S getSeriesKey() { + return this.seriesKey; + } + + /** + * Returns the item index. + * + * @return The item index. + */ + public int getItemIndex() { + return this.itemIndex; + } + + /** + * Tests this instance for equality with an arbitrary object. + * + * @param obj the object to test (<code>null</code> permitted). + * + * @return A boolean. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof XYItemKey)) { + return false; + } + XYItemKey that = (XYItemKey) obj; + if (!this.seriesKey.equals(that.seriesKey)) { + return false; + } + if (this.itemIndex != that.itemIndex) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 41 * hash + ObjectUtilities.hashCode(this.seriesKey); + hash = 41 * hash + this.itemIndex; + return hash; + } + + @Override + public String toJSONString() { + StringBuilder sb = new StringBuilder(); + sb.append("{\"seriesKey\": \"").append(this.seriesKey.toString()); + sb.append("\", "); + sb.append("\"itemIndex\": ").append(this.itemIndex).append("}"); + return sb.toString(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("XYItemKey[seriesKey="); + sb.append(this.seriesKey.toString()).append(",item="); + sb.append(itemIndex); + sb.append("]"); + return sb.toString(); + } + + @Override + public int compareTo(XYItemKey<S> key) { + int result = this.seriesKey.compareTo(key.seriesKey); + if (result == 0) { + result = this.itemIndex - key.itemIndex; + } + return result; + } + +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-08-28 03:17:13
|
Revision: 3302 http://sourceforge.net/p/jfreechart/code/3302 Author: mungady Date: 2014-08-28 03:17:08 +0000 (Thu, 28 Aug 2014) Log Message: ----------- 2014-08-29 David Gilbert <dav...@ob...> (Patch from Simon Legner attached to bug 1129) * org/jfree/chart/ChartPanel.java (actionPerformed): Localise error messages, (saveAsSVG): Likewise, (saveAsPDF): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle.properties branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle_de.properties Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-25 05:59:20 UTC (rev 3301) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-08-28 03:17:08 UTC (rev 3302) @@ -1,5 +1,25 @@ +2014-08-29 David Gilbert <dav...@ob...> + + (Patch from Simon Legner attached to bug 1129) + * org/jfree/chart/ChartPanel.java + (actionPerformed): Localise error messages, + (saveAsSVG): Likewise, + (saveAsPDF): Likewise. + 2014-08-24 David Gilbert <dav...@ob...> + * org/jfree/chart/renderer/BarRenderer3D.java + (drawItem): Add element hinting, + * org/jfree/chart/renderer/IntervalBarRenderer.java + (drawInterval): Add element hinting, + * org/jfree/chart/renderer/LayeredBarRenderer.java + (drawHorizontalItem): Add element hinting, + (drawVerticalItem): Likewise, + * org/jfree/chart/renderer/LevelRenderer.java + (drawItem): Add element hinting. + +2014-08-24 David Gilbert <dav...@ob...> + * org/jfree/chart/renderer/AbstractRenderer.java (beginElementGroup): New method, (endElementGroup): Likewise, Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java 2014-08-25 05:59:20 UTC (rev 3301) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java 2014-08-28 03:17:08 UTC (rev 3302) @@ -44,6 +44,7 @@ * Ulrich Voigt - patch 2686040; * Alessandro Borges - patch 1460845; * Martin Hoeller; + * Simon Legner - patch from bug 1129; * * Changes (from 28-Jun-2001) * -------------------------- @@ -170,6 +171,7 @@ * 02-Jul-2013 : Use ParamChecks class (DG); * 12-Sep-2013 : Provide auto-detection for JFreeSVG and OrsonPDF * libraries (no compile time dependencies) (DG); + * 29-Aug-2014 : Localisation updates from patch attached to bug 1129 (SL); * */ @@ -1722,16 +1724,18 @@ doSaveAs(); } catch (IOException e) { - JOptionPane.showMessageDialog(this, "I/O error occurred.", - "Save As PNG", JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(this, "I/O error occurred.", + localizationResources.getString("Save_as_PNG"), + JOptionPane.WARNING_MESSAGE); } } else if (command.equals(SAVE_AS_SVG_COMMAND)) { try { saveAsSVG(null); } catch (IOException e) { - JOptionPane.showMessageDialog(this, "I/O error occurred.", - "Save As SVG", JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(this, "I/O error occurred.", + localizationResources.getString("Save_as_SVG"), + JOptionPane.WARNING_MESSAGE); } } else if (command.equals(SAVE_AS_PDF_COMMAND)) { @@ -2752,7 +2756,8 @@ String fileExists = localizationResources.getString( "FILE_EXISTS_CONFIRM_OVERWRITE"); int response = JOptionPane.showConfirmDialog(this, - fileExists, "Save As SVG", + fileExists, + localizationResources.getString("Save_as_SVG"), JOptionPane.OK_CANCEL_OPTION); if (response == JOptionPane.CANCEL_OPTION) { file = null; @@ -2871,7 +2876,8 @@ String fileExists = localizationResources.getString( "FILE_EXISTS_CONFIRM_OVERWRITE"); int response = JOptionPane.showConfirmDialog(this, - fileExists, "Save As PDF", + fileExists, + localizationResources.getString("Save_as_PDF"), JOptionPane.OK_CANCEL_OPTION); if (response == JOptionPane.CANCEL_OPTION) { file = null; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle.properties =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle.properties 2014-08-25 05:59:20 UTC (rev 3301) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle.properties 2014-08-28 03:17:08 UTC (rev 3302) @@ -4,6 +4,7 @@ # -------------------------- # 31-Aug-2003 : Initial version (AL); # 27-Nov-2013 : Added PNG..., PDF..., Save_as and SVG... (DG) +# 29-Aug-2014 : Applied patch from Simon04 for bug 1129; # Auto_Range=Auto Range @@ -22,6 +23,9 @@ Range_Axis=Range Axis Save_as=Save as Save_as...=Save as... +Save_as_PDF=Save as PDF +Save_as_PNG=Save as PNG +Save_as_SVG=Save as SVG SVG...=SVG... SVG_Files=SVG Files Zoom_In=Zoom In Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle_de.properties =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle_de.properties 2014-08-25 05:59:20 UTC (rev 3301) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/LocalizationBundle_de.properties 2014-08-28 03:17:08 UTC (rev 3302) @@ -1,21 +1,32 @@ -# org.jfree.chart.ChartPanel ResourceBundle properties file - german version -# -# Changes (from 31-Aug-2003) -# -------------------------- -# 31-Aug-2003 : Initial version (AL); -# 15-Mar-2004 : Revised version (Christian W. Zuckschwerdt); -# - -Auto_Range=Autojustage -All_Axes=Beide Achsen -Chart=Diagramm -Chart_Properties=Diagramm-Eigenschaften -Copy=Kopieren -Domain_Axis=Horizontale Achse -PNG_Image_Files=PNG Datei (Portable Network Graphics) (*.png) -Print...=Drucken... -Properties...=Eigenschaften... -Save_as...=Speichern unter... -Range_Axis=Vertikale Achse -Zoom_In=Hineinzoomen -Zoom_Out=Herauszoomen +# org.jfree.chart.ChartPanel ResourceBundle properties file - german version +# +# Changes (from 31-Aug-2003) +# -------------------------- +# 31-Aug-2003 : Initial version (AL); +# 15-Mar-2004 : Revised version (Christian W. Zuckschwerdt); +# 29-Aug-2014 : Applied patch from Simon04 for bug 1129; +# + +Auto_Range=Autojustage +All_Axes=Beide Achsen +Chart=Diagramm +Chart_Properties=Diagramm-Eigenschaften +Copy=Kopieren +Domain_Axis=Horizontale Achse +PNG_Image_Files=PNG-Datei (Portable Network Graphics) (*.png) +Print...=Drucken... +Properties...=Eigenschaften... +Save_as...=Speichern unter... +Range_Axis=Vertikale Achse +Zoom_In=Hineinzoomen +Zoom_Out=Herauszoomen +FILE_EXISTS_CONFIRM_OVERWRITE=Die Datei existiert bereit. Soll die Datei wirklich \u00c3\u00bcberschrieben werden? +PNG...=PNG... +PDF...=PDF... +PDF_Files=PDF-Datei (Portable Document Format) (*.pdf) +Save_as=Speichern unter +Save_as_PDF=Speichern als PDF +Save_as_PNG=Speichern als PNG +Save_as_SVG=Speichern als SVG +SVG...=SVG... +SVG_Files=SVG-Dateien (Scalable Vector Graphics) (*.svg) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2015-09-06 07:41:24
|
Revision: 3309 http://sourceforge.net/p/jfreechart/code/3309 Author: mungady Date: 2015-09-06 07:41:22 +0000 (Sun, 06 Sep 2015) Log Message: ----------- 2015-09-06 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeries.java (findValueRange): Check for Double.NaN. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2015-01-26 22:34:47 UTC (rev 3308) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-06 07:41:22 UTC (rev 3309) @@ -1,3 +1,14 @@ +2015-09-06 David Gilbert <dav...@ob...> + + * org/jfree/data/time/TimeSeries.java + (findValueRange): Check for Double.NaN. + +2014-08-31 David Gilbert <dav...@ob...> + + (Bug 986 fix from Vladimir Shirokov): + * org/jfree/chart/plot/CombinedDomainXYPlot.java + (datasetChanged): New method override. + 2014-08-29 David Gilbert <dav...@ob...> (Patch from Simon Legner attached to bug 1129) Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java 2015-01-26 22:34:47 UTC (rev 3308) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java 2015-09-06 07:41:22 UTC (rev 3309) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------- * TimeSeries.java * --------------- - * (C) Copyright 2001-2014, by Object Refinery Limited. + * (C) Copyright 2001-2015, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Bryan Scott; @@ -85,7 +85,8 @@ * 03-Dec-2011 : Fixed bug 3446965 which affects the y-range calculation for * the series (DG); * 02-Jul-2013 : Use ParamChecks (DG); - * + * 06-Sep-2015 : Fix bug with Double.NaN values and findRangeBounds() (DG); + * */ package org.jfree.data.time; @@ -335,14 +336,13 @@ } /** - * Returns the range of y-values in the time series. Any <code>null</code> - * data values in the series will be ignored (except for the special case - * where all data values are <code>null</code>, in which case the return - * value is <code>Range(Double.NaN, Double.NaN)</code>). If the time - * series contains no items, this method will return <code>null</code>. + * Returns the range of y-values in the time series. Any {@code null} or + * {@code Double.NaN} data values in the series will be ignored (except for + * the special case where all data values are {@code null}, in which case + * the return value is {@code Range(Double.NaN, Double.NaN)}). If the time + * series contains no items, this method will return {@code null}. * - * @return The range of y-values in the time series (possibly - * <code>null</code>). + * @return The range of y-values in the time series (possibly {@code null}). * * @since 1.0.18 */ @@ -356,12 +356,11 @@ /** * Returns the range of y-values in the time series that fall within * the specified range of x-values. This is equivalent to - * <code>findValueRange(xRange, TimePeriodAnchor.MIDDLE, timeZone)</code>. + * {@code findValueRange(xRange, TimePeriodAnchor.MIDDLE, timeZone)}. * - * @param xRange the subrange of x-values (<code>null</code> not - * permitted). + * @param xRange the subrange of x-values ({@code null} not permitted). * @param timeZone the time zone used to convert x-values to time periods - * (<code>null</code> not permitted). + * ({@code null} not permitted). * * @return The range. * @@ -376,11 +375,11 @@ * x-values (where the x-values are interpreted as milliseconds since the * epoch and converted to time periods using the specified timezone). * - * @param xRange the subset of x-values to use (<code>null</code> not + * @param xRange the subset of x-values to use ({@code null} not * permitted). - * @param xAnchor the anchor point for the x-values (<code>null</code> + * @param xAnchor the anchor point for the x-values ({@code null} * not permitted). - * @param zone the time zone (<code>null</code> not permitted). + * @param zone the time zone ({@code null} not permitted). * * @return The range of y-values. * @@ -406,8 +405,8 @@ Number n = item.getValue(); if (n != null) { double v = n.doubleValue(); - lowY = Math.min(lowY, v); - highY = Math.max(highY, v); + lowY = minIgnoreNaN(lowY, v); + highY = maxIgnoreNaN(highY, v); } } } @@ -423,8 +422,8 @@ /** * Returns the smallest y-value in the series, ignoring any - * <code>null</code> and <code>Double.NaN</code> values. This method - * returns <code>Double.NaN</code> if there is no smallest y-value (for + * {@code null} and {@code Double.NaN} values. This method + * returns {@code Double.NaN} if there is no smallest y-value (for * example, when the series is empty). * * @return The smallest y-value. @@ -439,8 +438,8 @@ /** * Returns the largest y-value in the series, ignoring any - * <code>null</code> and <code>Double.NaN</code> values. This method - * returns <code>Double.NaN</code> if there is no largest y-value + * {@code null} and {@code Double.NaN} values. This method + * returns {@code Double.NaN} if there is no largest y-value * (for example, when the series is empty). * * @return The largest y-value. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2015-09-09 17:26:32
|
Revision: 3312 http://sourceforge.net/p/jfreechart/code/3312 Author: mungady Date: 2015-09-09 17:26:30 +0000 (Wed, 09 Sep 2015) Log Message: ----------- 2015-09-09 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/xy/XYShapeRenderer.java (drawItem): Update crosshair state. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYShapeRenderer.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-06 07:55:27 UTC (rev 3311) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-09 17:26:30 UTC (rev 3312) @@ -1,3 +1,8 @@ +2015-09-09 David Gilbert <dav...@ob...> + + * org/jfree/chart/renderer/xy/XYShapeRenderer.java + (drawItem): Update crosshair state. + 2015-09-06 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeries.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYShapeRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYShapeRenderer.java 2015-09-06 07:55:27 UTC (rev 3311) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYShapeRenderer.java 2015-09-09 17:26:30 UTC (rev 3312) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * -------------------- * XYShapeRenderer.java * -------------------- - * (C) Copyright 2008-2014 by Andreas Haumer, xS+S and Contributors. + * (C) Copyright 2008-2015 by Andreas Haumer, xS+S and Contributors. * * Original Author: Martin Hoeller (x Software + Systeme xS+S - Andreas * Haumer); @@ -40,6 +40,7 @@ * 16-Feb-2010 : Added findZBounds() (patch 2952086) (MH); * 19-Oct-2011 : Fixed NPE in findRangeBounds() (bug 3026341) (DG); * 03-Jul-2013 : Use ParamChecks (DG); + * 09-Sep-2015 : Add update for crosshair (DG); * */ @@ -85,7 +86,7 @@ * connecting the shape to the edges of the plot. * <br><br> * The example shown here is generated by the - * <code>XYShapeRendererDemo1.java</code> program included in the JFreeChart + * {@code XYShapeRendererDemo1.java} program included in the JFreeChart * demo collection: * <br><br> * <img src="../../../../../images/XYShapeRendererSample.png" @@ -130,7 +131,7 @@ private transient Stroke guideLineStroke; /** - * Creates a new <code>XYShapeRenderer</code> instance with default + * Creates a new {@code XYShapeRenderer} instance with default * attributes. */ public XYShapeRenderer() { @@ -148,7 +149,7 @@ /** * Returns the paint scale used by the renderer. * - * @return The paint scale (never <code>null</code>). + * @return The paint scale (never {@code null}). * * @see #setPaintScale(PaintScale) */ @@ -160,7 +161,7 @@ * Sets the paint scale used by the renderer and sends a * {@link RendererChangeEvent} to all registered listeners. * - * @param scale the scale (<code>null</code> not permitted). + * @param scale the scale ({@code null} not permitted). * * @see #getPaintScale() */ @@ -171,8 +172,8 @@ } /** - * Returns <code>true</code> if outlines should be drawn for shapes, and - * <code>false</code> otherwise. + * Returns {@code true} if outlines should be drawn for shapes, and + * {@code false} otherwise. * * @return A boolean. * @@ -200,11 +201,11 @@ } /** - * Returns <code>true</code> if the renderer should use the fill paint - * setting to fill shapes, and <code>false</code> if it should just + * Returns {@code true} if the renderer should use the fill paint + * setting to fill shapes, and {@code false} if it should just * use the regular paint. * <p> - * Refer to <code>XYLineAndShapeRendererDemo2.java</code> to see the + * Refer to {@code XYLineAndShapeRendererDemo2.java} to see the * effect of this flag. * * @return A boolean. @@ -286,7 +287,7 @@ /** * Returns the paint used to draw the guide lines. * - * @return The paint (never <code>null</code>). + * @return The paint (never {@code null}). * * @see #setGuideLinePaint(Paint) */ @@ -298,7 +299,7 @@ * Sets the paint used to draw the guide lines and sends a * {@link RendererChangeEvent} to all registered listeners. * - * @param paint the paint (<code>null</code> not permitted). + * @param paint the paint ({@code null} not permitted). * * @see #getGuideLinePaint() */ @@ -323,7 +324,7 @@ * Sets the stroke used to draw the guide lines and sends a * {@link RendererChangeEvent} to all registered listeners. * - * @param stroke the stroke (<code>null</code> not permitted). + * @param stroke the stroke ({@code null} not permitted). * * @see #getGuideLineStroke() */ @@ -337,9 +338,9 @@ * Returns the lower and upper bounds (range) of the x-values in the * specified dataset. * - * @param dataset the dataset (<code>null</code> permitted). + * @param dataset the dataset ({@code null} permitted). * - * @return The range (<code>null</code> if the dataset is <code>null</code> + * @return The range ({@code null} if the dataset is {@code null} * or empty). */ @Override @@ -360,9 +361,9 @@ * Returns the range of values the renderer requires to display all the * items from the specified dataset. * - * @param dataset the dataset (<code>null</code> permitted). + * @param dataset the dataset ({@code null} permitted). * - * @return The range (<code>null</code> if the dataset is <code>null</code> + * @return The range ({@code null} if the dataset is {@code null} * or empty). */ @Override @@ -382,16 +383,15 @@ /** * Return the range of z-values in the specified dataset. * - * @param dataset the dataset (<code>null</code> permitted). + * @param dataset the dataset ({@code null} permitted). * - * @return The range (<code>null</code> if the dataset is <code>null</code> + * @return The range ({@code null} if the dataset is {@code null} * or empty). */ public Range findZBounds(XYZDataset dataset) { if (dataset != null) { return DatasetUtilities.findZBounds(dataset); - } - else { + } else { return null; } } @@ -399,7 +399,7 @@ /** * Returns the number of passes required by this renderer. * - * @return <code>2</code>. + * @return {@code 2}. */ @Override public int getPassCount() { @@ -457,21 +457,18 @@ dataArea.getMaxY())); g2.draw(new Line2D.Double(dataArea.getMinX(), transX, dataArea.getMaxX(), transX)); - } - else { + } else { g2.draw(new Line2D.Double(transX, dataArea.getMinY(), transX, dataArea.getMaxY())); g2.draw(new Line2D.Double(dataArea.getMinX(), transY, dataArea.getMaxX(), transY)); } - } - else if (pass == 1) { + } else if (pass == 1) { Shape shape = getItemShape(series, item); if (orientation == PlotOrientation.HORIZONTAL) { shape = ShapeUtilities.createTranslatedShape(shape, transY, transX); - } - else if (orientation == PlotOrientation.VERTICAL) { + } else if (orientation == PlotOrientation.VERTICAL) { shape = ShapeUtilities.createTranslatedShape(shape, transX, transY); } @@ -492,6 +489,11 @@ g2.draw(shape); } } + + int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); + int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); + updateCrosshairValues(crosshairState, x, y, domainAxisIndex, + rangeAxisIndex, transX, transY, orientation); // add an entity for the item... if (entities != null) { @@ -504,7 +506,7 @@ /** * Get the paint for a given series and item from a dataset. * - * @param dataset the dataset.. + * @param dataset the dataset. * @param series the series index. * @param item the item index. * @@ -515,8 +517,7 @@ if (dataset instanceof XYZDataset) { double z = ((XYZDataset) dataset).getZValue(series, item); p = this.paintScale.getPaint(z); - } - else { + } else { if (this.useFillPaint) { p = getItemFillPaint(series, item); } @@ -529,15 +530,15 @@ /** * Tests this instance for equality with an arbitrary object. This method - * returns <code>true</code> if and only if: + * returns {@code true} if and only if: * <ul> - * <li><code>obj</code> is an instance of <code>XYShapeRenderer</code> (not - * <code>null</code>);</li> - * <li><code>obj</code> has the same field values as this - * <code>XYShapeRenderer</code>;</li> + * <li>{@code obj} is an instance of {@code XYShapeRenderer} (not + * {@code null});</li> + * <li>{@code obj} has the same field values as this + * {@code XYShapeRenderer};</li> * </ul> * - * @param obj the object (<code>null</code> permitted). + * @param obj the object ({@code null} permitted). * * @return A boolean. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2015-09-10 04:00:40
|
Revision: 3323 http://sourceforge.net/p/jfreechart/code/3323 Author: mungady Date: 2015-09-10 04:00:37 +0000 (Thu, 10 Sep 2015) Log Message: ----------- 2015-09-10 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/xy/YIntervalRenderer.java (drawItem): Check item visibility. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/YIntervalRenderer.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-09 20:02:13 UTC (rev 3322) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-10 04:00:37 UTC (rev 3323) @@ -1,3 +1,8 @@ +2015-09-10 David Gilbert <dav...@ob...> + + * org/jfree/chart/renderer/xy/YIntervalRenderer.java + (drawItem): Check item visibility. + 2015-09-09 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/xy/XYShapeRenderer.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/YIntervalRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/YIntervalRenderer.java 2015-09-09 20:02:13 UTC (rev 3322) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/YIntervalRenderer.java 2015-09-10 04:00:37 UTC (rev 3323) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * ---------------------- * YIntervalRenderer.java * ---------------------- - * (C) Copyright 2002-2014, by Object Refinery Limited. + * (C) Copyright 2002-2015, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -81,7 +81,7 @@ /** * A renderer that draws a line connecting the start and end Y values for an * {@link XYPlot}. The example shown here is generated by the - * <code>YIntervalRendererDemo1.java</code> program included in the JFreeChart + * {@code YIntervalRendererDemo1.java} program included in the JFreeChart * demo collection: * <br><br> * <img src="../../../../../images/YIntervalRendererSample.png" @@ -114,7 +114,7 @@ * Returns the generator for the item labels that appear near the lower * y-value. * - * @return The generator (possibly <code>null</code>). + * @return The generator (possibly {@code null}). * * @see #setAdditionalItemLabelGenerator(XYItemLabelGenerator) * @@ -127,10 +127,10 @@ /** * Sets the generator for the item labels that appear near the lower * y-value and sends a {@link RendererChangeEvent} to all registered - * listeners. If this is set to <code>null</code>, no item labels will be + * listeners. If this is set to {@code null}, no item labels will be * drawn. * - * @param generator the generator (<code>null</code> permitted). + * @param generator the generator ({@code null} permitted). * * @see #getAdditionalItemLabelGenerator() * @@ -146,10 +146,9 @@ * Returns the range of values the renderer requires to display all the * items from the specified dataset. * - * @param dataset the dataset (<code>null</code> permitted). + * @param dataset the dataset ({@code null} permitted). * - * @return The range (<code>null</code> if the dataset is <code>null</code> - * or empty). + * @return The range ({@code null} if the dataset is {@code null} or empty). */ @Override public Range findRangeBounds(XYDataset dataset) { @@ -171,7 +170,7 @@ * @param series the series index (zero-based). * @param item the item index (zero-based). * @param crosshairState crosshair information for the plot - * (<code>null</code> permitted). + * ({@code null} permitted). * @param pass the pass index (ignored here). */ @Override @@ -180,6 +179,11 @@ ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { + // do nothing if item is not visible + if (!getItemVisible(series, item)) { + return; + } + // setup for collecting optional entity info... EntityCollection entities = null; if (info != null) { @@ -283,7 +287,7 @@ /** * Tests this renderer for equality with an arbitrary object. * - * @param obj the object (<code>null</code> permitted). + * @param obj the object ({@code null} permitted). * * @return A boolean. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2015-09-22 15:27:21
|
Revision: 3328 http://sourceforge.net/p/jfreechart/code/3328 Author: mungady Date: 2015-09-22 15:27:19 +0000 (Tue, 22 Sep 2015) Log Message: ----------- 2015-09-22 David Gilbert <dav...@ob...> * org/jfree/data/general/DatasetUtilities.java (iterateToFindDomainBounds): Check for x-value outside interval, (iterateToFindRangeBounds): Check for y-value outside interval. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/general/DatasetUtilities.java branches/jfreechart-1.0.x-branch/tests/org/jfree/data/general/DatasetUtilitiesTest.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/general/DatasetUtilities.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/general/DatasetUtilities.java 2015-09-11 04:27:51 UTC (rev 3327) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/general/DatasetUtilities.java 2015-09-22 15:27:19 UTC (rev 3328) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------------- * DatasetUtilities.java * --------------------- - * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Andrzej Porebski (bug fix); @@ -123,7 +123,8 @@ * 10-Sep-2009 : Fix bug 2849731 for IntervalCategoryDataset (DG); * 16-Feb-2010 : Patch 2952086 - find z-bounds (MH); * 02-Jul-2013 : Use ParamChecks (DG); - * + * 22-Sep-2015 : Fix bugs in iterateToFindDomainBounds() and + * iterateToFindRangeBounds() (DG); */ package org.jfree.data.general; @@ -173,10 +174,10 @@ /** * Calculates the total of all the values in a {@link PieDataset}. If - * the dataset contains negative or <code>null</code> values, they are + * the dataset contains negative or {@code null} values, they are * ignored. * - * @param dataset the dataset (<code>null</code> not permitted). + * @param dataset the dataset ({@code null} not permitted). * * @return The total. */ @@ -205,13 +206,13 @@ * Creates a pie dataset from a table dataset by taking all the values * for a single row. * - * @param dataset the dataset (<code>null</code> not permitted). + * @param dataset the dataset ({@code null} not permitted). * @param rowKey the row key. * * @return A pie dataset. */ public static PieDataset createPieDatasetForRow(CategoryDataset dataset, - Comparable rowKey) { + Comparable rowKey) { int row = dataset.getRowIndex(rowKey); return createPieDatasetForRow(dataset, row); } @@ -220,13 +221,13 @@ * Creates a pie dataset from a table dataset by taking all the values * for a single row. * - * @param dataset the dataset (<code>null</code> not permitted). + * @param dataset the dataset ({@code null} not permitted). * @param row the row (zero-based index). * * @return A pie dataset. */ public static PieDataset createPieDatasetForRow(CategoryDataset dataset, - int row) { + int row) { DefaultPieDataset result = new DefaultPieDataset(); int columnCount = dataset.getColumnCount(); for (int current = 0; current < columnCount; current++) { @@ -240,13 +241,13 @@ * Creates a pie dataset from a table dataset by taking all the values * for a single column. * - * @param dataset the dataset (<code>null</code> not permitted). + * @param dataset the dataset ({@code null} not permitted). * @param columnKey the column key. * * @return A pie dataset. */ public static PieDataset createPieDatasetForColumn(CategoryDataset dataset, - Comparable columnKey) { + Comparable columnKey) { int column = dataset.getColumnIndex(columnKey); return createPieDatasetForColumn(dataset, column); } @@ -255,13 +256,13 @@ * Creates a pie dataset from a {@link CategoryDataset} by taking all the * values for a single column. * - * @param dataset the dataset (<code>null</code> not permitted). + * @param dataset the dataset ({@code null} not permitted). * @param column the column (zero-based index). * * @return A pie dataset. */ public static PieDataset createPieDatasetForColumn(CategoryDataset dataset, - int column) { + int column) { DefaultPieDataset result = new DefaultPieDataset(); int rowCount = dataset.getRowCount(); for (int i = 0; i < rowCount; i++) { @@ -277,8 +278,8 @@ * than the <code>percentThreshold</code>) into a single item with the * key "Other". * - * @param source the source dataset (<code>null</code> not permitted). - * @param key a new key for the aggregated items (<code>null</code> not + * @param source the source dataset ({@code null} not permitted). + * @param key a new key for the aggregated items ({@code null} not * permitted). * @param minimumPercent the percent threshold. * @@ -297,7 +298,7 @@ * aggregated items are assigned the specified key. Aggregation only * occurs if there are at least <code>minItems</code> items to aggregate. * - * @param source the source dataset (<code>null</code> not permitted). + * @param source the source dataset ({@code null} not permitted). * @param key the key to represent the aggregated items. * @param minimumPercent the percent threshold (ten percent is 0.10). * @param minItems only aggregate low values if there are at least this @@ -415,8 +416,8 @@ * <p> * Row and column keys are taken from the supplied arrays. * - * @param rowKeys the row keys (<code>null</code> not permitted). - * @param columnKeys the column keys (<code>null</code> not permitted). + * @param rowKeys the row keys ({@code null} not permitted). + * @param columnKeys the column keys ({@code null} not permitted). * @param data the data. * * @return The dataset. @@ -465,8 +466,8 @@ * Creates a {@link CategoryDataset} by copying the data from the supplied * {@link KeyedValues} instance. * - * @param rowKey the row key (<code>null</code> not permitted). - * @param rowData the row data (<code>null</code> not permitted). + * @param rowKey the row key ({@code null} not permitted). + * @param rowData the row data ({@code null} not permitted). * * @return A dataset. */ @@ -487,12 +488,12 @@ * Creates an {@link XYDataset} by sampling the specified function over a * fixed range. * - * @param f the function (<code>null</code> not permitted). + * @param f the function ({@code null} not permitted). * @param start the start value for the range. * @param end the end value for the range. * @param samples the number of sample points (must be > 1). - * @param seriesKey the key to give the resulting series - * (<code>null</code> not permitted). + * @param seriesKey the key to give the resulting series ({@code null} not + * permitted). * * @return A dataset. */ @@ -510,12 +511,12 @@ * Creates an {@link XYSeries} by sampling the specified function over a * fixed range. * - * @param f the function (<code>null</code> not permitted). + * @param f the function ({@code null} not permitted). * @param start the start value for the range. * @param end the end value for the range. * @param samples the number of sample points (must be > 1). * @param seriesKey the key to give the resulting series - * (<code>null</code> not permitted). + * ({@code null} not permitted). * * @return A series. * @@ -1376,14 +1377,14 @@ * Returns the range of x-values in the specified dataset for the * data items belonging to the visible series. * - * @param dataset the dataset (<code>null</code> not permitted). - * @param visibleSeriesKeys the visible series keys (<code>null</code> not + * @param dataset the dataset ({@code null} not permitted). + * @param visibleSeriesKeys the visible series keys ({@code null} not * permitted). * @param includeInterval a flag that determines whether or not the * y-interval for the dataset is included (this only applies if the * dataset is an instance of IntervalXYDataset). * - * @return The x-range (possibly <code>null</code>). + * @return The x-range (possibly {@code null}). * * @since 1.0.13 */ @@ -1404,8 +1405,13 @@ int series = dataset.indexOf(seriesKey); int itemCount = dataset.getItemCount(series); for (int item = 0; item < itemCount; item++) { + double xvalue = ixyd.getXValue(series, item); double lvalue = ixyd.getStartXValue(series, item); double uvalue = ixyd.getEndXValue(series, item); + if (!Double.isNaN(xvalue)) { + minimum = Math.min(minimum, xvalue); + maximum = Math.max(maximum, xvalue); + } if (!Double.isNaN(lvalue)) { minimum = Math.min(minimum, lvalue); } @@ -1414,8 +1420,7 @@ } } } - } - else { + } else { // standard case - plain XYDataset Iterator iterator = visibleSeriesKeys.iterator(); while (iterator.hasNext()) { @@ -1434,8 +1439,7 @@ if (minimum == Double.POSITIVE_INFINITY) { return null; - } - else { + } else { return new Range(minimum, maximum); } } @@ -1445,15 +1449,15 @@ * data items belonging to the visible series and with x-values in the * given range. * - * @param dataset the dataset (<code>null</code> not permitted). - * @param visibleSeriesKeys the visible series keys (<code>null</code> not + * @param dataset the dataset ({@code null} not permitted). + * @param visibleSeriesKeys the visible series keys ({@code null} not * permitted). - * @param xRange the x-range (<code>null</code> not permitted). + * @param xRange the x-range ({@code null} not permitted). * @param includeInterval a flag that determines whether or not the * y-interval for the dataset is included (this only applies if the * dataset is an instance of IntervalXYDataset). * - * @return The y-range (possibly <code>null</code>). + * @return The y-range (possibly {@code null}). * * @since 1.0.13 */ @@ -1525,8 +1529,13 @@ for (int item = 0; item < itemCount; item++) { double x = ixyd.getXValue(series, item); if (xRange.contains(x)) { + double yvalue = ixyd.getYValue(series, item); double lvalue = ixyd.getStartYValue(series, item); double uvalue = ixyd.getEndYValue(series, item); + if (!Double.isNaN(yvalue)) { + minimum = Math.min(minimum, yvalue); + maximum = Math.max(maximum, yvalue); + } if (!Double.isNaN(lvalue)) { minimum = Math.min(minimum, lvalue); } @@ -1536,8 +1545,7 @@ } } } - } - else { + } else { // standard case - plain XYDataset Iterator iterator = visibleSeriesKeys.iterator(); while (iterator.hasNext()) { @@ -1558,8 +1566,7 @@ } if (minimum == Double.POSITIVE_INFINITY) { return null; - } - else { + } else { return new Range(minimum, maximum); } } @@ -1569,15 +1576,15 @@ * data items belonging to the visible series and with x-values in the * given range. * - * @param dataset the dataset (<code>null</code> not permitted). - * @param visibleSeriesKeys the visible series keys (<code>null</code> not + * @param dataset the dataset ({@code null} not permitted). + * @param visibleSeriesKeys the visible series keys ({@code null} not * permitted). - * @param xRange the x-range (<code>null</code> not permitted). + * @param xRange the x-range ({@code null} not permitted). * @param includeInterval a flag that determines whether or not the * z-interval for the dataset is included (this only applies if the * dataset has an interval, which is currently not supported). * - * @return The y-range (possibly <code>null</code>). + * @return The y-range (possibly {@code null}). */ public static Range iterateToFindZBounds(XYZDataset dataset, List visibleSeriesKeys, Range xRange, boolean includeInterval) { @@ -1607,8 +1614,7 @@ if (minimum == Double.POSITIVE_INFINITY) { return null; - } - else { + } else { return new Range(minimum, maximum); } } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/data/general/DatasetUtilitiesTest.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/data/general/DatasetUtilitiesTest.java 2015-09-11 04:27:51 UTC (rev 3327) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/data/general/DatasetUtilitiesTest.java 2015-09-22 15:27:19 UTC (rev 3328) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * ------------------------- * DatasetUtilitiesTest.java * ------------------------- - * (C) Copyright 2003-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2003-2015, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -173,6 +173,27 @@ } /** + * This test checks that the correct values are returned if the x and + * y values fall outside the intervals. + */ + @Test + public void testFindDomainBounds4() { + DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset(); + double[] x1 = new double[] {0.8, 3.2, 3.0}; + double[] x1Start = new double[] {0.9, 1.9, 2.9}; + double[] x1End = new double[] {1.1, 2.1, 3.1}; + double[] y1 = new double[] {4.0, 5.0, 6.0}; + double[] y1Start = new double[] {1.09, 2.09, 3.09}; + double[] y1End = new double[] {1.11, 2.11, 3.11}; + double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start, + y1End}; + dataset.addSeries("S1", data1); + Range r = DatasetUtilities.findDomainBounds(dataset); + assertEquals(0.8, r.getLowerBound(), EPSILON); + assertEquals(3.2, r.getUpperBound(), EPSILON); + } + + /** * This test checks that NaN values are ignored. */ @Test @@ -1040,6 +1061,50 @@ } /** + * This test checks that the correct values are returned if the x-values + * fall outside the intervals (it is not required that they do). + */ + @Test + public void testIterateToFindDomainBounds_IntervalXYDataset() { + DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset(); + double[] x1 = new double[] {0.8, 3.2, 3.0}; + double[] x1Start = new double[] {0.9, 1.9, 2.9}; + double[] x1End = new double[] {1.1, 2.1, 3.1}; + double[] y1 = new double[] {4.0, 5.0, 6.0}; + double[] y1Start = new double[] {1.09, 2.09, 3.09}; + double[] y1End = new double[] {1.11, 2.11, 3.11}; + double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start, + y1End}; + dataset.addSeries("S1", data1); + Range r = DatasetUtilities.iterateToFindDomainBounds(dataset, + Arrays.asList("S1"), true); + assertEquals(0.8, r.getLowerBound(), EPSILON); + assertEquals(3.2, r.getUpperBound(), EPSILON); + } + + /** + * This test checks that the correct values are returned if the y-values + * fall outside the intervals (it is not required that they do). + */ + @Test + public void testIterateToFindRangeBounds_IntervalXYDataset() { + DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset(); + double[] x1 = new double[] {0.8, 3.2, 3.0}; + double[] x1Start = new double[] {0.9, 1.9, 2.9}; + double[] x1End = new double[] {1.1, 2.1, 3.1}; + double[] y1 = new double[] {4.0, -5.0, 6.0}; + double[] y1Start = new double[] {1.09, 2.09, 3.09}; + double[] y1End = new double[] {1.11, 2.11, 3.11}; + double[][] data1 = new double[][] {x1, x1Start, x1End, y1, y1Start, + y1End}; + dataset.addSeries("S1", data1); + Range r = DatasetUtilities.iterateToFindRangeBounds(dataset, + Arrays.asList("S1"), new Range(0.0, 4.0), true); + assertEquals(-5.0, r.getLowerBound(), EPSILON); + assertEquals(6.0, r.getUpperBound(), EPSILON); + } + + /** * Some checks for the iteratorToFindRangeBounds(XYDataset...) method. */ @Test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2015-11-24 17:17:39
|
Revision: 3330 http://sourceforge.net/p/jfreechart/code/3330 Author: mungady Date: 2015-11-24 17:17:36 +0000 (Tue, 24 Nov 2015) Log Message: ----------- 2015-11-23 David Gilbert <dav...@ob...> * org/jfree/chart/util/ParamChecks.java (requireInRange): New method, * org/jfree/data/time/Second.java (Second(int, Minute)) : Check argument is in range. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ParamChecks.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Second.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2015-09-22 15:27:35 UTC (rev 3329) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2015-11-24 17:17:36 UTC (rev 3330) @@ -1,3 +1,10 @@ +2015-11-23 David Gilbert <dav...@ob...> + + * org/jfree/chart/util/ParamChecks.java + (requireInRange): New method, + * org/jfree/data/time/Second.java + (Second(int, Minute)) : Check argument is in range. + 2015-09-22 David Gilbert <dav...@ob...> * org/jfree/data/general/DatasetUtilities.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ParamChecks.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ParamChecks.java 2015-09-22 15:27:35 UTC (rev 3329) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ParamChecks.java 2015-11-24 17:17:36 UTC (rev 3330) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * ---------------- * ParamChecks.java * ---------------- - * (C) Copyright 2011, by Object Refinery Limited. + * (C) Copyright 2011-2015, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -35,6 +35,7 @@ * Changes * ------- * 16-Oct-2011 : Version 1 (DG); + * 23-Nov-2015 : Added requireInRange() method (DG); * */ @@ -80,4 +81,24 @@ + value + ") to be non-negative."); } } + + /** + * Checks that the value falls within the specified range and, if it does + * not, throws an {@code IllegalArgumentException}. + * + * @param value the value. + * @param name the parameter name. + * @param lowerBound the lower bound of the permitted range. + * @param upperBound the upper bound fo the permitted range. + * + * @since 1.0.20 + */ + public static void requireInRange(int value, String name, + int lowerBound, int upperBound) { + if (value < lowerBound) { + throw new IllegalArgumentException("Require '" + name + "' (" + + value + ") to be in the range " + lowerBound + " to " + + upperBound); + } + } } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Second.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Second.java 2015-09-22 15:27:35 UTC (rev 3329) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Second.java 2015-11-24 17:17:36 UTC (rev 3330) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2015, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * ----------- * Second.java * ----------- - * (C) Copyright 2001-2013, by Object Refinery Limited. + * (C) Copyright 2001-2015, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -112,10 +112,12 @@ /** * Constructs a new Second. * - * @param second the second (0 to 24*60*60-1). - * @param minute the minute (<code>null</code> not permitted). + * @param second the second (0 to 59). + * @param minute the minute ({@code null} not permitted). */ public Second(int second, Minute minute) { + ParamChecks.requireInRange(second, "second", + Second.FIRST_SECOND_IN_MINUTE, Second.LAST_SECOND_IN_MINUTE); ParamChecks.nullNotPermitted(minute, "minute"); this.day = minute.getDay(); this.hour = (byte) minute.getHourValue(); @@ -141,9 +143,9 @@ /** * Constructs a new instance from the specified date/time and the default - * time zone.. + * time zone. * - * @param time the time (<code>null</code> not permitted). + * @param time the time ({@code null} not permitted). * * @see #Second(Date, TimeZone) */ @@ -167,9 +169,9 @@ /** * Creates a new second based on the supplied time and time zone. * - * @param time the time (<code>null</code> not permitted). - * @param zone the time zone (<code>null</code> not permitted). - * @param locale the locale (<code>null</code> not permitted). + * @param time the time ({@code null} not permitted). + * @param zone the time zone ({@code null} not permitted). + * @param locale the locale ({@code null} not permitted). * * @since 1.0.13 */ @@ -195,7 +197,7 @@ /** * Returns the minute. * - * @return The minute (never <code>null</code>). + * @return The minute (never {@code null}). */ public Minute getMinute() { return new Minute(this.minute, new Hour(this.hour, this.day)); @@ -235,7 +237,7 @@ * Recalculates the start date/time and end date/time for this time period * relative to the supplied calendar (which incorporates a time zone). * - * @param calendar the calendar (<code>null</code> not permitted). + * @param calendar the calendar ({@code null} not permitted). * * @since 1.0.3 */ @@ -299,12 +301,11 @@ /** * Returns the first millisecond of the minute. * - * @param calendar the calendar/timezone (<code>null</code> not permitted). + * @param calendar the calendar/timezone ({@code null} not permitted). * * @return The first millisecond. * - * @throws NullPointerException if <code>calendar</code> is - * <code>null</code>. + * @throws NullPointerException if {@code calendar} is {@code null}. */ @Override public long getFirstMillisecond(Calendar calendar) { @@ -320,12 +321,11 @@ /** * Returns the last millisecond of the second. * - * @param calendar the calendar/timezone (<code>null</code> not permitted). + * @param calendar the calendar/timezone ({@code null} not permitted). * * @return The last millisecond. * - * @throws NullPointerException if <code>calendar</code> is - * <code>null</code>. + * @throws NullPointerException if {@code calendar} is {@code null}. */ @Override public long getLastMillisecond(Calendar calendar) { @@ -338,9 +338,9 @@ * This method will return true ONLY if the object is a Second object * representing the same second as this instance. * - * @param obj the object to compare (<code>null</code> permitted). + * @param obj the object to compare ({@code null} permitted). * - * @return <code>true</code> if second and minute of this and the object + * @return {@code true} if second and minute of this and the object * are the same. */ @Override @@ -438,7 +438,7 @@ * * @param s the string to parse. * - * @return The second, or <code>null</code> if the string is not parseable. + * @return The second, or {@code null} if the string is not parseable. */ public static Second parseSecond(String s) { Second result = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |