List of usage examples for org.jfree.chart ChartFactory createTimeSeriesChart
public static JFreeChart createTimeSeriesChart(String title, String timeAxisLabel, String valueAxisLabel, XYDataset dataset, boolean legend, boolean tooltips, boolean urls)
From source file:com.android.ddmuilib.net.NetworkPanel.java
/** * Create chart of recent network activity. *//* w w w. j av a 2 s.c o m*/ private void createChart() { mChart = ChartFactory.createTimeSeriesChart(null, null, null, null, false, false, false); // create backing datasets and series mRxTotalSeries = new TimeSeries("RX total"); mTxTotalSeries = new TimeSeries("TX total"); mRxTotalSeries.setMaximumItemAge(HISTORY_MILLIS); mTxTotalSeries.setMaximumItemAge(HISTORY_MILLIS); mTotalCollection = new TimeSeriesCollection(); mTotalCollection.addSeries(mRxTotalSeries); mTotalCollection.addSeries(mTxTotalSeries); mRxDetailDataset = new LiveTimeTableXYDataset(); mTxDetailDataset = new LiveTimeTableXYDataset(); mTotalRenderer = new XYAreaRenderer(XYAreaRenderer.AREA); mRenderer = new StackedXYAreaRenderer2(); final XYPlot xyPlot = mChart.getXYPlot(); xyPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); xyPlot.setDataset(0, mTotalCollection); xyPlot.setDataset(1, mRxDetailDataset); xyPlot.setDataset(2, mTxDetailDataset); xyPlot.setRenderer(0, mTotalRenderer); xyPlot.setRenderer(1, mRenderer); xyPlot.setRenderer(2, mRenderer); // we control domain axis manually when taking samples mDomainAxis = xyPlot.getDomainAxis(); mDomainAxis.setAutoRange(false); final NumberAxis axis = new NumberAxis(); axis.setNumberFormatOverride(new BytesFormat(true)); axis.setAutoRangeMinimumSize(50); xyPlot.setRangeAxis(axis); xyPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); // draw thick line to separate RX versus TX traffic xyPlot.addRangeMarker(new ValueMarker(0, java.awt.Color.BLACK, new java.awt.BasicStroke(2))); // label to indicate that positive axis is RX traffic final ValueMarker rxMarker = new ValueMarker(0); rxMarker.setStroke(new java.awt.BasicStroke(0)); rxMarker.setLabel("RX"); rxMarker.setLabelFont(rxMarker.getLabelFont().deriveFont(30f)); rxMarker.setLabelPaint(java.awt.Color.LIGHT_GRAY); rxMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT); rxMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); xyPlot.addRangeMarker(rxMarker); // label to indicate that negative axis is TX traffic final ValueMarker txMarker = new ValueMarker(0); txMarker.setStroke(new java.awt.BasicStroke(0)); txMarker.setLabel("TX"); txMarker.setLabelFont(txMarker.getLabelFont().deriveFont(30f)); txMarker.setLabelPaint(java.awt.Color.LIGHT_GRAY); txMarker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT); txMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); xyPlot.addRangeMarker(txMarker); mChartComposite = new ChartComposite(mPanel, SWT.BORDER, mChart, ChartComposite.DEFAULT_WIDTH, ChartComposite.DEFAULT_HEIGHT, ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH, ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT, 4096, 4096, true, true, true, true, false, true); final FormData data = new FormData(); data.top = new FormAttachment(mHeader); data.left = new FormAttachment(0); data.bottom = new FormAttachment(70); data.right = new FormAttachment(100); mChartComposite.setLayoutData(data); }
From source file:org.openiot.gsn.vsensor.ChartVirtualSensor.java
public void initialize() { if (!ready) { chart = ChartFactory.createTimeSeriesChart(plotTitle, "Time", verticalAxisTitle, dataCollectionForTheChart, true, true, false); chart.setBorderVisible(true);/*w ww .j a va 2 s. c o m*/ ready = true; if (logger.isDebugEnabled()) logger.debug("The Chart Virtual Sensor is ready."); } }
From source file:de.tsystems.mms.apm.performancesignature.PerfSigBuildActionResultsDisplay.java
private JFreeChart createTimeSeriesChart(final StaplerRequest req, final XYDataset dataset) throws UnsupportedEncodingException { String chartDashlet = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamChartDashlet()); String measure = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamMeasure()); String unit = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamUnit()); String color = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()); if (StringUtils.isBlank(color)) color = Messages.PerfSigBuildActionResultsDisplay_DefaultColor(); else/* w ww. java 2 s.co m*/ URLDecoder.decode(req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()), "UTF-8"); String[] timeUnits = { "ns", "ms", "s", "min", "h" }; JFreeChart chart; if (ArrayUtils.contains(timeUnits, unit)) { chart = ChartFactory.createTimeSeriesChart(PerfSigUtils.generateTitle(measure, chartDashlet), // title "time", // domain axis label unit, dataset, // data false, // include legend false, // tooltips false // urls ); } else { chart = ChartFactory.createXYBarChart(PerfSigUtils.generateTitle(measure, chartDashlet), // title "time", // domain axis label true, unit, (IntervalXYDataset) dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend false, // tooltips false // urls ); } XYPlot xyPlot = chart.getXYPlot(); xyPlot.setForegroundAlpha(0.8f); xyPlot.setRangeGridlinesVisible(true); xyPlot.setRangeGridlinePaint(Color.black); xyPlot.setOutlinePaint(null); XYItemRenderer xyitemrenderer = xyPlot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); } DateAxis dateAxis = (DateAxis) xyPlot.getDomainAxis(); dateAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss")); xyitemrenderer.setSeriesPaint(0, Color.decode(color)); xyitemrenderer.setSeriesStroke(0, new BasicStroke(2)); chart.setBackgroundPaint(Color.white); return chart; }
From source file:ac.openmicrolabs.view.gui.OMLLoggerView.java
private JPanel createContentPane(final TimeSeriesCollection t, final String graphTitle, final double graphTimeRange, final String[] signals) { btmPanel.remove(reportButton);/*from ww w. java2 s . co m*/ chanLabel = new JLabel[signals.length]; int activeSignalCount = 0; for (int i = 0; i < signals.length; i++) { chanLabel[i] = new JLabel(h.format("label", (char) ((i / PIN_COUNT) + ASCII_OFFSET) + "-0x" + String.format("%02x", (i % PIN_COUNT) + SLAVE_BITS).toUpperCase())); chanLabel[i].setHorizontalAlignment(JLabel.CENTER); if (signals[i] != null) { activeSignalCount++; } else { chanLabel[i].setEnabled(false); } } typeLabel = new JLabel[activeSignalCount]; valLabel = new JLabel[activeSignalCount]; minLabel = new JLabel[activeSignalCount]; maxLabel = new JLabel[activeSignalCount]; avgLabel = new JLabel[activeSignalCount]; int index = 0; for (int i = 0; i < signals.length; i++) { if (signals[i] != null) { typeLabel[index] = new JLabel(h.format("body", signals[i])); typeLabel[index].setHorizontalAlignment(JLabel.CENTER); index++; } } for (int i = 0; i < activeSignalCount; i++) { valLabel[i] = new JLabel(); valLabel[i].setHorizontalAlignment(JLabel.CENTER); minLabel[i] = new JLabel(); minLabel[i].setHorizontalAlignment(JLabel.CENTER); maxLabel[i] = new JLabel(); maxLabel[i].setHorizontalAlignment(JLabel.CENTER); avgLabel[i] = new JLabel(); avgLabel[i].setHorizontalAlignment(JLabel.CENTER); } // Set up main panel. JPanel mainPanel = new JPanel(); mainPanel.setLayout(null); mainPanel.setBackground(Color.white); // Create graph. snsChart = ChartFactory.createTimeSeriesChart(graphTitle, GRAPH_X_LABEL, GRAPH_Y_LABEL, t, true, true, false); final XYPlot plot = snsChart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(graphTimeRange); axis = plot.getRangeAxis(); axis.setRange(graphMinY, graphMaxY); ChartPanel snsChartPanel = new ChartPanel(snsChart); snsChartPanel.setPreferredSize(new Dimension(FRAME_WIDTH - PAD20, GRAPH_HEIGHT - PAD10)); // Set up graph panel. final JPanel graphPanel = new JPanel(); graphPanel.setSize(FRAME_WIDTH - PAD20, GRAPH_HEIGHT); graphPanel.setLocation(0, 0); graphPanel.setBackground(Color.white); graphPanel.add(snsChartPanel); // Set up results panel. final JPanel resultsPanel = createResultsPane(); // Set up scroll pane. final JScrollPane scrollPane = new JScrollPane(resultsPanel); scrollPane.setSize(FRAME_WIDTH - PAD20, FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT + PAD8); scrollPane.setLocation(PAD5, GRAPH_HEIGHT); scrollPane.setBackground(Color.white); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Set results panel size. resultsPanel.setPreferredSize(new Dimension(PAD40 + (signals.length * RESULTS_COL_WIDTH), FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT - PAD120)); resultsPanel.revalidate(); // Set up bottom panel. btmPanel.setLayout(null); btmPanel.setSize(FRAME_WIDTH, BTM_HEIGHT); btmPanel.setLocation(0, this.getHeight() - BTM_HEIGHT); btmPanel.setBackground(Color.white); // Instantiate bottom panel objects. footerLabel.setSize(LABEL_WIDTH, LABEL_HEIGHT); footerLabel.setLocation(LABEL_X, LABEL_Y); footerLabel.setText(""); doneButton.setIcon(new ImageIcon("img/22x22/stop.png")); doneButton.setSize(DONE_WIDTH, DONE_HEIGHT); doneButton.setLocation(FRAME_WIDTH - PAD20 - doneButton.getWidth(), PAD15); progressBar = new JProgressBar(); progressBar.setSize(FRAME_WIDTH - PAD40 - doneButton.getWidth() - footerLabel.getWidth(), PAD20); progressBar.setValue(0); progressBar.setLocation(footerLabel.getWidth() + PAD10, PAD22); // Populate bottom panel. btmPanel.add(footerLabel); btmPanel.add(progressBar); btmPanel.add(doneButton); // Populate main panel. mainPanel.add(graphPanel); mainPanel.add(scrollPane); mainPanel.add(btmPanel); return mainPanel; }
From source file:compecon.dashboard.panel.HouseholdsPanel.java
protected ChartPanel createUtilityPanel(Currency currency) { TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection(); timeSeriesCollection.addSeries(ApplicationContext.getInstance().getModelRegistry() .getNationalEconomyModel(currency).householdsModel.utilityModel.utilityOutputModel.getTimeSeries()); for (GoodType inputGoodType : ApplicationContext.getInstance().getModelRegistry() .getNationalEconomyModel(currency).householdsModel.utilityModel.utilityInputModels.keySet()) { timeSeriesCollection.addSeries(ApplicationContext.getInstance().getModelRegistry() .getNationalEconomyModel(currency).householdsModel.utilityModel.utilityInputModels .get(inputGoodType).getTimeSeries()); }//from www .j a va2 s.c om JFreeChart chart = ChartFactory.createTimeSeriesChart("Households Utility", "Date", "Utility", (XYDataset) timeSeriesCollection, true, true, false); configureChart(chart); return new ChartPanel(chart); }
From source file:gsn.vsensor.ChartVirtualSensor.java
public void initialize() { if (!ready) { chart = ChartFactory.createTimeSeriesChart(plotTitle, "Time", verticalAxisTitle, dataCollectionForTheChart, true, true, false); chart.setBorderVisible(true);// ww w . j av a 2 s . c o m ready = true; logger.debug("The Chart Virtual Sensor is ready."); } }
From source file:studio.ui.LineChart.java
public static JFreeChart createDataset(KTableModel table) { TimeZone tz = TimeZone.getTimeZone("GMT"); XYDataset ds = null;//from ww w . j a v a2 s . c om if (table.getColumnCount() > 0) { Class klass = table.getColumnClass(0); if ((klass == K.KTimestampVector.class) || (klass == K.KTimespanVector.class) || (klass == K.KDateVector.class) || (klass == K.KTimeVector.class) || (klass == K.KMonthVector.class) || (klass == K.KMinuteVector.class) || (klass == K.KSecondVector.class) || (klass == K.KDatetimeVector.class)) { TimeSeriesCollection tsc = new TimeSeriesCollection(tz); for (int col = 1; col < table.getColumnCount(); col++) { TimeSeries series = null; try { if (klass == K.KDateVector.class) { series = new TimeSeries(table.getColumnName(col), Day.class); K.KDateVector dates = (K.KDateVector) table.getColumn(0); for (int row = 0; row < dates.getLength(); row++) { K.KDate date = (K.KDate) dates.at(row); Day day = new Day(date.toDate(), tz); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(day, ((ToDouble) o).toDouble()); } } else if (klass == K.KTimeVector.class) { series = new TimeSeries(table.getColumnName(col), Millisecond.class); K.KTimeVector times = (K.KTimeVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.KTime time = (K.KTime) times.at(row); Millisecond ms = new Millisecond(time.toTime(), tz); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(ms, ((ToDouble) o).toDouble()); } } else if (klass == K.KTimestampVector.class) { series = new TimeSeries(table.getColumnName(col), Day.class); K.KTimestampVector dates = (K.KTimestampVector) table.getColumn(0); for (int row = 0; row < dates.getLength(); row++) { K.KTimestamp date = (K.KTimestamp) dates.at(row); Day day = new Day(new java.util.Date(date.toTimestamp().getTime()), tz); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(day, ((ToDouble) o).toDouble()); } } else if (klass == K.KTimespanVector.class) { series = new TimeSeries(table.getColumnName(col), Millisecond.class); K.KTimespanVector times = (K.KTimespanVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.KTimespan time = (K.KTimespan) times.at(row); Millisecond ms = new Millisecond(time.toTime(), tz); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(ms, ((ToDouble) o).toDouble()); } } else if (klass == K.KDatetimeVector.class) { series = new TimeSeries(table.getColumnName(col), Millisecond.class); K.KDatetimeVector times = (K.KDatetimeVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.KDatetime time = (K.KDatetime) times.at(row); Millisecond ms = new Millisecond(time.toTimestamp(), tz); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(ms, ((ToDouble) o).toDouble()); } } else if (klass == K.KMonthVector.class) { series = new TimeSeries(table.getColumnName(col), Month.class); K.KMonthVector times = (K.KMonthVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.Month time = (K.Month) times.at(row); int m = time.i + 24000; int y = m / 12; m = 1 + m % 12; Month month = new Month(m, y); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(month, ((ToDouble) o).toDouble()); } } else if (klass == K.KSecondVector.class) { series = new TimeSeries(table.getColumnName(col), Second.class); K.KSecondVector times = (K.KSecondVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.Second time = (K.Second) times.at(row); Second second = new Second(time.i % 60, time.i / 60, 0, 1, 1, 2001); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(second, ((ToDouble) o).toDouble()); } } else if (klass == K.KMinuteVector.class) { series = new TimeSeries(table.getColumnName(col), Minute.class); K.KMinuteVector times = (K.KMinuteVector) table.getColumn(0); for (int row = 0; row < table.getRowCount(); row++) { K.Minute time = (K.Minute) times.at(row); Minute minute = new Minute(time.i % 60, time.i / 60, 1, 1, 2001); Object o = table.getValueAt(row, col); if (o instanceof K.KBase) if (!((K.KBase) o).isNull()) if (o instanceof ToDouble) series.addOrUpdate(minute, ((ToDouble) o).toDouble()); } } } catch (SeriesException e) { System.err.println("Error adding to series"); } if (series.getItemCount() > 0) tsc.addSeries(series); } ds = tsc; } else if ((klass == K.KDoubleVector.class) || (klass == K.KFloatVector.class) || (klass == K.KShortVector.class) || (klass == K.KIntVector.class) || (klass == K.KLongVector.class)) { XYSeriesCollection xysc = new XYSeriesCollection(); for (int col = 1; col < table.getColumnCount(); col++) { XYSeries series = null; try { series = new XYSeries(table.getColumnName(col)); for (int row = 0; row < table.getRowCount(); row++) { double x = ((ToDouble) table.getValueAt(row, 0)).toDouble(); double y = ((ToDouble) table.getValueAt(row, col)).toDouble(); series.add(x, y); } } catch (SeriesException e) { System.err.println("Error adding to series"); } if (series.getItemCount() > 0) xysc.addSeries(series); } ds = xysc; } } if (ds != null) { boolean legend = false; if (ds.getSeriesCount() > 1) legend = true; if (ds instanceof XYSeriesCollection) return ChartFactory.createXYLineChart("", "", "", ds, PlotOrientation.VERTICAL, legend, true, true); else if (ds instanceof TimeSeriesCollection) return ChartFactory.createTimeSeriesChart("", "", "", ds, legend, true, true); } return null; }
From source file:info.financialecology.finance.utilities.datastruct.VersatileChart.java
public JFreeChart drawTimeSeries(ArrayList<VersatileTimeSeries> atsArray) { JFreeChart chart;/* www . j a va 2s . c om*/ ArrayList<String> visibleKeys = new ArrayList<String>(); if (params.ticks) { XYSeriesCollection dataSet = new XYSeriesCollection(); for (VersatileTimeSeries ats : atsArray) { XYSeries xySeries = new XYSeries(ats.getKey()); dataSet.addSeries(xySeries); for (int i = 0; i < ats.getItemCount(); i++) xySeries.add(i, ats.getValue(i)); } chart = ChartFactory.createXYLineChart(params.title, params.xLabel, params.yLabel, dataSet, PlotOrientation.VERTICAL, params.legend, params.toolTips, false); if (params.autoRange) { Range currentRange = dataSet.getRangeBounds(true); Range newRange = new Range((1 - params.autoRangePadding) * currentRange.getLowerBound(), (1 + params.autoRangePadding) * currentRange.getUpperBound()); chart.getXYPlot().getRangeAxis().setRange(newRange); } } else { TimeSeriesCollection dataSet = new TimeSeriesCollection(); for (VersatileTimeSeries ats : atsArray) { dataSet.addSeries(ats); visibleKeys.add((String) ats.getKey()); } chart = ChartFactory.createTimeSeriesChart(params.title, params.xLabel, params.yLabel, dataSet, params.legend, params.toolTips, false); if (params.autoRange) { Range currentRange = dataSet.getRangeBounds(visibleKeys, dataSet.getDomainBounds(true), true); Range newRange = new Range((1 - params.autoRangePadding) * currentRange.getLowerBound(), (1 + params.autoRangePadding) * currentRange.getUpperBound()); chart.getXYPlot().getRangeAxis().setRange(newRange); } } return chart; }
From source file:lu.lippmann.cdb.common.gui.ts.TimeSeriesChartUtil.java
public static ChartPanel buildChartPanelForAllAttributes(final Instances dataSet, final boolean multAxis, final int dateIdx, final Color color, final Collection<XYAnnotation> annotations) { final TimeSeriesCollection tsDataset = new TimeSeriesCollection(); final JFreeChart tsChart = ChartFactory.createTimeSeriesChart("", "Time", "Value", tsDataset, true, true, false);//from w w w . j a v a2s . co m tsChart.getXYPlot().setBackgroundPaint(Color.WHITE); // optimized renderer to avoid to print all points tsChart.getXYPlot().setRenderer(new SamplingXYLineRenderer()); //tsChart.getXYPlot().setRenderer(new XYStepRenderer()); if (color == null) { for (int i = 0; i < dataSet.numAttributes() - 1; i++) { final String attrName = dataSet.attribute(i).name(); tsChart.getXYPlot().getRenderer().setSeriesPaint(i, ColorHelper.getColorForAString(attrName)); } } else { tsChart.getXYPlot().getRenderer().setSeriesPaint(0, color); } if (annotations != null) { for (final XYAnnotation aa : annotations) tsChart.getXYPlot().addAnnotation(aa); } if (multAxis) fillWithMultipleAxis(dataSet, dateIdx, tsDataset, tsChart); else fillWithSingleAxis(dataSet, dateIdx, tsDataset); final ChartPanel cp = new ChartPanel(tsChart, true); if (dataSet.numAttributes() <= 2) cp.setBorder(new TitledBorder(dataSet.attribute(0).name())); return cp; }
From source file:net.vanosten.dings.swing.SummaryView.java
public void displayTimeSeriesChart(final TimeSeriesCollection averageScore, final int maxScoreRange, final TimeSeriesCollection numberOfEntries, final int maxTotalRange) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Average Score", averageScore, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYItemRenderer renderer1 = plot.getRenderer(); renderer1.setPaint(Color.blue); //axis 1//w ww . ja v a2s. c o m final NumberAxis axis1 = new NumberAxis("Average Score"); axis1.setLabelPaint(Color.blue); axis1.setTickLabelPaint(Color.blue); axis1.setRange(0.0d, maxScoreRange + 1); plot.setRangeAxis(0, axis1); //axis 2 final NumberAxis axis2 = new NumberAxis("Number of Entries"); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); axis2.setRange(0.0d, 10 * (((int) (maxTotalRange / 10)) + 1)); plot.setRangeAxis(1, axis2); plot.setDataset(1, numberOfEntries); plot.mapDatasetToRangeAxis(1, 1); final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setPaint(Color.red); plot.setRenderer(1, renderer2); placeChart(chart); }