private void addChart1() { List<SimpleNumberSeries<Integer>> lines = new ArrayList<SimpleNumberSeries<Integer>>(); lines.add(new SimpleNumberSeries<Integer>(2, 3, 1, 4, 3)); lines.add(new SimpleNumberSeries<Integer>(1, 4, 3, 2, 5)); JQPlot chart1 = new JQPlot("chart1", new ListModel<SimpleNumberSeries<Integer>>(lines)); PlotOptions chart1O = chart1.getOptions(); chart1O.setTitle( "Stacked Filled Line Plot with Transparency (transparency not supported in IE6)"); chart1O.setStackSeries(true); chart1O.getGrid().setBackground("#fefbf3").setBorderWidth(2.5); chart1O.getSeriesDefaults().setFill(true).setShowMarker(false).setShadow(false); chart1O.getAxes().getXaxis().setPad(1.0).setNumberTicks(5).setAutoscale(false); chart1O.getAxes().getYaxis().setMin(0.0).setMax(12.0).setNumberTicks(5); chart1O.addNewSeries().setColor("rgba(68, 124, 147, 0.7)"); chart1O.addNewSeries().setColor("rgba(150, 35, 90, 0.7)"); add(chart1); }
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); }
private void addChart3b() { 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 chart3b = new JQPlot("chart3b", new ListModel<SimpleNumberSeries<Double>>(lines)); PlotOptions chart3bO = chart3b.getOptions(); chart3bO.setStackSeries(true); chart3bO.getLegend().setShow(true).setLocation(PlotLegendLocation.nw); chart3bO.setTitle("Unit Sales: Acme Decoy Division"); chart3bO.getSeriesDefaults().setRenderer("$.jqplot.BarRenderer"); PlotBarRendererOptions renderOptions = new PlotBarRendererOptions(); renderOptions.setBarPadding(6.0); renderOptions.setBarMargin(40.0); chart3bO.getSeriesDefaults().setRendererOptions(renderOptions); chart3bO.addNewSeries().setLabel("1st Qtr"); chart3bO.addNewSeries().setLabel("2nd Qtr"); chart3bO.getAxes().getXaxis().setRenderer("$.jqplot.CategoryAxisRenderer"); chart3bO.getAxes().getXaxis().setTicks("Q1", "Q2", "Q3", "Q4"); chart3bO.getAxes().getYaxis().setMin(0).setMax(20).setNumberTicks(5); add(chart3b); }