org.jfree.chart.renderer.PaintScale Java Examples
The following examples show how to use
org.jfree.chart.renderer.PaintScale.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaintScaleLegend.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { if (axis == null) { throw new IllegalArgumentException("Null 'axis' argument."); } this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #2
Source File: HeatMapUtilities.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #3
Source File: HeatMapUtilities.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { if (dataset == null) { throw new IllegalArgumentException("Null 'dataset' argument."); } if (paintScale == null) { throw new IllegalArgumentException("Null 'paintScale' argument."); } int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #4
Source File: PaintScaleLegend.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #5
Source File: PaintScaleLegend.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #6
Source File: HeatMapUtilities.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #7
Source File: PaintScaleLegend.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #8
Source File: PaintScaleLegend.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #9
Source File: HeatMapUtilities.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #10
Source File: HeatMapUtilities.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #11
Source File: PaintScaleLegend.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #12
Source File: PaintScaleLegend.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); this.scale = scale; this.axis = axis; this.axis.addChangeListener(this); this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.axis.setRange(scale.getLowerBound(), scale.getUpperBound()); this.stripWidth = 15.0; this.stripOutlineVisible = true; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; this.subdivisions = 100; }
Example #13
Source File: HeatMapUtilities.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #14
Source File: HeatMapUtilities.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates an image that displays the values from the specified dataset. * * @param dataset the dataset (<code>null</code> not permitted). * @param paintScale the paint scale for the z-values (<code>null</code> * not permitted). * * @return A buffered image. */ public static BufferedImage createHeatMapImage(HeatMapDataset dataset, PaintScale paintScale) { ParamChecks.nullNotPermitted(dataset, "dataset"); ParamChecks.nullNotPermitted(paintScale, "paintScale"); int xCount = dataset.getXSampleCount(); int yCount = dataset.getYSampleCount(); BufferedImage image = new BufferedImage(xCount, yCount, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); for (int xIndex = 0; xIndex < xCount; xIndex++) { for (int yIndex = 0; yIndex < yCount; yIndex++) { double z = dataset.getZValue(xIndex, yIndex); Paint p = paintScale.getPaint(z); g2.setPaint(p); g2.fillRect(xIndex, yCount - yIndex - 1, 1, 1); } } return image; }
Example #15
Source File: PaintScaleLegend.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { if (axis == null) { throw new IllegalArgumentException("Null 'axis' argument."); } this.scale = scale; this.axis = axis; this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.stripWidth = 15.0; this.stripOutlineVisible = false; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; }
Example #16
Source File: RTMZRenderer.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public RTMZRenderer(AbstractXYZDataset dataset, PaintScale paintScale) { super(false, true); this.dataset = dataset; this.paintScale = paintScale; this.setSeriesShape(0, dataPointsShape); setDrawSeriesLineAsPath(true); }
Example #17
Source File: PaintScaleLegend.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a new instance. * * @param scale the scale (<code>null</code> not permitted). * @param axis the axis (<code>null</code> not permitted). */ public PaintScaleLegend(PaintScale scale, ValueAxis axis) { if (axis == null) { throw new IllegalArgumentException("Null 'axis' argument."); } this.scale = scale; this.axis = axis; this.axisLocation = AxisLocation.BOTTOM_OR_LEFT; this.axisOffset = 0.0; this.stripWidth = 15.0; this.stripOutlineVisible = false; this.stripOutlinePaint = Color.gray; this.stripOutlineStroke = new BasicStroke(0.5f); this.backgroundPaint = Color.white; }
Example #18
Source File: RTMZRenderer.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
public RTMZRenderer(AbstractXYZDataset dataset, PaintScale paintScale) { super(false, true); this.dataset = dataset; this.paintScale = paintScale; this.setSeriesShape(0, dataPointsShape); setDrawSeriesLineAsPath(true); }
Example #19
Source File: RTMZRenderer.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
void setPaintScale(PaintScale paintScale) { this.paintScale = paintScale; }
Example #20
Source File: RTMZRenderer.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
void setPaintScale(PaintScale paintScale) { this.paintScale = paintScale; }
Example #21
Source File: PlotUtil.java From dl4j-tutorials with MIT License | 4 votes |
private static JFreeChart createChart(XYZDataset dataset, double[] mins, double[] maxs, int nPoints, XYDataset xyData) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setRange(mins[0],maxs[0]); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setRange(mins[1], maxs[1]); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth((maxs[0]-mins[0])/(nPoints-1)); renderer.setBlockHeight((maxs[1] - mins[1]) / (nPoints - 1)); PaintScale scale = new GrayPaintScale(0, 1.0); renderer.setPaintScale(scale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); JFreeChart chart = new JFreeChart("", plot); chart.getXYPlot().getRenderer().setSeriesVisibleInLegend(0, false); NumberAxis scaleAxis = new NumberAxis("Probability (class 0)"); scaleAxis.setAxisLinePaint(Color.white); scaleAxis.setTickMarkPaint(Color.white); scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7)); PaintScaleLegend legend = new PaintScaleLegend(new GrayPaintScale(), scaleAxis); legend.setStripOutlineVisible(false); legend.setSubdivisionCount(20); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.red)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10); legend.setPosition(RectangleEdge.LEFT); chart.addSubtitle(legend); ChartUtilities.applyCurrentTheme(chart); plot.setDataset(1, xyData); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setBaseLinesVisible(false); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #22
Source File: XYBlockRenderer.java From astor with GNU General Public License v2.0 | 3 votes |
/** * 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). * * @see #getPaintScale() * @since 1.0.4 */ public void setPaintScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.paintScale = scale; fireChangeEvent(); }
Example #23
Source File: XYShapeRenderer.java From astor with GNU General Public License v2.0 | 3 votes |
/** * 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). * * @see #getPaintScale() */ public void setPaintScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.paintScale = scale; notifyListeners(new RendererChangeEvent(this)); }
Example #24
Source File: PaintScaleLegend.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the scale and sends a {@link TitleChangeEvent} to all registered * listeners. * * @param scale the scale (<code>null</code> not permitted). * * @see #getScale() */ public void setScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.scale = scale; notifyListeners(new TitleChangeEvent(this)); }
Example #25
Source File: XYBlockRenderer.java From astor with GNU General Public License v2.0 | 3 votes |
/** * 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). * * @see #getPaintScale() * @since 1.0.4 */ public void setPaintScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.paintScale = scale; fireChangeEvent(); }
Example #26
Source File: PaintScaleLegend.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the scale and sends a {@link TitleChangeEvent} to all registered * listeners. * * @param scale the scale (<code>null</code> not permitted). * * @see #getScale() */ public void setScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.scale = scale; notifyListeners(new TitleChangeEvent(this)); }
Example #27
Source File: PaintScaleLegend.java From opensim-gui with Apache License 2.0 | 3 votes |
/** * Sets the scale and sends a {@link TitleChangeEvent} to all registered * listeners. * * @param scale the scale (<code>null</code> not permitted). * * @see #getScale() */ public void setScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.scale = scale; notifyListeners(new TitleChangeEvent(this)); }
Example #28
Source File: XYBlockRenderer.java From opensim-gui with Apache License 2.0 | 3 votes |
/** * Sets the paint scale used by the renderer. * * @param scale the scale (<code>null</code> not permitted). * * @see #getPaintScale() * @since 1.0.4 */ public void setPaintScale(PaintScale scale) { if (scale == null) { throw new IllegalArgumentException("Null 'scale' argument."); } this.paintScale = scale; notifyListeners(new RendererChangeEvent(this)); }
Example #29
Source File: PaintScaleLegend.java From buffer_bci with GNU General Public License v3.0 | 2 votes |
/** * Returns the scale used to convert values to colors. * * @return The scale (never <code>null</code>). * * @see #setScale(PaintScale) */ public PaintScale getScale() { return this.scale; }
Example #30
Source File: XYBlockRenderer.java From buffer_bci with GNU General Public License v3.0 | 2 votes |
/** * 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). * * @see #getPaintScale() * @since 1.0.4 */ public void setPaintScale(PaintScale scale) { ParamChecks.nullNotPermitted(scale, "scale"); this.paintScale = scale; fireChangeEvent(); }