use of org.netxms.client.datacollection.GraphItem in project netxms by netxms.
the class ServiceAvailability method createChart.
/**
* @param parent
* @param title
* @return
*/
private DataComparisonChart createChart(Composite parent, String title) {
DataComparisonChart chart = ChartFactory.createPieChart(parent, SWT.NONE);
chart.setTitleVisible(true);
chart.set3DModeEnabled(true);
chart.setChartTitle(title);
chart.setLegendVisible(false);
chart.setLabelsVisible(true);
chart.setRotation(225.0);
// $NON-NLS-1$
chart.addParameter(new GraphItem(0, 0, 0, DataType.FLOAT, Messages.get().ServiceAvailability_Up, Messages.get().ServiceAvailability_Up, "%s"), 100);
// $NON-NLS-1$
chart.addParameter(new GraphItem(0, 0, 0, DataType.FLOAT, Messages.get().ServiceAvailability_Down, Messages.get().ServiceAvailability_Down, "%s"), 0);
chart.setPaletteEntry(0, new ChartColor(127, 154, 72));
chart.setPaletteEntry(1, new ChartColor(158, 65, 62));
chart.initializationComplete();
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
((Control) chart).setLayoutData(gd);
return chart;
}
Aggregations