List of usage examples for org.jfree.chart.axis NumberAxis NumberAxis
public NumberAxis(String label)
From source file:it.eng.spagobi.engines.chart.bo.charttypes.barcharts.LinkableBar.java
/** * Inherited by IChart./* w ww . j a v a 2 s . c o m*/ * * @param chartTitle the chart title * @param dataset the dataset * * @return the j free chart */ public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); CategoryDataset dataset = (CategoryDataset) datasets.getDatasets().get("1"); CategoryAxis categoryAxis = new CategoryAxis(categoryLabel); ValueAxis valueAxis = new NumberAxis(valueLabel); if (rangeIntegerValues == true) { valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } org.jfree.chart.renderer.category.BarRenderer renderer = new org.jfree.chart.renderer.category.BarRenderer(); renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); // renderer.setBaseItemLabelFont(new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); // renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); if (showValueLabels) { renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelFont( new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); } if (maxBarWidth != null) { renderer.setMaximumBarWidth(maxBarWidth.doubleValue()); } boolean document_composition = false; if (mode.equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITION)) document_composition = true; MyCategoryUrlGenerator mycatUrl = new MyCategoryUrlGenerator(rootUrl); mycatUrl.setDocument_composition(document_composition); mycatUrl.setCategoryUrlLabel(categoryUrlName); mycatUrl.setSerieUrlLabel(serieUrlname); mycatUrl.setDrillDocTitle(drillDocTitle); mycatUrl.setTarget(target); renderer.setItemURLGenerator(mycatUrl); /* } else{ renderer.setItemURLGenerator(new StandardCategoryURLGenerator(rootUrl)); }*/ CategoryPlot plot = new CategoryPlot((CategoryDataset) dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); if (horizontalView) { plot.setOrientation(PlotOrientation.HORIZONTAL); } JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(color); // get a reference to the plot for further customisation... //CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); NumberFormat nf = NumberFormat.getNumberInstance(locale); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize())); rangeAxis.setLabelPaint(styleXaxesLabels.getColor()); rangeAxis .setTickLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize())); rangeAxis.setTickLabelPaint(styleXaxesLabels.getColor()); rangeAxis.setNumberFormatOverride(nf); if (rangeAxisLocation != null) { if (rangeAxisLocation.equalsIgnoreCase("BOTTOM_OR_LEFT")) { plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT); } else if (rangeAxisLocation.equalsIgnoreCase("BOTTOM_OR_RIGHT")) { plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_RIGHT); } else if (rangeAxisLocation.equalsIgnoreCase("TOP_OR_RIGHT")) { plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_RIGHT); } else if (rangeAxisLocation.equalsIgnoreCase("TOP_OR_LEFT")) { plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT); } } // disable bar outlines... //BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); /* if(currentSeries!=null && colorMap!=null){ //for each serie selected int j=0; for (Iterator iterator = currentSeries.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); Integer position=(Integer)seriesNumber.get(s); // check if for that position a value is defined if(colorMap.get("color"+position.toString())!=null){ Color col= (Color)colorMap.get("color"+position); renderer.setSeriesPaint(j, col); } j++; } // close for on series } // close case series selcted and color defined else{ if(colorMap!=null){ // if series not selected check color each one for (Iterator iterator = colorMap.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); Color col= (Color)colorMap.get(key); String keyNum=key.substring(5, key.length()); int num=Integer.valueOf(keyNum).intValue(); num=num-1; renderer.setSeriesPaint(num, col); } } }*/ int seriesN = dataset.getRowCount(); if (orderColorVector != null && orderColorVector.size() > 0) { logger.debug("color serie by SERIES_ORDER_COLORS template specification"); for (int i = 0; i < seriesN; i++) { if (orderColorVector.get(i) != null) { Color color = orderColorVector.get(i); renderer.setSeriesPaint(i, color); } } } else if (colorMap != null) { for (int i = 0; i < seriesN; i++) { String serieName = (String) dataset.getRowKey(i); Color color = (Color) colorMap.get(serieName); if (color != null) { renderer.setSeriesPaint(i, color); } } } CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); domainAxis.setLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize())); domainAxis.setLabelPaint(styleYaxesLabels.getColor()); domainAxis .setTickLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize())); domainAxis.setTickLabelPaint(styleYaxesLabels.getColor()); if (legend == true) drawLegend(chart); logger.debug("OUT"); return chart; }
From source file:org.jfree.chart.demo.ContourPlotDemo2.java
/** * Creates a ContourPlot chart./*from ww w. ja v a 2 s .c o m*/ * * @return the ContourPlot chart. */ private JFreeChart createContourPlot() { final String title = "Contour Plot"; final String xAxisLabel = "X Values"; final String yAxisLabel = "Y Values"; final String zAxisLabel = "Color Values"; if (xIsDate) { this.xAxis = new DateAxis(xAxisLabel); xIsLog = false; // force axis to be linear when displaying dates } else { if (xIsLog) { this.xAxis = new LogarithmicAxis(xAxisLabel); } else { this.xAxis = new NumberAxis(xAxisLabel); } } if (yIsLog) { this.yAxis = new LogarithmicAxis(yAxisLabel); } else { this.yAxis = new NumberAxis(yAxisLabel); } if (zIsLog) { this.zColorBar = new ColorBar(zAxisLabel); } else { this.zColorBar = new ColorBar(zAxisLabel); } if (this.xAxis instanceof NumberAxis) { ((NumberAxis) this.xAxis).setAutoRangeIncludesZero(false); ((NumberAxis) this.xAxis).setInverted(xIsInverted); } this.yAxis.setAutoRangeIncludesZero(false); this.yAxis.setInverted(yIsInverted); if (!xIsDate) { ((NumberAxis) this.xAxis).setLowerMargin(0.0); ((NumberAxis) this.xAxis).setUpperMargin(0.0); } this.yAxis.setLowerMargin(0.0); this.yAxis.setUpperMargin(0.0); if (!xIsDate) { this.xAxis.setRange(10.5, 15.0); } this.yAxis.setRange(3.5, 7.0); this.zColorBar.getAxis().setInverted(zIsInverted); this.zColorBar.getAxis().setTickMarksVisible(true); final ContourDataset data = createDataset(); final ContourPlot plot = new ContourPlot(data, this.xAxis, this.yAxis, this.zColorBar); if (xIsDate) { ratio = Math.abs(ratio); // don't use plot units for ratios when x axis is date } if (asPoints) { plot.setRenderAsPoints(true); } plot.setDataAreaRatio(ratio); if (annotate) { if (asPoints) { final Number[] xValues = data.getXValues(); final Number[] yValues = data.getYValues(); //Number[] zValues = data.getZValues(); final Font font = new Font("SansSerif", Font.PLAIN, 20); for (int i = 0; i < xValues.length; i++) { final XYTextAnnotation xyAnn = new XYTextAnnotation(Integer.toString(i), xValues[i].doubleValue(), yValues[i].doubleValue()); xyAnn.setFont(font); plot.addAnnotation(xyAnn); } } else { final Font font = new Font("SansSerif", Font.PLAIN, 20); for (int i = 0; i < this.tmpDoubleX.length; i++) { final XYTextAnnotation xyAnn = new XYTextAnnotation(Integer.toString(i), this.tmpDoubleX[i], this.tmpDoubleY[i]); xyAnn.setFont(font); plot.addAnnotation(xyAnn); } } } if (fillOutline || drawOutline) { initShoreline(); plot.setClipPath(new ClipPath(this.xOutline, this.yOutline, true, fillOutline, drawOutline)); } final JFreeChart chart = new JFreeChart(title, null, plot, false); // then customise it a little... chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.green)); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo2.java
/** * Creates a sample chart./* ww w.j av a 2 s . co m*/ * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(null); NumberAxis rangeAxis = new NumberAxis(rangeLabel); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(chartTitle, plot); plot.setOrientation(PlotOrientation.HORIZONTAL); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); renderer.setLegendItemLabelGenerator( new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT)); //columnCount -- category count //RowCount -- serie count domainAxis.setLowerMargin(0.44); domainAxis.setUpperMargin(0.44); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); /* System.out.println("1lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ renderer.setItemMargin(renderer.getItemMargin() * 2); /*System.out.println("2lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ return chart; }
From source file:com.mothsoft.alexis.web.ChartServlet.java
private void doLineGraph(final HttpServletRequest request, final HttpServletResponse response, final String title, final String[] dataSetIds, final Integer width, final Integer height, final Integer numberOfSamples) throws ServletException, IOException { final DataSetService dataSetService = WebApplicationContextUtils .getWebApplicationContext(this.getServletContext()).getBean(DataSetService.class); final OutputStream out = response.getOutputStream(); response.setContentType("image/png"); response.setHeader("Cache-Control", "max-age: 5; must-revalidate"); final XYSeriesCollection seriesCollection = new XYSeriesCollection(); final DateAxis dateAxis = new DateAxis(title != null ? title : "Time"); final DateTickUnit unit = new DateTickUnit(DateTickUnit.HOUR, 1); final DateFormat chartFormatter = new SimpleDateFormat("ha"); dateAxis.setDateFormatOverride(chartFormatter); dateAxis.setTickUnit(unit);/*from w w w . j a v a2 s . com*/ dateAxis.setLabelFont(DEFAULT_FONT); dateAxis.setTickLabelFont(DEFAULT_FONT); if (numberOfSamples > 12) { dateAxis.setTickLabelFont( new Font(DEFAULT_FONT.getFamily(), Font.PLAIN, (int) (DEFAULT_FONT.getSize() * .8))); } final NumberAxis yAxis = new NumberAxis("Activity"); final StandardXYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); int colorCounter = 0; if (dataSetIds != null) { for (final String dataSetIdString : dataSetIds) { final Long dataSetId = Long.valueOf(dataSetIdString); final DataSet dataSet = dataSetService.get(dataSetId); // go back for numberOfSamples, but include current hour final Calendar calendar = new GregorianCalendar(); calendar.add(Calendar.HOUR_OF_DAY, -1 * (numberOfSamples - 1)); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); final Timestamp startDate = new Timestamp(calendar.getTimeInMillis()); calendar.add(Calendar.HOUR_OF_DAY, numberOfSamples); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); final Timestamp endDate = new Timestamp(calendar.getTimeInMillis()); logger.debug(String.format("Generating chart for period: %s to %s", startDate.toString(), endDate.toString())); final List<DataSetPoint> dataSetPoints = dataSetService .findAndAggregatePointsGroupedByUnit(dataSetId, startDate, endDate, TimeUnits.HOUR); final boolean hasData = addSeries(seriesCollection, dataSet.getName(), dataSetPoints, startDate, numberOfSamples, renderer); if (dataSet.isAggregate()) { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, Color.BLACK); } else if (hasData) { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, PAINTS[colorCounter++ % PAINTS.length]); } else { renderer.setSeriesPaint(seriesCollection.getSeriesCount() - 1, Color.LIGHT_GRAY); } } } final XYPlot plot = new XYPlot(seriesCollection, dateAxis, yAxis, renderer); // create the chart... final JFreeChart chart = new JFreeChart(plot); // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... plot.setBackgroundPaint(new Color(253, 253, 253)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabelFont(DEFAULT_FONT); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerBound(0.00d); ChartUtilities.writeChartAsPNG(out, chart, width, height); }
From source file:org.jfree.chart.demo.XYTickLabelDemo.java
/** * When a checkbox is changed ...// w w w. j a va 2s .co m * * @param event the event. */ public void actionPerformed(final ActionEvent event) { final ValueAxis[] axes = new ValueAxis[4]; final XYPlot plot = this.chart.getXYPlot(); axes[0] = plot.getDomainAxis(); axes[1] = plot.getRangeAxis(); axes[2] = plot.getDomainAxis(1); axes[3] = plot.getRangeAxis(1); final Object source = event.getSource(); if (source == this.symbolicAxesCheckBox) { final boolean val = this.symbolicAxesCheckBox.isSelected(); for (int i = 0; i < axes.length; i++) { ValueAxis axis = axes[i]; final String label = axis.getLabel(); final int maxTick = (int) axis.getUpperBound(); final String[] tickLabels = new String[maxTick]; final Font ft = axis.getTickLabelFont(); for (int itk = 0; itk < maxTick; itk++) { tickLabels[itk] = "Label " + itk; } axis = val ? new SymbolicAxis(label, tickLabels) : new NumberAxis(label); axis.setTickLabelFont(ft); axes[i] = axis; } plot.setDomainAxis(axes[0]); plot.setRangeAxis(axes[1]); plot.setDomainAxis(1, axes[2]); plot.setRangeAxis(1, axes[3]); } if (source == this.symbolicAxesCheckBox || source == this.verticalTickLabelsCheckBox) { final boolean val = this.verticalTickLabelsCheckBox.isSelected(); for (int i = 0; i < axes.length; i++) { axes[i].setVerticalTickLabels(val); } } else if (source == this.symbolicAxesCheckBox || source == this.horizontalPlotCheckBox) { final PlotOrientation val = this.horizontalPlotCheckBox.isSelected() ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL; this.chart.getXYPlot().setOrientation(val); } else if (source == this.symbolicAxesCheckBox || source == this.fontSizeTextField) { final String s = this.fontSizeTextField.getText(); if (s.length() > 0) { final float sz = Float.parseFloat(s); for (int i = 0; i < axes.length; i++) { final ValueAxis axis = axes[i]; Font ft = axis.getTickLabelFont(); ft = ft.deriveFont(sz); axis.setTickLabelFont(ft); } } } }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.others.CumulativeCurveChart.java
public JFreeChart createChart(DatasetMap datasetMap) { CategoryDataset datasetValue = (CategoryDataset) datasetMap.getDatasets().get("1"); CategoryDataset datasetCumulative = (CategoryDataset) datasetMap.getDatasets().get("2"); JFreeChart chart = ChartFactory.createBarChart(name, // chart title xLabel, // domain axis label yLabel, // range axis label datasetValue, // data PlotOrientation.VERTICAL, true, // include legend true, false);/*from w ww.j a v a2 s. c o m*/ chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.02); domainAxis.setUpperMargin(0.02); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); NumberAxis axis2 = new NumberAxis("Percent"); axis2.setNumberFormatOverride(NumberFormat.getPercentInstance()); plot.setRangeAxis(1, axis2); plot.setDataset(1, datasetCumulative); plot.setRenderer(1, renderer2); plot.mapDatasetToRangeAxis(1, 1); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
From source file:org.optaplanner.benchmark.impl.statistic.improvingsteppercentage.ImprovingStepPercentageProblemStatistic.java
private XYPlot createPlot(Class<? extends Move> moveClass) { Locale locale = problemBenchmark.getPlannerBenchmark().getBenchmarkReport().getLocale(); NumberAxis xAxis = new NumberAxis("Time spend"); xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat(locale)); NumberAxis yAxis = new NumberAxis("Percentage that improve the score"); yAxis.setNumberFormatOverride(NumberFormat.getPercentInstance(locale)); yAxis.setRange(0.0, 1.0);/*from w w w . j a v a 2 s.co m*/ XYPlot plot = new XYPlot(null, xAxis, yAxis, null); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
From source file:org.ow2.clif.jenkins.chart.MovingStatChart.java
private void attachThroughputDatasetToDedicatedAxis(XYSeriesCollection throughputDataset, XYPlot plot) { NumberAxis throughputAxis = new NumberAxis(Messages.MovingChart_Throughput()); plot.setRangeAxis(1, throughputAxis); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, throughputDataset); plot.mapDatasetToDomainAxis(1, 0);/*w ww . j a v a 2s . c o m*/ plot.mapDatasetToRangeAxis(1, 1); }
From source file:scheduler.benchmarker.manager.CreateCombinedCategoryPlot.java
public ChartPanel createChartPanel() { CustomBarRenderer renderer = new CustomBarRenderer(pluginColors); CategoryPlot subplot1 = new CategoryPlot(createDataset1(), new CategoryAxis("Category"), new NumberAxis("Value"), renderer); subplot1.setDomainGridlinesVisible(true); CategoryPlot subplot2 = new CategoryPlot(createDataset2(), new CategoryAxis("Category"), new NumberAxis("Value"), renderer); subplot2.setDomainGridlinesVisible(true); final CategoryAxis domainAxis = new CategoryAxis("Category"); final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 1);//from w w w . j a va 2s. c om plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setFixedLegendItems(createCustomLegend()); plot.setRenderer(renderer); subplot1.setBackgroundPaint(new Color(246, 244, 242)); subplot2.setBackgroundPaint(new Color(246, 244, 242)); subplot1.addRangeMarker(generateMarker("CLASSIFICATION FINISH FOR '" + schedNames[0] + "'", dataSource[0].getSumTotalTime()), Layer.FOREGROUND); subplot2.addRangeMarker(generateMarker("CLASSIFICATION FINISH FOR '" + schedNames[1] + "'", dataSource[1].getSumTotalTime()), Layer.FOREGROUND); final JFreeChart result = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 12), plot, true); cPanel = new ChartPanel(result); cPanel.setForeground(new Color(76, 76, 76)); cPanel.setBackground(new Color(246, 244, 242)); return cPanel; }
From source file:org.n52.oxf.render.sos.TimeSeriesChartRenderer4xPhenomenons.java
public JFreeChart renderChart(OXFFeatureCollection observationCollection, ParameterContainer paramCon) { // which observedProperty has been used?: ParameterShell observedPropertyPS = paramCon.getParameterShellWithServiceSidedName("observedProperty"); if (observedPropertyPS.hasMultipleSpecifiedValues()) { observedProperties = observedPropertyPS.getSpecifiedTypedValueArray(String[].class); } else if (observedPropertyPS.hasSingleSpecifiedValue()) { observedProperties = new String[] { (String) observedPropertyPS.getSpecifiedValue() }; } else {// ww w .j a va2 s . c o m throw new IllegalArgumentException("no observedProperties found."); } String[] foiIdArray; ParameterShell foiParamShell = paramCon.getParameterShellWithServiceSidedName("featureOfInterest"); if (foiParamShell.hasMultipleSpecifiedValues()) { foiIdArray = foiParamShell.getSpecifiedTypedValueArray(String[].class); } else { foiIdArray = new String[] { (String) foiParamShell.getSpecifiedValue() }; } ObservationSeriesCollection tuples4FOI = new ObservationSeriesCollection(observationCollection, foiIdArray, observedProperties, false); JFreeChart chart = ChartFactory.createTimeSeriesChart(null, // title "Date", // x-axis label observedProperties[0], // y-axis label createDataset(foiIdArray, tuples4FOI, 0), // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); // add additional datasets: DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat()); for (int i = 1; i < observedProperties.length; i++) { XYDataset additionalDataset = createDataset(foiIdArray, tuples4FOI, i); plot.setDataset(i, additionalDataset); plot.setRangeAxis(i, new NumberAxis(observedProperties[i])); plot.getRangeAxis(i).setRange((Double) tuples4FOI.getMinimum(i), (Double) tuples4FOI.getMaximum(i)); plot.mapDatasetToRangeAxis(i, i); } return chart; }