provider = new ChartProvider(new Dimension(200, 125), ChartType.LINE, data);
provider.setColors(new Color[] { Color.RED });
provider.setLineStyles(new LineStyle[] { new LineStyle(4, 3, 0) });
provider.setBackgroundFill(new SolidFill(Color.decode("#EFEFEF")));
provider.setChartFill(new LinearGradientFill(45, new Color[] { Color.WHITE,
Color.decode("#76A4FB") }, new double[] { 0, 0.75 }));
axis = new ChartAxis(ChartAxisType.BOTTOM);
axis.setLabels(new String[] { "1", "2", "3", "4", "5" });
provider.addAxis(axis);
axis = new ChartAxis(ChartAxisType.LEFT);
axis.setLabels(new String[] { "0", "50", "100" });
provider.addAxis(axis);
add(new Chart("backgrounds", provider));
data = new AbstractChartData(ChartDataEncoding.TEXT, 100)
{
private static final long serialVersionUID = 1L;
public double[][] getData()
{
return new double[][] { { 12, 4, 4, 8, 24, 28, 24, 28, 12, 12, 16 },
{ 28, 28, 96, 40, 16, 32, 12, 24, 100, 44, 16, 8 },
{ 36, 40, 40, 24, 56, 72, 12, 8, 4, 48, 40, 12 } };
}
};
provider = new ChartProvider(new Dimension(200, 125), ChartType.LINE, data);
provider.setColors(new Color[] { Color.GREEN, Color.BLUE, Color.RED });
provider.setLegend(new String[] { "2005", "2006", "2007" });
provider.setLineStyles(new LineStyle[] { new LineStyle(3, 2, 0), new LineStyle(3, 2, 0),
new LineStyle(3, 2, 0) });
provider.setBackgroundFill(new SolidFill(new Color(0, 0, 0, 0)));
axis = new ChartAxis(ChartAxisType.BOTTOM);
axis.setLabels(new String[] { "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" });
provider.addAxis(axis);