List of usage examples for org.jfree.chart.plot XYPlot setRangeZeroBaselineVisible
public void setRangeZeroBaselineVisible(boolean visible)
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a scatter plot./*from w w w.java2 s .c o m*/ * * @param dataset * @param header * @param xAxis * @param yAxis * @return */ public JFreeChart createScatterPlot(XYDataset dataset, String header, String xAxis, String yAxis) { JFreeChart chart = ChartFactory.createScatterPlot(header, xAxis, yAxis, dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); XYLineAnnotation annotation = new XYLineAnnotation(-1000000, -1000000, 1000000, 1000000); plot.addAnnotation(annotation); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.black); renderer.setUseOutlinePaint(true); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(0.0f); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(0.0f); return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a residue plot.// ww w . ja v a 2 s .c o m * * @param yValues * @param header * @param xAxis * @param yAxis * @param seriesNames * @return */ public JFreeChart createResiduePlot(List<Double[]> yValues, String header, String xAxis, String yAxis, List<String> seriesNames) { LinkedList<XYLineAnnotation> lines = new LinkedList<XYLineAnnotation>(); DefaultXYDataset xyDataSet = new DefaultXYDataset(); for (int j = 0; j < yValues.size(); j++) { XYSeries series = new XYSeries(seriesNames.get(j)); for (int i = 0; i < yValues.get(j).length; i++) { series.add(i + 1, yValues.get(j)[i]); float dash[] = { 10.0f }; BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f); XYLineAnnotation annotation = new XYLineAnnotation(i + 1, 0, i + 1, yValues.get(j)[i], stroke, Color.BLUE); lines.add(annotation); } xyDataSet.addSeries(seriesNames.get(j), series.toArray()); } JFreeChart chart = ChartFactory.createScatterPlot(header, xAxis, yAxis, xyDataSet, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); for (int i = 0; i < lines.size(); i++) { plot.addAnnotation(lines.get(i)); } XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.black); renderer.setUseOutlinePaint(true); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(0.0f); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(0.0f); return chart; }
From source file:net.sf.maltcms.chromaui.foldChangeViewer.tasks.FoldChangeViewLoaderWorker.java
private void configurePlot(XYPlot plot, RTUnit rtAxisUnit) { NumberAxis domainAxis = null;//from w w w . j a v a 2 s .co m if (plot.getDomainAxis() == null) { domainAxis = new NumberAxis("log2 fold change"); plot.setDomainAxis(domainAxis); } else { domainAxis = (NumberAxis) plot.getDomainAxis(); } // domainAxis.setNumberFormatOverride(new RTNumberFormatter(rtAxisUnit)); // domainAxis.setLabel("RT[" + rtAxisUnit.name().toLowerCase() + "]"); plot.setRangeZeroBaselineVisible(true); plot.setDomainZeroBaselineVisible(true); domainAxis.setAutoRange(true); domainAxis.setAutoRangeIncludesZero(false); NumberAxis rangeAxis = null; if (plot.getRangeAxis() == null) { rangeAxis = new NumberAxis("-log10 p-value"); plot.setRangeAxis(rangeAxis); } else { rangeAxis = (NumberAxis) plot.getRangeAxis(); } rangeAxis.setAutoRange(true); rangeAxis.setAutoRangeIncludesZero(true); Logger.getLogger(getClass().getName()).info("Adding chart"); plot.setBackgroundPaint(Color.WHITE); ChartCustomizer.setSeriesColors(plot, 0.8f); }
From source file:desmoj.extensions.grafic.util.Plotter.java
/** * Build a JPanel with plotType of a DesmoJ time-series dataset. * When allowMultipleValues is set, multiple range values of a time value are allowed. * In the opposite Case only the last range value of a time value is accepted. * In the case ts.getShowTimeSpansInReport() the data values are interpreted as * a timespan in a appropriate time unit. * @param ts DesmoJ time-series dataset * @param plotType possible Values: * Plotter.TimeSeries_ScatterPlot, * Plotter.TimeSeries_StepChart * Plotter.TimeSeries_LinePlot * @param allowMultipleValues/*from ww w. j a v a2s . c o m*/ * @return */ private JPanel getTimeSeriesPanel(TimeSeries ts, int plotType, boolean allowMultipleValues) { JFreeChart chart; TimeSeriesDataSetAdapter dataset = new TimeSeriesDataSetAdapter(ts, allowMultipleValues); switch (plotType) { case Plotter.TimeSeries_LineChart: chart = ChartFactory.createXYLineChart(ts.getName(), "Time", "Observation", dataset, PlotOrientation.VERTICAL, false, false, false); break; case Plotter.TimeSeries_ScatterPlot: chart = ChartFactory.createScatterPlot(ts.getName(), "Time", "Observation", dataset, PlotOrientation.VERTICAL, false, false, false); break; case Plotter.TimeSeries_StepChart: chart = ChartFactory.createXYStepChart(ts.getName(), "Time", "Observation", dataset, PlotOrientation.VERTICAL, false, false, false); break; default: chart = ChartFactory.createScatterPlot(ts.getName(), "Time", "Observation", dataset, PlotOrientation.VERTICAL, false, false, false); break; } if (ts.getDescription() != null) chart.setTitle(ts.getDescription()); XYPlot xyplot = (XYPlot) chart.getPlot(); xyplot.setNoDataMessage("NO DATA"); if (ts.getShowTimeSpansInReport() && !dataset.isValid()) xyplot.setNoDataMessage("NO VALID TIMESPANS"); xyplot.setDomainZeroBaselineVisible(false); xyplot.setRangeZeroBaselineVisible(false); DateAxis dateAxis = new DateAxis(); xyplot.setDomainAxis(dateAxis); this.configureDomainAxis(dateAxis); String numberLabel; if (!dataset.isValid()) numberLabel = "Unit: invalid"; else if (ts.getShowTimeSpansInReport()) numberLabel = "Unit: timespan [" + dataset.getRangeTimeUnit().name() + "]"; else if (ts.getUnit() != null) numberLabel = "Unit: [" + ts.getUnit() + "]"; else numberLabel = "Unit: unknown"; NumberAxis numberAxis = new NumberAxis(); xyplot.setRangeAxis(numberAxis); this.configureRangeAxis(numberAxis, numberLabel); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setSeriesOutlinePaint(0, Color.black); xylineandshaperenderer.setUseOutlinePaint(true); ChartPanel panel = new ChartPanel(chart); panel.setVerticalAxisTrace(false); panel.setHorizontalAxisTrace(false); panel.setPopupMenu(null); panel.setDomainZoomable(false); panel.setRangeZoomable(false); return panel; }
From source file:org.gwaspi.gui.reports.SampleQAHetzygPlotZoom.java
private JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createScatterPlot("Heterozygosity vs. Missing Ratio", "Heterozygosity Ratio", "Missing Ratio", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); // CHART BACKGROUD COLOR chart.setBackgroundPaint(Color.getHSBColor(0.1f, 0.1f, 1.0f)); // Hue, saturation, brightness plot.setBackgroundPaint(PLOT_MANHATTAN_BACKGROUND); // Hue, saturation, brightness 9 // GRIDLINES//from ww w .jav a 2 s . co m plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlineStroke(new BasicStroke(0.0f)); plot.setDomainGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker().darker()); // Hue, saturation, brightness 7 plot.setDomainMinorGridlinePaint(PLOT_MANHATTAN_BACKGROUND); // Hue, saturation, brightness 9 plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setRangeMinorGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker().darker()); // Hue, saturation, brightness 7 plot.setRangeMinorGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker()); // Hue, saturation, brightness 8 plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); // DOTS RENDERER XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, PLOT_MANHATTAN_DOTS); // renderer.setSeriesOutlinePaint(0, Color.DARK_GRAY); // renderer.setUseOutlinePaint(true); // Set dot shape of the currently appended Series renderer.setSeriesShape(0, new Rectangle2D.Double(-1, -1, 2, 2)); renderer.setSeriesVisibleInLegend(0, false); // AXIS double maxHetzy = 0.005; for (int i = 0; i < dataset.getItemCount(0); i++) { if (maxHetzy < dataset.getXValue(0, i)) { maxHetzy = dataset.getXValue(0, i); } } NumberAxis hetzyAxis = (NumberAxis) plot.getDomainAxis(); hetzyAxis.setAutoRangeIncludesZero(true); hetzyAxis.setAxisLineVisible(true); hetzyAxis.setTickLabelsVisible(true); hetzyAxis.setTickMarksVisible(true); hetzyAxis.setRange(0, maxHetzy * 1.1); double maxMissrat = 0.005; for (int i = 0; i < dataset.getItemCount(0); i++) { if (maxMissrat < dataset.getYValue(0, i)) { maxMissrat = dataset.getYValue(0, i); } } NumberAxis missratAxis = (NumberAxis) plot.getRangeAxis(); missratAxis.setAutoRangeIncludesZero(true); missratAxis.setAxisLineVisible(true); missratAxis.setTickLabelsVisible(true); missratAxis.setTickMarksVisible(true); missratAxis.setRange(0, maxMissrat * 1.1); // Add significance Threshold to subplot final Marker missingThresholdLine = new ValueMarker(missingThreshold); missingThresholdLine.setPaint(Color.blue); final Marker hetzyThresholdLine = new ValueMarker(hetzyThreshold); hetzyThresholdLine.setPaint(Color.blue); // Add legend to hetzyThreshold hetzyThresholdLine.setLabel("hetzyg. threshold = " + hetzyThreshold); missingThresholdLine.setLabel("missing. threshold = " + missingThreshold); hetzyThresholdLine.setLabelAnchor(RectangleAnchor.TOP_LEFT); hetzyThresholdLine.setLabelTextAnchor(TextAnchor.TOP_RIGHT); missingThresholdLine.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT); missingThresholdLine.setLabelTextAnchor(TextAnchor.TOP_LEFT); plot.addRangeMarker(missingThresholdLine); // THIS FOR MISSING RATIO plot.addDomainMarker(hetzyThresholdLine); // THIS FOR HETZY RATIO // Marker label if below hetzyThreshold XYItemRenderer lblRenderer = plot.getRenderer(); // THRESHOLD AND SELECTED LABEL GENERATOR MySeriesItemLabelGenerator lblGenerator = new MySeriesItemLabelGenerator(hetzyThreshold, missingThreshold); lblRenderer.setSeriesItemLabelGenerator(0, lblGenerator); lblRenderer.setSeriesItemLabelFont(0, new Font("SansSerif", Font.PLAIN, 10)); lblRenderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, 2 * Math.PI)); // TOOLTIP GENERATOR MyXYToolTipGenerator tooltipGenerator = new MyXYToolTipGenerator(); lblRenderer.setBaseToolTipGenerator(tooltipGenerator); lblRenderer.setSeriesItemLabelsVisible(0, true); return chart; }
From source file:org.gwaspi.gui.reports.ManhattanPlotZoom.java
private JFreeChart createChart(XYDataset dataset, ChromosomeKey chr) { JFreeChart chart = ChartFactory.createScatterPlot(null, "", "P value", dataset, PlotOrientation.VERTICAL, true, false, false);/*from w ww . ja va 2s . co m*/ XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); // CHART BACKGROUD COLOR chart.setBackgroundPaint(Color.getHSBColor(0.1f, 0.1f, 1.0f)); // Hue, saturation, brightness plot.setBackgroundPaint(manhattan_back); // Hue, saturation, brightness 9 // GRIDLINES plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlineStroke(new BasicStroke(0.0f)); plot.setDomainGridlinePaint(manhattan_back.darker().darker()); // Hue, saturation, brightness 7 plot.setDomainMinorGridlinePaint(manhattan_back); // Hue, saturation, brightness 9 plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setRangeMinorGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlinePaint(manhattan_back.darker().darker()); // Hue, saturation, brightness 7 plot.setRangeMinorGridlinePaint(manhattan_back.darker()); // Hue, saturation, brightness 8 plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); // DOTS RENDERER XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, manhattan_dot); // renderer.setSeriesOutlinePaint(0, Color.DARK_GRAY); // renderer.setUseOutlinePaint(true); // Set dot shape of the currently appended Series renderer.setSeriesShape(0, new Rectangle2D.Double(0.0, 0.0, 2, 2)); renderer.setSeriesVisibleInLegend(0, false); NumberAxis positionAxis = (NumberAxis) plot.getDomainAxis(); // domainAxis.setAutoRangeIncludesZero(false); // domainAxis.setTickMarkInsideLength(2.0f); // domainAxis.setTickMarkOutsideLength(2.0f); // domainAxis.setMinorTickCount(2); // domainAxis.setMinorTickMarksVisible(true); positionAxis.setLabelAngle(1.0); positionAxis.setAutoRangeIncludesZero(false); positionAxis.setAxisLineVisible(true); positionAxis.setTickLabelsVisible(true); positionAxis.setTickMarksVisible(true); // ADD INVERSE LOG(10) Y AXIS LogAxis logPAxis = new LogAxis("P value"); logPAxis.setBase(10); logPAxis.setInverted(true); logPAxis.setNumberFormatOverride(GenericReportGenerator.FORMAT_P_VALUE); logPAxis.setTickMarkOutsideLength(2.0f); logPAxis.setMinorTickCount(2); logPAxis.setMinorTickMarksVisible(true); logPAxis.setAxisLineVisible(true); logPAxis.setUpperMargin(0); TickUnitSource units = NumberAxis.createIntegerTickUnits(); logPAxis.setStandardTickUnits(units); plot.setRangeAxis(0, logPAxis); // Add significance Threshold to subplot //threshold = 0.5/rdMatrixMetadata.getMarkerSetSize(); // (0.05/10? SNPs => 5*10-?) final Marker thresholdLine = new ValueMarker(threshold); thresholdLine.setPaint(Color.red); // Add legend to threshold thresholdLine.setLabel("P = " + GenericReportGenerator.FORMAT_P_VALUE.format(threshold)); thresholdLine.setLabelAnchor(RectangleAnchor.TOP_RIGHT); thresholdLine.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); plot.addRangeMarker(thresholdLine); // Marker label if below threshold XYItemRenderer lblRenderer = plot.getRenderer(); // THRESHOLD AND SELECTED LABEL GENERATOR MySeriesItemLabelGenerator lblGenerator = new MySeriesItemLabelGenerator(threshold, chr); lblRenderer.setSeriesItemLabelGenerator(0, lblGenerator); lblRenderer.setSeriesItemLabelFont(0, new Font("SansSerif", Font.PLAIN, 12)); lblRenderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.TOP_LEFT, TextAnchor.BOTTOM_LEFT, Math.PI / 4.0)); // TOOLTIP GENERATOR MyXYToolTipGenerator tooltipGenerator = new MyXYToolTipGenerator(chr); lblRenderer.setBaseToolTipGenerator(tooltipGenerator); lblRenderer.setSeriesItemLabelsVisible(0, true); return chart; }
From source file:KIDLYFactory.java
/** * Creates a histogram chart. This chart is constructed with an * {@link XYPlot} using an {@link XYBarRenderer}. The domain and range * axes are {@link NumberAxis} instances. * * @param title the chart title (<code>null</code> permitted). * @param xAxisLabel the x axis label (<code>null</code> permitted). * @param yAxisLabel the y axis label (<code>null</code> permitted). * @param dataset the dataset (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> NOT permitted). * @param legend create a legend?/*from w w w . ja v a 2 s . c o m*/ * @param tooltips display tooltips? * @param urls generate URLs? * * @return The chart. */ public static JFreeChart createHistogram(String title, String xAxisLabel, String yAxisLabel, IntervalXYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); ValueAxis yAxis = new NumberAxis(yAxisLabel); XYItemRenderer renderer = new XYBarRenderer(); if (tooltips) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); } if (urls) { renderer.setURLGenerator(new StandardXYURLGenerator()); } XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(orientation); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
From source file:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java
/** * *//*ww w. j a va 2 s. c o m*/ protected void configurePlot(Plot plot, JRChartPlot jrPlot) { super.configurePlot(plot, jrPlot); if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer(); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); } } categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f)); categoryPlot.setDomainGridlinesVisible(false); categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); } else if (plot instanceof XYPlot) { XYPlot xyPlot = (XYPlot) plot; XYItemRenderer xyItemRenderer = xyPlot.getRenderer(); XYDataset xyDataset = xyPlot.getDataset(); if (xyDataset != null) { for (int i = 0; i < xyDataset.getSeriesCount(); i++) { xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); } } xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f)); xyPlot.setDomainGridlinesVisible(false); xyPlot.setRangeZeroBaselineVisible(true); } }
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected void configurePlot(Plot plot, JRChartPlot jrPlot) { super.configurePlot(plot, jrPlot); if (plot instanceof CategoryPlot) { CategoryPlot categoryPlot = (CategoryPlot) plot; CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer(); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); }/*from w w w . j av a 2 s.c om*/ } categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f)); categoryPlot.setDomainGridlinesVisible(false); categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); } else if (plot instanceof XYPlot) { XYPlot xyPlot = (XYPlot) plot; XYItemRenderer xyItemRenderer = xyPlot.getRenderer(); XYDataset xyDataset = xyPlot.getDataset(); if (xyDataset != null) { for (int i = 0; i < xyDataset.getSeriesCount(); i++) { xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); } } xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217); xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f)); xyPlot.setDomainGridlinesVisible(false); xyPlot.setRangeZeroBaselineVisible(true); } }
From source file:org.jstockchart.plot.TimeseriesPlot.java
private XYPlot createVolumePlot() { Font axisFont = new Font("Arial", 0, 12); Stroke stroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f, new float[] { 1.0f, 1.0f }, 1.0f); VolumeArea volumeArea = timeseriesArea.getVolumeArea(); LogicNumberAxis logicVolumeAxis = volumeArea.getLogicVolumeAxis(); Color volumeColor = new Color(86, 126, 160); volumeArea.setVolumeColor(volumeColor); CFXNumberAxis volumeAxis = new CFXNumberAxis(logicVolumeAxis.getLogicTicks()); volumeAxis.setAxisLineVisible(false); volumeAxis.setCustomTickCount(2);/*w w w. ja v a 2 s .c om*/ volumeAxis.setTickLabelPaint(volumeColor); volumeAxis.setUpperBound(logicVolumeAxis.getUpperBound()); volumeAxis.setTickLabelFont(axisFont); volumeAxis.setTickMarkStroke(stroke); volumeAxis.setLowerBound(logicVolumeAxis.getLowerBound()); volumeAxis.setAutoRangeIncludesZero(true); XYAreaRenderer2 volumeRenderer = new XYAreaRenderer2(); volumeRenderer.setSeriesPaint(0, volumeArea.getVolumeColor()); //volumeRenderer.setShadowVisible(false); volumeRenderer.setSeriesStroke(0, stroke); volumeRenderer.setBaseStroke(stroke); XYPlot plot = new XYPlot(new TimeSeriesCollection(dataset.getVolumeTimeSeries()), null, volumeAxis, volumeRenderer); plot.setBackgroundPaint(volumeArea.getBackgroudColor()); plot.setOrientation(volumeArea.getOrientation()); plot.setRangeAxisLocation(volumeArea.getVolumeAxisLocation()); plot.setRangeMinorGridlinesVisible(false); Stroke outLineStroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f, new float[] { 1.0f, 1.0f }, 1.0f); Stroke gridLineStroke = new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.0f, new float[] { 2.0f, 2.0f }, 1.0f); // plot.setBackgroundPaint(Color.RED); plot.setRangeGridlineStroke(gridLineStroke); plot.setDomainGridlineStroke(gridLineStroke); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); plot.setOutlineVisible(true); plot.setOutlineStroke(outLineStroke); plot.setOutlinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); return plot; }