Jason J Simas - 2004-10-20

Logged In: YES
user_id=179964

i c. thanks for submitting the code. there must be something
wrong.

development on chart2d is currently suspended but you can
try one of these work arounds.

1) make your chart display micrometers instead (multiply your
data by 1000)
2) multiply your data by whatever factor (as above) and
disply it in the numbers axis label.

Here is a sample of (2).

private Chart2D getChart2DDemoA() {

//Configure object properties
Object2DProperties object2DProps = new
Object2DProperties();
object2DProps.setObjectTitleText("Layers Thickness");

//Configure chart properties
Chart2DProperties chart2DProps = new
Chart2DProperties();
chart2DProps.setChartDataLabelsPrecision(-4);

//Configure legend properties
LegendProperties legendProps = new LegendProperties();
String[] legendLabels = {"Value"};
legendProps.setLegendLabelsTexts(legendLabels);
legendProps.setLegendExistence(false);

//Configure graph chart properties
GraphChart2DProperties graphChart2DProps = new
GraphChart2DProperties();
graphChart2DProps.setLabelsAxisLabelsTexts(new String
[]{
"0","1","2","3","4",
"5","6","7","8","9",
"10","11","12","13","14",
"15","16"
});

// graphChart2DProps.setLabelsAxisTitleText ("Data");
graphChart2DProps.setNumbersAxisTitleText("Millimeters
* 10");

graphChart2DProps.setChartDatasetCustomizeGreatestValue
(true);

graphChart2DProps.setChartDatasetCustomGreatestValue(.5f);
graphChart2DProps.setLabelsAxisTicksAlignment
(GraphChart2DProperties.CENTERED);
graphChart2DProps.setChartGraphableToAvailableRatio
(1f);

//Configure graph properties
GraphProperties graphProps = new GraphProperties();
graphProps.setGraphBarsExistence(false);
graphProps.setGraphLinesExistence(true);
graphProps.setGraphAllowComponentAlignment(true);

//Configure dataset
Dataset thicknessDataset = new Dataset(1, 17, 1);
thicknessDataset.set(0, 0, 0, 0.2f);
thicknessDataset.set(0, 1, 0, 0.3f);
thicknessDataset.set(0, 2, 0, 0.25f);
thicknessDataset.set(0, 3, 0, 0.3f);
thicknessDataset.set(0, 4, 0, 0.2f);
thicknessDataset.set(0, 5, 0, 0.3f);
thicknessDataset.set(0, 6, 0, 0.2f);
thicknessDataset.set(0, 7, 0, 0.1f);
thicknessDataset.set(0, 8, 0, 0.2f);
thicknessDataset.set(0, 9, 0, 0.4f);
thicknessDataset.set(0, 10, 0, 0.2f);
thicknessDataset.set(0, 11, 0, 0.35f);
thicknessDataset.set(0, 12, 0, 0.3f);
thicknessDataset.set(0, 13, 0, 0.25f);
thicknessDataset.set(0, 14, 0, 0.2f);
thicknessDataset.set(0, 15, 0, 0.3f);
thicknessDataset.set(0, 16, 0, 0.1f);

//Configure graph component colors
MultiColorsProperties multiColorsProps = new
MultiColorsProperties();

//Configure warning regions for graph
WarningRegionProperties warningRegionProps1 = new
WarningRegionProperties();
warningRegionProps1.setHigh(0.25f);
warningRegionProps1.setLow
(WarningRegionProperties.LOW);

//Configure warning regions for graph
WarningRegionProperties warningRegionProps2 = new
WarningRegionProperties();
//warningRegionProps2.setHigh(0.25f);
warningRegionProps2.setHigh
(WarningRegionProperties.HIGH);
warningRegionProps2.setLow(0.24f);
warningRegionProps2.setComponentColor(new Color
(146, 105, 0));
warningRegionProps2.setBackgroundColor(new Color
(222, 209, 176));

//Configure chart
LBChart2D chart2D = new LBChart2D();
chart2D.setObject2DProperties(object2DProps);
chart2D.setChart2DProperties(chart2DProps);
chart2D.setLegendProperties(legendProps);
chart2D.setGraphChart2DProperties(graphChart2DProps);
chart2D.addGraphProperties(graphProps);
chart2D.addDataset(thicknessDataset);
chart2D.addMultiColorsProperties(multiColorsProps);
chart2D.addWarningRegionProperties
(warningRegionProps1);
chart2D.addWarningRegionProperties
(warningRegionProps2);

//Optional validation: Prints debug messages if invalid
only.
if (!chart2D.validate(false)) {
chart2D.validate(true);
}

//<-- End Chart2D configuration -->

return chart2D;
}