List of usage examples for org.jfree.chart JFreeChart getCategoryPlot
public CategoryPlot getCategoryPlot()
From source file:UserInterface.CustomerRole.CustomerTaxJPanel.java
public void displayChart(Date date1) { int total = 0; int k;// w ww. ja v a 2 s .co m int count = 0; int avg = 0; Sensor s = (Sensor) jTable1.getValueAt(0, 0); Date b = s.getDate(); DateFormat formatter = new SimpleDateFormat("MM/dd/yy"); Date date = new Date(); try { date = formatter.parse("12/11/16"); } catch (Exception e) { } //date = System.out.println(jTable1.getValueAt(0, 5)); System.out.println(jTable1.getValueAt(0, 4)); list = new ArrayList<>(); for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getCurrentEmissionCO2(); count++; } } avg = total / count; list.add(avg); int avg1 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getCurrentEmissionCO2(); count++; } } avg = total / count; list.add(avg); for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getNormalCO2(); count++; } } avg1 = total / count; int avg3 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getCurrentEmissionNOx(); count++; } } avg3 = total / count; int avg4 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getNormalNOx(); count++; } } avg4 = total / count; int avg5 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getSolarCurrentEmissionCO2(); count++; } } avg5 = total / count; int avg6 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getSolarNormalCO2(); count++; } } avg6 = total / count; int avg7 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getSolarCurrentEmissionNOx(); count++; } } avg7 = total / count; int avg8 = 0; for (int l = 0; l < jTable1.getRowCount(); l++) { if (date.getDate() == b.getDate()) { Sensor s1 = (Sensor) jTable1.getValueAt(l, 0); total = total + s1.getSolarNormalNOx(); count++; } } avg8 = total / count; int combo = avg + avg3; int combo1 = avg5 + avg7; DefaultPieDataset dataset22 = new DefaultPieDataset(); dataset22.setValue("Fuel Emission", new Integer(combo)); dataset22.setValue("Solar Emission ", new Integer(combo1)); JFreeChart chart22 = ChartFactory.createPieChart3D("Comparison Chart ", // chart title dataset22, // data true, // include legend true, false); final PiePlot3D plot = (PiePlot3D) chart22.getPlot(); plot.setStartAngle(270); plot.setForegroundAlpha(0.60f); plot.setInteriorGap(0.02); ChartFrame frame33 = new ChartFrame("3D Pie Chart for EMission Comparison from different sources", chart22); frame33.setVisible(true); frame33.setSize(500, 400); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(avg, b, "curr CO2"); dataset.setValue(avg1, b, "normal CO2"); dataset.setValue(avg3, b, "current NOx"); dataset.setValue(avg4, b, "normal NOx"); //dataset.setValue(a1,b1,"current"); JFreeChart chart = ChartFactory.createBarChart("Normal Fuel Emission Chart", "CO2 Emission", "in (g/KM)", dataset, PlotOrientation.VERTICAL, false, false, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("Bar Chart for Customer", chart); frame.setVisible(true); frame.setSize(500, 400); DefaultCategoryDataset dataset1 = new DefaultCategoryDataset(); dataset1.setValue(avg5, b, "curr CO2"); dataset1.setValue(avg6, b, "normal CO2"); dataset1.setValue(avg7, b, "current NOx"); dataset1.setValue(avg8, b, "normal NOx"); //dataset.setValue(a1,b1,"current"); JFreeChart chart2 = ChartFactory.createBarChart("Solar Emission Chart", "CO2 Emission", "in (g/KM)", dataset1, PlotOrientation.VERTICAL, false, false, false); CategoryPlot p1 = chart.getCategoryPlot(); p1.setRangeGridlinePaint(Color.BLACK); ChartFrame frame1 = new ChartFrame("Bar Chart for Customer", chart2); frame1.setVisible(true); frame1.setSize(500, 400); }
From source file:com.pusksesmas.form_statistik.statistik_obat_masuk.java
private void tabelDataMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelDataMouseClicked if (vpil.getSelectedIndex() == 1) { int row = tabelData.getSelectedRow(); String namaObat = (tabelData.getModel().getValueAt(row, 0)).toString(); String jan = (tabelData.getModel().getValueAt(row, 1)).toString(); String feb = (tabelData.getModel().getValueAt(row, 2)).toString(); String mar = (tabelData.getModel().getValueAt(row, 3)).toString(); String apr = (tabelData.getModel().getValueAt(row, 4)).toString(); String mei = (tabelData.getModel().getValueAt(row, 5)).toString(); String jun = (tabelData.getModel().getValueAt(row, 6)).toString(); String jul = (tabelData.getModel().getValueAt(row, 7)).toString(); String agus = (tabelData.getModel().getValueAt(row, 8)).toString(); String sept = (tabelData.getModel().getValueAt(row, 9)).toString(); String okt = (tabelData.getModel().getValueAt(row, 10)).toString(); String nov = (tabelData.getModel().getValueAt(row, 11)).toString(); String des = (tabelData.getModel().getValueAt(row, 12)).toString(); DefaultCategoryDataset pieDataset = new DefaultCategoryDataset(); // pieDataset.setValue("Diagnosa", new Integer(jan)); pieDataset.setValue(new Integer(jan), "", "Januari"); pieDataset.setValue(new Integer(feb), "", "Februari"); pieDataset.setValue(new Integer(mar), "", "Maret"); pieDataset.setValue(new Integer(apr), "", "April"); pieDataset.setValue(new Integer(mei), "", "Mei"); pieDataset.setValue(new Integer(jun), "", "Juni"); pieDataset.setValue(new Integer(jul), "", "Juli"); pieDataset.setValue(new Integer(agus), "", "Agustus"); pieDataset.setValue(new Integer(sept), "", "September"); pieDataset.setValue(new Integer(okt), "", "Oktober"); pieDataset.setValue(new Integer(nov), "", "November"); pieDataset.setValue(new Integer(des), "", "Desember"); JFreeChart chart = ChartFactory.createBarChart3D("STATISTIK PENERIMAAN OBAT\nNAMA OBAT: " + namaObat, "BULAN", "JUMLAH", (CategoryDataset) pieDataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.yellow); chart.getTitle().setPaint(Color.red); final CategoryPlot p = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) p.getRenderer(); DecimalFormat sdf = new DecimalFormat("#,##0"); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", sdf)); p.setRenderer(renderer);/*from w ww .ja v a2 s . c o m*/ renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER)); renderer.setItemLabelsVisible(true); chart.getCategoryPlot().setRenderer(renderer); p.setRangeGridlinePaint(Color.blue); ChartFrame frame = new ChartFrame("barchart", chart); frame.setVisible(true); frame.setLocation(250, 100); frame.setSize(800, 600); } else if (vpil.getSelectedIndex() == 2) { int row = tabelData.getSelectedRow(); String jan = (tabelData.getModel().getValueAt(row, 1)).toString(); String feb = (tabelData.getModel().getValueAt(row, 2)).toString(); String mar = (tabelData.getModel().getValueAt(row, 3)).toString(); String apr = (tabelData.getModel().getValueAt(row, 4)).toString(); String mei = (tabelData.getModel().getValueAt(row, 5)).toString(); String jun = (tabelData.getModel().getValueAt(row, 6)).toString(); String jul = (tabelData.getModel().getValueAt(row, 7)).toString(); String agus = (tabelData.getModel().getValueAt(row, 8)).toString(); String sept = (tabelData.getModel().getValueAt(row, 9)).toString(); String okt = (tabelData.getModel().getValueAt(row, 10)).toString(); String nov = (tabelData.getModel().getValueAt(row, 11)).toString(); String des = (tabelData.getModel().getValueAt(row, 12)).toString(); DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Januari", new Integer(jan)); pieDataset.setValue("Februari", new Integer(feb)); pieDataset.setValue("Maret", new Integer(mar)); pieDataset.setValue("April", new Integer(apr)); pieDataset.setValue("Mei", new Integer(mei)); pieDataset.setValue("Juni", new Integer(jun)); pieDataset.setValue("Juli", new Integer(jul)); pieDataset.setValue("Agustus", new Integer(agus)); pieDataset.setValue("September", new Integer(sept)); pieDataset.setValue("Oktober", new Integer(okt)); pieDataset.setValue("November", new Integer(nov)); pieDataset.setValue("Desember", new Integer(des)); JFreeChart chart = ChartFactory.createPieChart("STATISTIK PENERIMAAN OBAT", pieDataset, true, true, true); // PiePlot3D P = (PiePlot3D)chart.getPlot(); PiePlot P = (PiePlot) chart.getPlot(); //P.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("STATISTIK PENERIMAAN OBAT", chart); frame.setVisible(true); frame.setLocation(250, 100); frame.setSize(800, 600); } else { } }
From source file:j2se.jfreechart.barchart.BarChartDemo2.java
/** * Creates a chart.// ww w . ja v a 2 s.c o m * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 2", // chart title "Category", // domain axis label "Score (%)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(0.0, 100.0); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.BarChartExpression.java
public JFreeChart computeCategoryChart(final CategoryDataset categoryDataset) { final PlotOrientation orientation = computePlotOrientation(); final JFreeChart chart; if (isThreeD()) { if (isStacked()) { chart = ChartFactory.createStackedBarChart3D(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } else {//w ww . ja va 2s. c om chart = ChartFactory.createBarChart3D(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis3D(getCategoryAxisLabel(), getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale())); } else { if (isStacked()) { chart = ChartFactory.createStackedBarChart(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } else { chart = ChartFactory.createBarChart(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis(getCategoryAxisLabel(), getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale())); } final CategoryPlot plot = (CategoryPlot) chart.getPlot(); configureLogarithmicAxis(plot); return chart; }
From source file:org.jfree.chart.demo.BarChartDemo2.java
/** * Creates a chart./*from w ww .jav a 2s. c o m*/ * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 2", // chart title "Category", // domain axis label "Score (%)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(0.0, 100.0); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:GUI.Framedashboard.java
public void stat() { Statestique st = new Statestique(); int u = st.nbUser(); int f = st.nbfemme(); int h = u - f; int p = st.nbProduit(); int s = st.nbService(); int c = st.nbComment(); int pp = st.nbPauP(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(s, "", "Service"); dataset.setValue(p, "", "Produit"); JFreeChart chart = ChartFactory.createBarChart("Service et Produit", null, null, dataset, PlotOrientation.VERTICAL, false, false, false); CategoryPlot cp = chart.getCategoryPlot(); // cp.setRangeGridlinePaint(Color.BLACK); ChartPanel chp = new ChartPanel(chart); jPanel5.removeAll();//from ww w. j av a 2s .co m jPanel5.add(chp); jPanel5.validate(); DefaultCategoryDataset ds = new DefaultCategoryDataset(); ds.setValue(pp, "", "Commande"); ds.setValue(c, "", "Commentaire"); JFreeChart cht = ChartFactory.createBarChart("Graphe de Commentaire & Commande", null, null, ds, PlotOrientation.VERTICAL, false, false, false); CategoryPlot catp = chart.getCategoryPlot(); // catp.setRangeGridlinePaint(Color.BLACK); ChartPanel chartp = new ChartPanel(cht); jPanel6.removeAll(); jPanel6.add(chartp); jPanel6.validate(); DefaultPieDataset pds = new DefaultPieDataset(); pds.setValue("Femme", new Integer(f)); pds.setValue("Homme", new Integer(h)); JFreeChart chartpie = ChartFactory.createPieChart("Genre", pds, true, true, false); PiePlot plot = (PiePlot) chartpie.getPlot(); ChartPanel chartpiepanel = new ChartPanel(chartpie); jPanel7.removeAll(); jPanel7.add(chartpiepanel); jPanel7.validate(); }
From source file:com.att.aro.ui.view.overviewtab.ConnectionStatisticsChartPanel.java
public JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createBarChart( ResourceBundleHelper.getMessageString("overview.sessionoverview.title"), null, null, createDataset(), PlotOrientation.HORIZONTAL, false, false, false); chart.setBackgroundPaint(this.getBackground()); chart.getTitle().setFont(AROUIManager.HEADER_FONT); this.plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setMaximumCategoryLabelWidthRatio(1.0f); domainAxis.setMaximumCategoryLabelLines(2); domainAxis.setLabelFont(AROUIManager.LABEL_FONT); domainAxis.setTickLabelFont(AROUIManager.LABEL_FONT); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabel(ResourceBundleHelper.getMessageString("analysisresults.percentage")); rangeAxis.setRange(0.0, 100.0);// ww w . j a va2s. c om rangeAxis.setTickUnit(new NumberTickUnit(10)); rangeAxis.setLabelFont(AROUIManager.LABEL_FONT); rangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT); BarRenderer renderer = new StackedBarRenderer(); renderer.setBasePaint(AROUIManager.CHART_BAR_COLOR); renderer.setAutoPopulateSeriesPaint(false); renderer.setBaseItemLabelGenerator(new PercentLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.black); // Make second bar in stack invisible renderer.setSeriesItemLabelsVisible(1, false); renderer.setSeriesPaint(1, new Color(0, 0, 0, 0)); ItemLabelPosition insideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT); renderer.setBasePositiveItemLabelPosition(insideItemlabelposition); ItemLabelPosition outsideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT); renderer.setPositiveItemLabelPositionFallback(outsideItemlabelposition); renderer.setBarPainter(new StandardBarPainter()); renderer.setShadowVisible(false); renderer.setMaximumBarWidth(BAR_WIDTH_PERCENT); renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() { @Override public String generateToolTip(CategoryDataset arg0, int arg1, int arg2) { String sessionInfo = ""; switch (arg2) { case SESSION_TERMINATION: sessionInfo = ResourceBundleHelper.getMessageString("tooltip.sessionTermination"); break; case SESSION_TIGHT_CONN: sessionInfo = ResourceBundleHelper.getMessageString("tooltip.sessionTightConn"); break; case SESSION_BURST: sessionInfo = ResourceBundleHelper.getMessageString("tooltip.sessionBurst"); break; case SESSION_LONG_BURST: sessionInfo = ResourceBundleHelper.getMessageString("tooltip.sessionLongBurst"); break; default: break; } return sessionInfo; } }); plot.setRenderer(renderer); plot.getDomainAxis().setMaximumCategoryLabelLines(2); return chart; }
From source file:UserInterface.PatientRole.ManageMyVitalSignsAndFitnessRecordJPanel.java
private void createChart() { DefaultCategoryDataset vitalSignDataset = new DefaultCategoryDataset(); int selectedRow = viewVitalSignsJTable1.getSelectedRow(); ArrayList<Record> recordList = patient.getRecordHistory().getRecordList(); /*At least 2 vital sign records needed to show chart */ if (recordList.isEmpty() || recordList.size() == 1) { JOptionPane.showMessageDialog(this, "No Fitness Record or only one fitness record found. At least 2 fitness records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE); return;/*from w w w. ja v a 2s. c o m*/ } for (Record record : recordList) { vitalSignDataset.addValue(record.getStandTime(), "StandTime", record.getDate()); vitalSignDataset.addValue(record.getMoveTime(), "MoveTime", record.getDate()); vitalSignDataset.addValue(record.getExcerciseTime(), "ExcerciseTime", record.getDate()); vitalSignDataset.addValue(record.getTotalTime(), "TotalTime", record.getDate()); } JFreeChart vitalSignChart = ChartFactory.createBarChart3D("Fitness Record Chart", "Time Stamp", "Time(mins)", vitalSignDataset, PlotOrientation.VERTICAL, true, false, false); vitalSignChart.setBackgroundPaint(Color.white); CategoryPlot vitalSignChartPlot = vitalSignChart.getCategoryPlot(); vitalSignChartPlot.setBackgroundPaint(Color.lightGray); CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis(); vitalSignDomainAxis .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis(); vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartFrame chartFrame = new ChartFrame("Chart", vitalSignChart); chartFrame.setVisible(true); chartFrame.setSize(500, 500); }
From source file:com.softidea.www.private_access.adminstrator.admin_index.java
private void loadChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); JFreeChart chart = ChartFactory.createLineChart("Income ,Cost ,Profit & Returns", "Details", "Values", createDataset(), PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.WHITE); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); // ChartFrame frame = new ChartFrame("Full Report", chart); ChartPanel panel = new ChartPanel(chart); // panel.setSize(jp_loadChart.getWidth(), jp_loadChart.getHeight()); panel.setPreferredSize(new Dimension(658, 384)); jp_loadChart.removeAll();//from w w w . ja v a2 s .c o m jp_loadChart.setLayout(new FlowLayout()); jp_loadChart.add(panel); panel.setVisible(true); jp_loadChart.updateUI(); }
From source file:com.thalesgroup.hudson.plugins.klocwork.graph.KloTrendGraph.java
@Override protected JFreeChart createGraph() { final JFreeChart chart = ChartFactory.createLineChart(null, // chart title null, // unused yLabel, // range axis label categoryDataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls );/*from w ww .j ava 2 s . co m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... final LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = chart.getCategoryPlot(); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); 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.setLowerBound(0); rangeAxis.setAutoRange(true); final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseStroke(new BasicStroke(2.0f)); ColorPalette.apply(renderer); // crop extra space around the graph plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0)); return chart; }