private void addChart3c() { List<SimpleNumberSeries<Double>> lines = new ArrayList<SimpleNumberSeries<Double>>(); lines.add(new SimpleNumberSeries<Double>(4.0, 2.0, 9.0, 16.0)); lines.add(new SimpleNumberSeries<Double>(3.0, 7.0, 6.25, 3.125)); JQPlot chart3c = new JQPlot("chart3c", new ListModel<SimpleNumberSeries<Double>>(lines)); PlotOptions chart3cO = chart3c.getOptions(); chart3cO.getLegend().setShow(true).setLocation(PlotLegendLocation.nw); chart3cO.setTitle("Unit Sales: Acme Decoy Division"); chart3cO.getSeriesDefaults().setRenderer("$.jqplot.BarRenderer"); PlotBarRendererOptions renderOptions = new PlotBarRendererOptions(); renderOptions.setBarPadding(6.0); renderOptions.setBarMargin(20.0); chart3cO.getSeriesDefaults().setRendererOptions(renderOptions); chart3cO.addNewSeries().setLabel("1st Qtr"); chart3cO.addNewSeries().setLabel("2nd Qtr"); chart3cO.getAxes().getXaxis().setRenderer("$.jqplot.CategoryAxisRenderer"); chart3cO.getAxes().getXaxis().setTicks("Q1", "Q2", "Q3", "Q4"); chart3cO.getAxes().getYaxis().setMin(0).setMax(20).setNumberTicks(5); add(chart3c); }
private void addChart3() { List<BaseSeries<Double, Integer>> lines = new ArrayList<BaseSeries<Double, Integer>>(); BaseSeries<Double, Integer> line1 = new BaseSeries<Double, Integer>(); line1.addEntry(4.0, 1); line1.addEntry(4.0, 2); line1.addEntry(3.0, 3); line1.addEntry(16.0, 4); BaseSeries<Double, Integer> line2 = new BaseSeries<Double, Integer>(); line2.addEntry(3.0, 1); line2.addEntry(7.0, 2); line2.addEntry(4.0, 3); line2.addEntry(3.125, 4); lines.add(line1); lines.add(line2); JQPlot chart3 = new JQPlot("chart3", new ListModel<BaseSeries<Double, Integer>>(lines)); PlotOptions chart3O = chart3.getOptions(); chart3O.setStackSeries(true); chart3O.getLegend().setShow(true).setLocation(PlotLegendLocation.se); chart3O.setTitle("Unit Sales: Acme Decoy Division"); chart3O.getSeriesDefaults().setRenderer("$.jqplot.BarRenderer"); PlotBarRendererOptions renderOptions = new PlotBarRendererOptions(); renderOptions.setBarDirection(PlotBarDirection.horizontal); renderOptions.setBarPadding(6.0); renderOptions.setBarMargin(40.0); chart3O.getSeriesDefaults().setRendererOptions(renderOptions); chart3O.addNewSeries().setLabel("1st Qtr"); chart3O.addNewSeries().setLabel("2nd Qtr"); chart3O.getAxes().getYaxis().setRenderer("$.jqplot.CategoryAxisRenderer"); chart3O.getAxes().getYaxis().setTicks("Q1", "Q2", "Q3", "Q4"); chart3O.getAxes().getXaxis().setMin(0).setMax(20).setNumberTicks(5); add(chart3); }