Exemplo n.º 1
0
 public ChartModel getChartModel(int segments) {
   ChartModel cm =
       new ChartModel(
           "Sales by Month 2008", "font-size: 14px; font-family: Verdana; color:#ffff00;");
   cm.setBackgroundColour("#000077");
   XAxis xa = new XAxis();
   xa.setLabels(TestData.getShortMonths(segments));
   xa.getLabels().setColour("#ffff00");
   xa.setGridColour("-1");
   xa.setColour("#aa5500");
   xa.setZDepth3D(5);
   cm.setXAxis(xa);
   YAxis ya = new YAxis();
   ya.setSteps(16);
   ya.setMax(160);
   ya.setGridColour("#000099");
   ya.setColour("#ffff00");
   cm.setYAxis(ya);
   cm.setYAxisLabelStyle(10, "#ffff00");
   BarChart bchart = new BarChart(BarStyle.THREED);
   bchart.setColour("#CC6600");
   bchart.setTooltip("$#val#");
   for (int t = 0; t < segments; t++) {
     bchart.addValues(Random.nextInt(50) + 50);
   }
   cm.addChartConfig(bchart);
   return cm;
 }
Exemplo n.º 2
0
 public ChartModel getChartModel(int segments) {
   ChartModel cm =
       new ChartModel("Sales by Month 2007", "font-size: 14px; font-family: Verdana;");
   cm.setBackgroundColour("-1");
   XAxis xa = new XAxis();
   for (String m : TestData.getMonths()) {
     Label l = new Label(m, 45);
     l.setSize(10);
     l.setColour("#000000");
     xa.addLabels(l);
   }
   xa.setGridColour("-1");
   cm.setXAxis(xa);
   YAxis ya = new YAxis();
   ya.setSteps(16);
   ya.setMax(160);
   ya.setGridColour("#8888FF");
   cm.setYAxis(ya);
   BarChart bchart = new BarChart(BarStyle.GLASS);
   bchart.setColour("#FF00CC");
   bchart.setTooltip("$#val#");
   for (int t = 0; t < 12; t++) {
     if (t == segments - 1) {
       bchart.addBars(new BarChart.Bar(Random.nextInt(50) + 50, "#8888FF"));
     } else {
       bchart.addValues(Random.nextInt(50) + 50);
     }
   }
   cm.addChartConfig(bchart);
   return cm;
 }