List of usage examples for org.jfree.chart.axis NumberAxis setUpperBound
public void setUpperBound(double max)
From source file:ecosim.gui.SummaryPane.java
/** * Private method to build the binning chart. * * @return A ChartPanel containing the binning chart. *//*from ww w. j av a 2s. c o m*/ private ChartPanel makeBinningChart() { final DefaultXYDataset binData = new DefaultXYDataset(); final NumberFormat nf = NumberFormat.getInstance(); final NumberAxis xAxis = new NumberAxis("Sequence identity criterion"); nf.setMinimumFractionDigits(2); xAxis.setLowerBound(Binning.binLevels[0]); xAxis.setUpperBound(1.0D); xAxis.setTickUnit(new NumberTickUnit(0.05D, nf)); LogAxis yAxis = new LogAxis("Number of bins"); yAxis.setBase(2.0D); yAxis.setNumberFormatOverride(NumberFormat.getInstance()); yAxis.setTickUnit(new NumberTickUnit(2.0D)); yAxis.setMinorTickMarksVisible(true); yAxis.setAutoRangeMinimumSize(4.0D); yAxis.setSmallestValue(1.0D); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); for (int i = 0; i < seriesColors.length; i++) { renderer.setSeriesPaint(i, seriesColors[i]); renderer.setSeriesStroke(i, new BasicStroke(seriesStroke[i])); } XYPlot plot = new XYPlot(binData, xAxis, yAxis, renderer); JFreeChart binChart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false); binChart.setPadding(new RectangleInsets(0.0D, 0.0D, 0.0D, 10.0D)); LegendTitle legend = new LegendTitle(plot); legend.setMargin(new RectangleInsets(1.0D, 1.0D, 1.0D, 1.0D)); legend.setFrame(new LineBorder()); legend.setBackgroundPaint(Color.white); legend.setPosition(RectangleEdge.BOTTOM); plot.addAnnotation(new XYTitleAnnotation(0.001D, 0.999D, legend, RectangleAnchor.TOP_LEFT)); final ChartPanel pane = new ChartPanel(binChart, false, true, true, false, false); // Watch for changes to the Summary object. summary.addObserver(new Observer() { public void update(Observable o, Object obj) { Summary s = (Summary) obj; ParameterEstimate estimate = s.getEstimate(); ArrayList<BinLevel> bins = s.getBins(); if (bins.size() > 0) { double[][] values = new double[2][bins.size()]; Double low = 1.0d; for (int i = 0; i < bins.size(); i++) { BinLevel bin = bins.get(i); values[0][i] = bin.getCrit(); values[1][i] = bin.getLevel(); if (values[0][i] < low) low = values[0][i]; } binData.addSeries("sequences", values); xAxis.setLowerBound(low); if (low > 0.95d - MasterVariables.EPSILON) { xAxis.setTickUnit(new NumberTickUnit(0.005D, nf)); } else if (low > 0.90d - MasterVariables.EPSILON) { xAxis.setTickUnit(new NumberTickUnit(0.010D, nf)); } else if (low > 0.80d - MasterVariables.EPSILON) { xAxis.setTickUnit(new NumberTickUnit(0.025D, nf)); } if (estimate != null) { double[][] omega = new double[2][bins.size()]; double[][] sigma = new double[2][bins.size()]; double[] omegaLine = estimate.getOmega(); double[] sigmaLine = estimate.getSigma(); for (int i = 0; i < bins.size(); i++) { double crit = 1.0D - values[0][i]; double snp = s.getLength() * crit; omega[0][i] = values[0][i]; sigma[0][i] = values[0][i]; omega[1][i] = Math.pow(2.0D, snp * omegaLine[0] + omegaLine[1]); sigma[1][i] = Math.pow(2.0D, snp * sigmaLine[0] + sigmaLine[1]); } if (-1.0D * omegaLine[0] > MasterVariables.EPSILON) { binData.addSeries("omega", omega); } if (-1.0D * sigmaLine[0] > MasterVariables.EPSILON) { binData.addSeries("sigma", sigma); } } // Repaint the summary pane. pane.repaint(); } } }); return pane; }
From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java
protected JFreeChart createPairedBarCharts(String title, String yaxis, double max, double min, CategoryDataset dataset, List<ValueMarker> markers) { final CategoryAxis domainAxis = new ShiftedCategoryAxis(null); final NumberAxis rangeAxis = new NumberAxis(yaxis); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperBound(max); rangeAxis.setLowerBound(min);/*from w w w .j a v a2 s .c o m*/ /*TODO : wrong scale choosen - Jes * if the user selects Mega or Giga as the scale, but there only are * a couple of Kilo in the graph it would have no ticks on the axis. * this can be solved by. redefining the ticks, * We have not done this because it's a bit tricky to figure out the rigth * factor to devid with * * but the method wuld be * double factor = 10 * rangeAxis.setStandardTickUnits(new StandardTickUnitSource(max / factor)); */ //StackedAreaRenderer2 renderer = new StackedAreaRenderer2(); BarRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); for (ValueMarker mkr : markers) { plot.addRangeMarker(mkr); } JFreeChart chart = new JFreeChart(plot); chart.setPadding(new RectangleInsets(30, 15, 15, 15)); chart.setTitle(title); return chart; }
From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java
protected JFreeChart createChart(CategoryDataset dataset, String title, String yaxis, int max, int min) { final JFreeChart chart = ChartFactory.createStackedAreaChart(title, // chart // title null, // unused yaxis, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls );/*from w ww . j a v a 2 s. c o m*/ final LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.BOTTOM); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.setCategoryMargin(0.0); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperBound(max); rangeAxis.setLowerBound(min); final StackedAreaRenderer renderer = (StackedAreaRenderer) plot.getRenderer(); renderer.setBaseStroke(new BasicStroke(2.0f)); plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0)); return chart; }
From source file:no.met.jtimeseries.marinogram.MarinogramCurrentPlot.java
private XYPlot createPlot(TimeZone timezone, boolean plotCurrentDirection, boolean plotCurrentSpeed) { ChartPlotter plotter = new ChartPlotter(); // default setting plotter.setHeight(this.getHeight()); plotter.setWidth(this.getWidth()); plotter.setPlotDefaultProperties("", ""); Color currentSpeedColor = new Color(142, 25, 131); Color currentDirectionColor = new Color(142, 25, 131); // plot style PlotStyle.Builder currentStyleBuilder = new PlotStyle.Builder("Current"); PlotStyle plotStyle;//from w w w . j ava 2 s . com NumberPhenomenon currentDirection = getOceanForecastDataModel() .getPhenomenen(PhenomenonName.CurrentDirection.toString(), NumberPhenomenon.class); NumberPhenomenon currentSpeed = getOceanForecastDataModel() .getPhenomenen(PhenomenonName.CurrentSpeed.toString(), NumberPhenomenon.class); if (currentSpeed == null || currentDirection == null) { return null; } currentSpeed = currentSpeed.scaling(100); double tick = (currentSpeed.getMaxValue() - currentSpeed.getMinValue()) / 2; tick = Math.ceil(tick / 10) * 10; double lowBound = Math.floor(currentSpeed.getMinValue() / (tick)) * (tick); //The minimum scale is 0 lowBound = lowBound < 0 ? 0 : lowBound; lowBound = lowBound - tick / 2; double upperBound = lowBound + tick * 4; // reference the range axis NumberAxis leftNumberAxis = new NumberAxis(); leftNumberAxis.setLabel(messages.getString("parameter.current") + " (cm/s)"); leftNumberAxis.setLabelPaint(currentSpeedColor); leftNumberAxis.setTickLabelPaint(currentSpeedColor); leftNumberAxis.setLowerBound(lowBound); leftNumberAxis.setUpperBound(upperBound); leftNumberAxis.setTickUnit(new NumberTickUnit(tick)); NumberAxis rightNumberAxis = new NumberAxis(); rightNumberAxis.setLabel(messages.getString("label.knots")); rightNumberAxis.setLabelPaint(currentSpeedColor); rightNumberAxis.setTickLabelPaint(currentSpeedColor); lowBound = lowBound / 100.0 / KNOT; upperBound = upperBound / 100.0 / KNOT; rightNumberAxis.setLowerBound(lowBound); rightNumberAxis.setUpperBound(upperBound); rightNumberAxis.setTickUnit(new NumberTickUnit(tick / 100.0 / KNOT)); NumberFormat formatter = new DecimalFormat("#0.00"); rightNumberAxis.setNumberFormatOverride(formatter); List<Date> shortTermTimeList = this.getShortTermTime(currentDirection.getTime().get(0)); //set thte plot current speed color to be transparent if show current speed is false if (!plotCurrentSpeed) { currentSpeedColor = new Color(0, 0, 0, 0); } // plot style BasicStroke dottedStroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 2.0f, new float[] { 2.0f, 6.0f }, 0.0f); plotStyle = currentStyleBuilder.spline(SplineStyle.HYBRID).stroke(dottedStroke) .seriesColor(currentSpeedColor).numberAxis(leftNumberAxis).nonNegative(true).build(); //Draw the current direction even if plotCurrentSpeed is false (but with transparent in such a case) //for the purpose to keep the same background grid and tick label on the y-axis //no matter the wave height is shown or not plotter.addLineChart(TimeBase.SECOND, currentSpeed, plotStyle); plotter.getPlot().setRangeAxis(1, rightNumberAxis); plotter.getPlot().setOutlineVisible(true); Date minDate = shortTermTimeList.get(0); Date maxDate = shortTermTimeList.get(shortTermTimeList.size() - 1); plotter.setDomainRange(minDate, maxDate); plotter.setDomainDateFormat(timezone, "HH"); // set domain range after (must) plot all the data plotter.addHourBasedDomainGridLines(); // invisible domain axis plotter.getPlot().getDomainAxis().setTickLabelsVisible(false); // add markers plotter.addDomainMarkers(shortTermTimeList, timezone, locale); if (plotCurrentDirection) { List<Date> symbolTimes = Utility.filterMinimumHourInterval(currentDirection.getTime(), 2, 1); InListFromDateFilter symbolTimesFilter = new InListFromDateFilter(symbolTimes); currentDirection.filter(symbolTimesFilter); currentSpeed = null; if (plotCurrentSpeed) { currentSpeed = getOceanForecastDataModel().getPhenomenen(PhenomenonName.CurrentSpeed.toString(), NumberPhenomenon.class); currentSpeed.filter(symbolTimesFilter); currentSpeed = currentSpeed.scaling(1 / 100.0 / KNOT); } plotStyle = currentStyleBuilder.seriesColor(currentDirectionColor).build(); plotter.addArrowDirectionPlot(currentDirection, currentSpeed, 2, plotStyle); } plotter.getPlot().setRangeZeroBaselineVisible(false); return plotter.getPlot(); }
From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.ui.Chromatogram2DViewTopComponent.java
private XYPlot createPlot(IChromatogramDescriptor chromatogram, ADataset2D<IChromatogram2D, IScan2D> ds, PaintScale ps) {/*w w w. j a v a 2 s. co m*/ XYNoBlockRenderer xybr = new XYNoBlockRenderer(); xybr.setPaintScale(ps); try { double modulationTime = chromatogram.getChromatogram().getParent().getChild("modulation_time") .getArray().getDouble(0); double scanRate = chromatogram.getChromatogram().getParent().getChild("scan_rate").getArray() .getDouble(0); xybr.setDefaultEntityRadius(10);//Math.max(1, (int)(modulationTime / scanRate))); xybr.setEntityThreshold(ds.getMinZ()); xybr.setBlockWidth(modulationTime); xybr.setBlockAnchor(RectangleAnchor.CENTER); double spm = modulationTime * scanRate; double scanDuration = modulationTime / spm; xybr.setBlockHeight(scanDuration); } catch (ResourceNotAvailableException rnae) { } RTUnit rtUnit = RTUnit.SECONDS; xybr.setToolTipGenerator( new StandardXYZToolTipGenerator("{0}: @({1}, {2}) = {3}", DecimalFormat.getNumberInstance(), DecimalFormat.getNumberInstance(), DecimalFormat.getNumberInstance())); NumberAxis rt1 = new NumberAxis("RT1 [" + rtUnit.name().toLowerCase() + "]"); NumberAxis rt2 = new NumberAxis("RT2 [" + rtUnit.name().toLowerCase() + "]"); rt1.setAutoRange(false); rt1.setLowerBound(ds.getMinX()); rt1.setUpperBound(ds.getMaxX()); rt1.setRangeWithMargins(ds.getMinX(), ds.getMaxX()); rt2.setFixedAutoRange(ds.getMaxX() - ds.getMinX()); rt2.setAutoRange(false); rt2.setLowerBound(ds.getMinY()); rt2.setUpperBound(ds.getMaxY()); rt2.setFixedAutoRange(ds.getMaxY() - ds.getMinY()); rt2.setRangeWithMargins(ds.getMinY(), ds.getMaxY()); XYPlot heatmapPlot = new XYPlot(ds, rt1, rt2, xybr); heatmapPlot.setDomainPannable(true); heatmapPlot.setRangePannable(true); return heatmapPlot; }
From source file:org.vast.stt.renderer.JFreeChart.XYPlotBuilder.java
public void createPlot(ChartScene scene) { this.scene = scene; // scene contains the axis info, so passing it in here for now datasetCount = 0;//w w w. j a v a 2 s. c o m rangeAxisCount = 0; currentItem = null; axisTable.clear(); plot = new XYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); String axisName = "Time (s)"; NumberAxis domainAxis = new NumberAxis(axisName); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setAutoRange(false); domainAxis.setNumberFormatOverride(new DateFormat()); domainAxis.setTickLabelInsets(new RectangleInsets(0, 30, 0, 30)); domainAxis.setLowerBound(scene.getDomainMin()); domainAxis.setUpperBound(scene.getDomainMax()); plot.setDomainAxis(datasetCount, domainAxis); }
From source file:org.vast.stt.renderer.JFreeChart.XYPlotBuilder.java
public void addAxisToPlot(DataItem item) { String axisName = item.getName(); NumberAxis rangeAxis = new NumberAxis(axisName); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRange(false);/*from ww w . j a v a 2 s . c om*/ NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(2); rangeAxis.setNumberFormatOverride(format); rangeAxis.setLowerBound(scene.getRangeMin()); rangeAxis.setUpperBound(scene.getRangeMax()); plot.setRangeAxis(rangeAxisCount, rangeAxis); axisTable.put(item, rangeAxisCount); rangeAxisCount++; }
From source file:no.met.jtimeseries.marinogram.MarinogramTemperaturePlot.java
private XYPlot createPlot(TimeZone timezone, boolean plotAirTemp, boolean plotWaterTemp, boolean plotDewpointTemp) throws ParseException { Date startTime = null;//w w w . ja v a 2 s.co m NumberPhenomenon aTemperature = null; NumberPhenomenon wTemperature = null; NumberPhenomenon dTemperature = null; // default setting ChartPlotter plotter = new ChartPlotter(); plotter.setHeight(this.getHeight()); plotter.setWidth(this.getWidth()); plotter.setPlotDefaultProperties("", ""); double minValue = 100; double maxValue = -100; int plotIndex = 0; if (plotAirTemp) { aTemperature = getLocationForecastDataModel().getPhenomenen(PhenomenonName.AirTemperature.toString(), NumberPhenomenon.class); minValue = aTemperature.getMinValue() < minValue ? aTemperature.getMinValue() : minValue; maxValue = aTemperature.getMaxValue() > maxValue ? aTemperature.getMaxValue() : maxValue; startTime = aTemperature.getTime().get(0); plotTemperature(plotter, aTemperature, new BasicStroke(2.0f), Color.RED, messages.getString("label.air"), true); plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(0, true); plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(1, true); plotIndex++; } if (plotWaterTemp) { wTemperature = getOceanForecastDataModel().getPhenomenen(PhenomenonName.seaTemperature.toString(), NumberPhenomenon.class); // only plot water temperature if it is availbe for this location if (wTemperature != null) { minValue = wTemperature.getMinValue() < minValue ? wTemperature.getMinValue() : minValue; maxValue = wTemperature.getMaxValue() > maxValue ? wTemperature.getMaxValue() : maxValue; startTime = wTemperature.getTime().get(0); BasicStroke dottedStroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f); plotTemperature(plotter, wTemperature, dottedStroke, Color.RED, messages.getString("label.water"), true); plotter.getPlot().getRenderer(plotIndex++).setSeriesVisibleInLegend(0, true); } } if (plotDewpointTemp) { dTemperature = getLocationForecastDataModel() .getPhenomenen(PhenomenonName.dewPointTemperature.toString(), NumberPhenomenon.class); minValue = dTemperature.getMinValue() < minValue ? dTemperature.getMinValue() : minValue; maxValue = dTemperature.getMaxValue() > maxValue ? dTemperature.getMaxValue() : maxValue; startTime = dTemperature.getTime().get(0); plotTemperature(plotter, dTemperature, new BasicStroke(2.0f), Color.ORANGE, messages.getString("label.dewpoint"), false); plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(0, true); } double tick = (maxValue - minValue) / 3.5; tick = Math.ceil(tick); double lowBound = Math.floor(minValue / (tick)) * (tick); lowBound = lowBound - tick / 2; double upperBound = lowBound + tick * 7; // set range axis NumberAxis numberAxis = new NumberAxis(); numberAxis.setLabelPaint(Color.RED); numberAxis.setTickLabelPaint(Color.RED); numberAxis.setLabel(messages.getString("parameter.temperature") + " (\u00B0 C)"); numberAxis.setTickUnit(new NumberTickUnit(tick)); numberAxis.setLowerBound(lowBound); numberAxis.setUpperBound(upperBound); //Set left axis and right axis plotter.getPlot().setRangeAxis(0, numberAxis); plotter.getPlot().setRangeAxis(1, numberAxis); //Set the third axis and hide the third axis if (plotAirTemp && plotWaterTemp && plotDewpointTemp) { NumberAxis numberAxis2 = new NumberAxis(); numberAxis2.setTickUnit(new NumberTickUnit(tick)); numberAxis2.setLowerBound(lowBound); numberAxis2.setUpperBound(upperBound); plotter.getPlot().setRangeAxis(2, numberAxis2); plotter.getPlot().getRangeAxis(2).setVisible(false); } //Show legend at the top right position of the plot LegendTitle lt = new LegendTitle(plotter.getPlot()); lt.setItemFont(new Font("Dialog", Font.PLAIN, 9)); lt.setBackgroundPaint(new Color(255, 255, 255, 100)); lt.setFrame(new BlockBorder(Color.white)); lt.setPosition(RectangleEdge.TOP); XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.95, lt, RectangleAnchor.TOP_RIGHT); plotter.getPlot().addAnnotation(ta); // set domain range after (must) plot all the data plotter.addHourBasedDomainGridLines(); // add markers plotter.addDomainMarkers(getShortTermTime(startTime), timezone, locale); Date minDate = getShortTermTime(startTime).get(0); Date maxDate = getShortTermTime(startTime).get(getShortTermTime(startTime).size() - 1); plotter.setDomainRange(minDate, maxDate); plotter.setDomainDateFormat(timezone, "HH"); plotter.getPlot().setOutlineVisible(true); // invisible the domain i.e, x axis plotter.getPlot().getDomainAxis().setTickLabelsVisible(false); return plotter.getPlot(); }
From source file:desmoj.extensions.grafic.util.Plotter.java
/** * configure range axis ( lowerBound, upperBound, label, format ticks) * of time-series chart//from www . j a v a 2s . com * @param numberAxis * @param label */ private void configureRangeAxis(NumberAxis numberAxis, String label) { double min = numberAxis.getLowerBound(); double max = numberAxis.getUpperBound(); Double delta = 0.01 * (max - min); numberAxis.setLowerBound(min - delta); numberAxis.setUpperBound(max + delta); numberAxis.setLabel(label); // format Ticks double fontHeight = numberAxis.getTickLabelFont().getLineMetrics("X", this.frc).getHeight(); double maxTicks = this.paintPanel.getSize().height / fontHeight; int digits = Math.max(0, (int) -Math.floor(Math.log10((max - min) / maxTicks))); //System.out.println(fontHeight+" "+digits+" "+Math.log10((max - min)/ maxTicks)); NumberFormat formatter = NumberFormat.getNumberInstance(this.locale); formatter.setMinimumFractionDigits(digits); formatter.setMaximumFractionDigits(digits); formatter.setGroupingUsed(true); numberAxis.setNumberFormatOverride(formatter); }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.XYCharts.SimpleBlockChart.java
/** * Creates a chart for the specified dataset. * /*from w w w . j a v a 2 s .com*/ * @param dataset the dataset. * * @return A chart instance. */ public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); XYZDataset dataset = (XYZDataset) datasets.getDatasets().get("1"); JFreeChart chart = null; NumberAxis xAxis = new NumberAxis(xLabel); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (xLowerBound != null && xUpperBound != null) { xAxis.setLowerBound(xLowerBound); xAxis.setUpperBound(xUpperBound); } else { xAxis.setAutoRange(true); } xAxis.setAxisLinePaint(Color.white); xAxis.setTickMarkPaint(Color.white); if (addLabelsStyle != null && addLabelsStyle.getFont() != null) { xAxis.setLabelFont(addLabelsStyle.getFont()); xAxis.setLabelPaint(addLabelsStyle.getColor()); } NumberAxis yAxis = new NumberAxis(yLabel); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (yLowerBound != null && yUpperBound != null) { yAxis.setLowerBound(yLowerBound); yAxis.setUpperBound(yUpperBound); } else yAxis.setAutoRange(true); yAxis.setAxisLinePaint(Color.white); yAxis.setTickMarkPaint(Color.white); if (addLabelsStyle != null && addLabelsStyle.getFont() != null) { yAxis.setLabelFont(addLabelsStyle.getFont()); yAxis.setLabelPaint(addLabelsStyle.getColor()); } XYBlockRenderer renderer = new XYBlockRenderer(); PaintScale paintScale = null; if (grayPaintScale) { paintScale = new GrayPaintScale(minScaleValue, maxScaleValue); } else { if (scaleLowerBound != null && scaleUpperBound != null) { paintScale = new LookupPaintScale(scaleLowerBound, scaleUpperBound, Color.gray); } else { paintScale = new LookupPaintScale(minScaleValue, maxScaleValue, Color.gray); } for (int i = 0; i < zRangeArray.length; i++) { ZRange zRange = zRangeArray[i]; ((LookupPaintScale) paintScale).add(zRange.getValue().doubleValue(), zRange.getColor()); } } renderer.setPaintScale(paintScale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); plot.setForegroundAlpha(0.66f); chart = new JFreeChart(plot); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } chart.removeLegend(); NumberAxis scaleAxis = new NumberAxis(zLabel); scaleAxis.setAxisLinePaint(Color.white); scaleAxis.setTickMarkPaint(Color.white); scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7)); if (scaleLowerBound != null && scaleUpperBound != null) { scaleAxis.setLowerBound(scaleLowerBound); scaleAxis.setUpperBound(scaleUpperBound); } else scaleAxis.setAutoRange(true); if (addLabelsStyle != null && addLabelsStyle.getFont() != null) { scaleAxis.setLabelFont(addLabelsStyle.getFont()); scaleAxis.setLabelPaint(addLabelsStyle.getColor()); } if (blockHeight != null && blockWidth != null) { renderer.setBlockWidth(blockWidth.doubleValue()); renderer.setBlockHeight(blockHeight.doubleValue()); } PaintScaleLegend legend = new PaintScaleLegend(paintScale, scaleAxis); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.black)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10); legend.setPosition(RectangleEdge.RIGHT); legend.setBackgroundPaint(color); chart.addSubtitle(legend); // chart.setBackgroundPaint(new Color(180, 180, 250)); chart.setBackgroundPaint(color); logger.debug("OUT"); return chart; }