Java Code Examples for org.jfree.chart.ChartFactory#createXYLineChart()
The following examples show how to use
org.jfree.chart.ChartFactory#createXYLineChart() .
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: XYLineAndShapeRendererTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Check that the renderer is calculating the domain bounds correctly. */ @Test public void testFindDomainBounds() { XYSeriesCollection dataset = RendererXYPackageUtils.createTestXYSeriesCollection(); JFreeChart chart = ChartFactory.createXYLineChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); Range bounds = domainAxis.getRange(); assertFalse(bounds.contains(0.9)); assertTrue(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertFalse(bounds.contains(2.10)); }
Example 2
Source File: XYLineAndShapeRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Check that the renderer is calculating the range bounds correctly. */ @Test public void testFindRangeBounds() { TableXYDataset dataset = RendererXYPackageUtils.createTestTableXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); Range bounds = rangeAxis.getRange(); assertFalse(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertTrue(bounds.contains(5.0)); assertFalse(bounds.contains(6.0)); }
Example 3
Source File: Timer.java From keycloak with Apache License 2.0 | 6 votes |
private void saveChart(String op) { XYSeries series = new XYSeries(op); int i = 0; for (Long duration : stats.get(op)) { series.add(++i, duration); } final XYSeriesCollection data = new XYSeriesCollection(series); final JFreeChart chart = ChartFactory.createXYLineChart( op, "Operations", "Duration (ms)", data, PlotOrientation.VERTICAL, true, true, false ); try { ChartUtilities.saveChartAsPNG( new File(CHARTS_DIR, op.replace(" ", "_") + ".png"), chart, 640, 480); } catch (IOException ex) { log.warn("Unable to save chart for operation '" + op + "'."); } }
Example 4
Source File: XYPlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * A test for drawing range grid lines when there is no primary renderer. * In 1.0.4, this is throwing a NullPointerException. */ @Test public void testDrawRangeGridlines() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(null); try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 5
Source File: StatisticsView.java From Creatures with GNU General Public License v2.0 | 6 votes |
private JFreeChart createChart(final XYDataset dataset, Vector<Color> colors) { final JFreeChart chart = ChartFactory.createXYLineChart( "Creature Statistics", "Time", "Value", dataset, PlotOrientation.VERTICAL, true, true, false ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); for (int k = 0; k < colors.size(); k++) { plot.getRenderer().setSeriesPaint(k, colors.elementAt(k)); } plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); return chart; }
Example 6
Source File: XYPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * A test for drawing a plot where a series has zero items. With * JFreeChart 1.0.5+cvs this was throwing an exception at one point. */ @Test public void testDrawSeriesWithZeroItems() { DefaultXYDataset dataset = new DefaultXYDataset(); dataset.addSeries("Series 1", new double[][] {{1.0, 2.0}, {3.0, 4.0}}); dataset.addSeries("Series 2", new double[][] {{}, {}}); JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 7
Source File: XYPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Problem to reproduce a bug in serialization. The bug (first reported * against the {@link org.jfree.chart.plot.CategoryPlot} class) is a null * pointer exception that occurs when drawing a plot after deserialization. * It is caused by four temporary storage structures (axesAtTop, * axesAtBottom, axesAtLeft and axesAtRight - all initialized as empty * lists in the constructor) not being initialized by the readObject() * method following deserialization. This test has been written to * reproduce the bug (now fixed). */ @Test public void testSerialization3() { XYSeriesCollection dataset = new XYSeriesCollection(); JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "Domain Axis", "Range Axis", dataset); JFreeChart chart2 = (JFreeChart) TestUtilities.serialised(chart); assertEquals(chart, chart2); try { chart2.createBufferedImage(300, 200); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 8
Source File: XYPlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * A test for bug 1654215 (where a renderer is added to the plot without * a corresponding dataset and it throws an exception at drawing time). */ @Test public void test1654215() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(1, new XYLineAndShapeRenderer()); try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 9
Source File: XYLineAndShapeRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check that the renderer is calculating the domain bounds correctly. */ public void testFindDomainBounds() { XYSeriesCollection dataset = RendererXYPackageTests.createTestXYSeriesCollection(); JFreeChart chart = ChartFactory.createXYLineChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); Range bounds = domainAxis.getRange(); assertFalse(bounds.contains(0.9)); assertTrue(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertFalse(bounds.contains(2.10)); }
Example 10
Source File: GraphData.java From iBioSim with Apache License 2.0 | 6 votes |
public GraphData(String printer_id, String outDir, boolean warn, String printer_track_quantity, String label, XYSeriesCollection dataset, String time, ArrayList<String> learnSpecs) { this.outDir = outDir; this.printer_id = printer_id; this.warn = warn; this.learnSpecs = learnSpecs; graphSpecies = new ArrayList<String>(); graphed = new LinkedList<GraphSpecies>(); chart = ChartFactory.createXYLineChart(label, time, printer_track_quantity, dataset, PlotOrientation.VERTICAL, true, true, false); applyChartTheme(); chart.setBackgroundPaint(new java.awt.Color(238, 238, 238)); chart.getPlot().setBackgroundPaint(java.awt.Color.WHITE); chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.LIGHT_GRAY); chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY); legend = chart.getLegend(); timeSeriesPlot = true; LogX = false; LogY = false; visibleLegend = false; averageOrder = null; resize(dataset); }
Example 11
Source File: XYPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * A test for bug 1654215 (where a renderer is added to the plot without * a corresponding dataset and it throws an exception at drawing time). */ @Test public void test1654215() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(1, new XYLineAndShapeRenderer()); try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example 12
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Checks that a call to the zoomInBoth() method generates just one * ChartChangeEvent. */ public void test2502355_zoomInBoth() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, false); ChartPanel panel = new ChartPanel(chart); chart.addChangeListener(this); this.chartChangeEvents.clear(); panel.zoomInBoth(1.0, 2.0); assertEquals(1, this.chartChangeEvents.size()); }
Example 13
Source File: XYLineAndShapeRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the renderer is calculating the range bounds correctly. */ public void testFindRangeBounds() { TableXYDataset dataset = RendererXYPackageTests.createTestTableXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "X", "Y", dataset, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); Range bounds = rangeAxis.getRange(); assertFalse(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertTrue(bounds.contains(5.0)); assertFalse(bounds.contains(6.0)); }
Example 14
Source File: ChartJFreeChartOutputHeatmap.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void createChart(final IScope scope) { super.createChart(scope); jfreedataset.add(0, new MatrixSeriesCollection()); PlotOrientation orientation = PlotOrientation.VERTICAL; if (reverse_axes) { orientation = PlotOrientation.HORIZONTAL; } chart = ChartFactory.createXYLineChart(getName(), "", "", (MatrixSeriesCollection) jfreedataset.get(0), orientation, true, false, false); }
Example 15
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Checks that a call to the zoomOutDomain() method, for a plot with more * than one domain axis, generates just one ChartChangeEvent. */ public void test2502355_zoomOutDomain() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainAxis(1, new NumberAxis("X2")); ChartPanel panel = new ChartPanel(chart); chart.addChangeListener(this); this.chartChangeEvents.clear(); panel.zoomOutDomain(1.0, 2.0); assertEquals(1, this.chartChangeEvents.size()); }
Example 16
Source File: PulseDistributionTab.java From ProtocolAnalyzer with GNU General Public License v3.0 | 5 votes |
public PulseDistributionTab(RawProtocolMessage message, CTabFolder chartFolder) { distributionData = createPulseDistributionPlot(message.m_PulseLengths); selectedIntervalSeries = new XYSeries("Selected Interval"); distributionData.addSeries(selectedIntervalSeries); CTabItem distributionTab = new CTabItem(chartFolder, SWT.NONE); distributionTab.setText("Pulse length Distribution"); // Create a Chart and a panel for pulse length distribution JFreeChart distributionChart = ChartFactory.createXYLineChart("Pulse Length Distribution", "Pulse Length (us)", "# Pulses", distributionData, PlotOrientation.VERTICAL, true, false, false); ChartPanel distributionChartPanel = new ChartPanel(distributionChart); RawSignalWindow.configurePanelLooks(distributionChart, 2); distributionChartPanel.setPreferredSize(new Dimension(700, 270));// 270 // Make the mark line dashed, so we can see the space line when they overlap float pattern[] = {5.0f, 5.0f}; BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, pattern, 0.0f); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) distributionChart.getXYPlot().getRenderer(); renderer.setSeriesStroke(0, stroke); // Create a ChartComposite on our tab for pulse distribution ChartComposite distributionFrame = new ChartComposite(chartFolder, SWT.NONE, distributionChart, true); distributionFrame.setHorizontalAxisTrace(false); distributionFrame.setVerticalAxisTrace(false); distributionFrame.setDisplayToolTips(true); GridData distributionGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING); distributionGridData.grabExcessHorizontalSpace = true; distributionGridData.grabExcessVerticalSpace = false; distributionGridData.heightHint = 270; distributionFrame.setLayoutData(distributionGridData); distributionTab.setControl(distributionFrame); }
Example 17
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
@Override protected void initComponents() { if (hasAlternativeView()) { getAlternativeView().initComponents(); } JFreeChart chart = ChartFactory.createXYLineChart( CHART_TITLE, DEFAULT_X_AXIS_LABEL, DEFAULT_SAMPLE_DATASET_NAME, new DefaultXYDataset(), PlotOrientation.VERTICAL, true, true, false ); xyPlot = chart.getXYPlot(); xyPlot.setNoDataMessage(NO_DATA_MESSAGE); xyPlot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); ChartPanel profilePlotDisplay = new ChartPanel(chart); profilePlotDisplay.setInitialDelay(200); profilePlotDisplay.setDismissDelay(1500); profilePlotDisplay.setReshowDelay(200); profilePlotDisplay.setZoomTriggerDistance(5); profilePlotDisplay.getPopupMenu().addSeparator(); profilePlotDisplay.getPopupMenu().add(createCopyDataToClipboardMenuItem()); plotSettings = new MetadataPlotSettings(); final BindingContext bindingContext = plotSettings.getContext(); JPanel settingsPanel = createSettingsPanel(bindingContext); createUI(profilePlotDisplay, settingsPanel, (RoiMaskSelector) null); bindingContext.setComponentsEnabled(PROP_NAME_RECORD_START_INDEX, false); bindingContext.setComponentsEnabled(PROP_NAME_RECORDS_PER_PLOT, false); isInitialized = true; updateComponents(); updateChartData(); bindingContext.addPropertyChangeListener(PROP_NAME_METADATA_ELEMENT, evt -> updateUiState()); bindingContext.addPropertyChangeListener(evt -> updateChartData()); }
Example 18
Source File: WinrateHistogramDialog.java From mylizzie with GNU General Public License v3.0 | 4 votes |
private void initCustomComponents() { WinrateHistogramTableModel winrateHistogramTableModel = new WinrateHistogramTableModel(tableWinrateHistory); tableWinrateHistory.setModel(winrateHistogramTableModel); XYSeries blackSeries = new XYSeries("Black"); XYSeries whiteSeries = new XYSeries("White"); XYSeries standardSeries = new XYSeries("50%"); for (int i = 0; i <= 50; ++i) { standardSeries.add(i, 50); } dataSet = new XYSeriesCollection(); dataSet.addSeries(blackSeries); dataSet.addSeries(whiteSeries); dataSet.addSeries(standardSeries); JFreeChart chart = ChartFactory.createXYLineChart( "", // chart title "", // x axis label "Win%", // y axis label dataSet, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.WHITE); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setRange(0.0, 100.0); histogramChartPanel = new ChartPanel(chart); panelWinrateHistogram.add(histogramChartPanel); winrateHistogramTableModel.setRefreshObserver(new Consumer<WinrateHistogramTableModel>() { private long lastRefreshTime = System.currentTimeMillis(); @Override public void accept(WinrateHistogramTableModel model) { long currentTime = System.currentTimeMillis(); if (currentTime - lastRefreshTime < 250L) { return; } lastRefreshTime = currentTime; SwingUtilities.invokeLater(() -> { blackSeries.clear(); whiteSeries.clear(); standardSeries.clear(); for (int i = 0; i < model.getHistogramEntryList().size(); ++i) { WinrateHistogramEntry entry = model.getHistogramEntryList().get(i); standardSeries.add(entry.getMoveNumber(), 50); if (checkBoxHistogramShowBlack.isSelected()) { blackSeries.add(entry.getMoveNumber(), entry.getBlackWinrate()); } if (checkBoxHistogramShowWhite.isSelected()) { whiteSeries.add(entry.getMoveNumber(), entry.getWhiteWinrate()); } } if (model.getHistogramEntryList().size() < 50) { for (int i = model.getHistogramEntryList().size() - 1; i <= 50; ++i) { standardSeries.add(i, 50); } } histogramChartPanel.repaint(); }); } }); setPreferredSize(new Dimension( Lizzie.optionSetting.getWinrateHistogramWindowState().getWidth() , Lizzie.optionSetting.getWinrateHistogramWindowState().getHeight() )); splitPaneHistogram.setDividerLocation(0.3); pack(); histogramChartPanel.setPreferredSize(new Dimension(panelWinrateHistogram.getWidth(), panelWinrateHistogram.getHeight())); histogramChartPanel.setSize(panelWinrateHistogram.getWidth(), panelWinrateHistogram.getHeight()); pack(); }
Example 19
Source File: NumberLineChart.java From EdgeSim with MIT License | 4 votes |
public NumberLineChart() { this.collection = this.getCollection(); initial(); this.chart = ChartFactory.createXYLineChart( null, "Request", "Hit Rate", collection, PlotOrientation.VERTICAL, true, true, false ); this.chart.getPlot().setBackgroundPaint(SystemColor.white); LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis numberAxisX = (NumberAxis) chart.getXYPlot().getDomainAxis(); numberAxisX.setTickUnit(new NumberTickUnit(500)); // numberAxisX.setAutoRangeMinimumSize(0.1); numberAxisX.setAutoRangeIncludesZero(true); numberAxisX.setAxisLineVisible(false); numberAxisX.setTickMarkInsideLength(4f); numberAxisX.setTickMarkOutsideLength(0); NumberAxis numberAxisY = (NumberAxis) chart.getXYPlot().getRangeAxis(); numberAxisY.setTickUnit(new NumberTickUnit(0.2)); numberAxisY.setRangeWithMargins(0,1); numberAxisY.setAutoRangeIncludesZero(true); numberAxisY.setAxisLineVisible(false); numberAxisY.setTickMarkInsideLength(4f); numberAxisY.setTickMarkOutsideLength(0); // ����Y������Ϊ�ٷֱ� numberAxisY.setNumberFormatOverride(NumberFormat.getPercentInstance()); XYItemRenderer xyitem = plot.getRenderer(); xyitem.setDefaultItemLabelsVisible(true); // ItemLabelsVisible(true); xyitem.setDefaultPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); // xyitem.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); // xyitem.setBaseItemLabelFont(new Font("Dialog", 1, 12)); xyitem.setDefaultItemLabelFont(new Font("Dialog", 1, 12)); plot.setRenderer(xyitem); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer)plot.getRenderer(); renderer.setDefaultItemLabelsVisible(true); renderer.setDefaultShapesVisible(true); renderer.setDrawOutlines(true); renderer.setSeriesOutlineStroke(0, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(1, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(2, new BasicStroke(5F)); renderer.setSeriesOutlineStroke(3, new BasicStroke(5F)); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesPaint(1, new Color(53,101,253)); renderer.setSeriesPaint(2, new Color(0,161,59));//����ɫ renderer.setSeriesPaint(3, new Color(148,103,189));//��ɫ renderer.setSeriesStroke(0, new BasicStroke(4.0F)); renderer.setSeriesStroke(1, new BasicStroke(4.0F)); renderer.setSeriesStroke(2, new BasicStroke(4.0F)); renderer.setSeriesStroke(3, new BasicStroke(4.0F)); renderer.setSeriesStroke(4, new BasicStroke(2.0F)); renderer.setSeriesStroke(5, new BasicStroke(2.0F)); this.chartFrame = new ChartFrame("Line Chart", chart); chartFrame.pack(); chartFrame.setSize(1600,1200); chartFrame.setLocation(300,200); chartFrame.setVisible(true); }
Example 20
Source File: DeviationChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private JFreeChart createChart(XYDataset dataset, boolean createLegend) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, createLegend, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customization... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = getColorProvider().getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(LABEL_FONT_BOLD); valueAxis.setTickLabelFont(LABEL_FONT); return chart; }