Meter chart can not show [message #154680] |
Thu, 20 April 2006 09:44 |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: sumanta.aunwesha.com
Hi,
I can not see the meter chart . There is no error but it did not show the
meter chart.
I have given the code:-
public static final Chart createSDialSRegionChart() {
DialChart dChart = (DialChart) DialChartImpl.create();
dChart.setDialSuperimposition(true);
dChart.setGridColumnCount(2);
dChart.setSeriesThickness(25);
// Title/Plot
dChart.getBlock().setBackground(ColorDefinitionImpl.WHITE()) ;
Plot p = dChart.getPlot();
p.getClientArea().setBackground(ColorDefinitionImpl.CREAM()) ;
p.getClientArea().getOutline().setVisible(true);
p.getOutline().setVisible(true);
dChart.getTitle().getLabel().getCaption().setValue("Meter Chart");
dChart.getTitle().getOutline().setVisible(true);
// Legend
Legend lg = dChart.getLegend();
LineAttributes lia = lg.getOutline();
lg.getText().getFont().setSize(6);
lia.setStyle(LineStyle.SOLID_LITERAL);
lg.getInsets().setLeft(5);
lg.getInsets().setRight(5);
lg.setBackground(null);
lg.getOutline().setVisible(true);
lg.setShowValue(true);
lg.getClientArea().setBackground(ColorDefinitionImpl.PINK()) ;
lg.getClientArea().getOutline().setVisible(true);
lg.getTitle().getCaption().getFont().setSize(8);
lg.getTitle().setInsets(InsetsImpl.create(10, 10, 10, 10));
lg.setTitlePosition(Position.ABOVE_LITERAL);
// Data Set
TextDataSet categoryValues = TextDataSetImpl
.create(new String[] { "Speed" });
SeriesDefinition sd = SeriesDefinitionImpl.create();
dChart.getSeriesDefinitions().add(sd);
Series seCategory = (Series) SeriesImpl.create();
final Fill[] fiaBase = {
ColorDefinitionImpl.ORANGE(),
GradientImpl.create(ColorDefinitionImpl.create(225, 225, 255),
ColorDefinitionImpl.create(255, 255, 225), -35, false),
ColorDefinitionImpl.RED(), ColorDefinitionImpl.RED(),
ColorDefinitionImpl.GREEN(),
ColorDefinitionImpl.BLUE().brighter(),
ColorDefinitionImpl.CYAN().darker(), };
sd.getSeriesPalette().getEntries().clear();
for (int i = 0; i < fiaBase.length; i++) {
System.out.println("========fiaBase[i]=========="+fiaBase[i]);
sd.getSeriesPalette().getEntries().add(fiaBase[i]);
}
seCategory.setDataSet(categoryValues);
sd.getSeries().add(seCategory);
SeriesDefinition sdCity = SeriesDefinitionImpl.create();
// Dial
DialSeries seDial = (DialSeries) DialSeriesImpl.create();
seDial.setDataSet(NumberDataSetImpl.create(new double[] { 60 }));
seDial.getDial().setFill(
GradientImpl.create(ColorDefinitionImpl.create(225, 225, 255),
ColorDefinitionImpl.create(255, 255, 225), -35, false));
seDial.getNeedle().setDecorator(LineDecorator.ARROW_LITERAL) ;
seDial.getDial().getMinorGrid().getTickAttributes().setVisib le(true);
seDial.getDial().getMinorGrid().getTickAttributes().setColor (
ColorDefinitionImpl.RED());
seDial.getDial().getMinorGrid().setTickStyle(TickStyle.BELOW _LITERAL);
seDial.getDial().getScale().setMin(NumberDataElementImpl.cre ate(0));
seDial.getDial().getScale().setMax(NumberDataElementImpl.cre ate(180));
seDial.getDial().getScale().setStep(30);
seDial.getLabel().setOutline(
LineAttributesImpl.create(ColorDefinitionImpl.GREY().darker( ),
LineStyle.SOLID_LITERAL, 1));
seDial.getLabel().setBackground(ColorDefinitionImpl.GREY().b righter());
DialRegion dregion21 = DialRegionImpl.create();
dregion21.setFill(ColorDefinitionImpl.GREEN());
dregion21.setStartValue(NumberDataElementImpl.create(0));
dregion21.setEndValue(NumberDataElementImpl.create(80));
seDial.getDial().getDialRegions().add(dregion21);
sd.getSeriesDefinitions().add(sdCity);
sdCity.getSeries().add(seDial);
return dChart;
}
Can help me?
|
|
|
Powered by
FUDForum. Page generated in 0.03939 seconds