Search in sources :

Example 1 with DataComparisonChart

use of org.netxms.ui.eclipse.charts.api.DataComparisonChart in project netxms by netxms.

the class AvailabilityChart 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(false);
    chart.setRotation(225.0);
    // $NON-NLS-1$
    chart.addParameter(new GraphItem(0, 0, 0, DataType.FLOAT, Messages.get().AvailabilityChart_Up, Messages.get().AvailabilityChart_Up, "%s"), 100);
    // $NON-NLS-1$
    chart.addParameter(new GraphItem(0, 0, 0, DataType.FLOAT, Messages.get().AvailabilityChart_Down, Messages.get().AvailabilityChart_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.widthHint = 250;
    gd.heightHint = 190;
    ((Control) chart).setLayoutData(gd);
    return chart;
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) Control(org.eclipse.swt.widgets.Control) DataComparisonChart(org.netxms.ui.eclipse.charts.api.DataComparisonChart) GridData(org.eclipse.swt.layout.GridData) GraphItem(org.netxms.client.datacollection.GraphItem)

Example 2 with DataComparisonChart

use of org.netxms.ui.eclipse.charts.api.DataComparisonChart 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;
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) Control(org.eclipse.swt.widgets.Control) DataComparisonChart(org.netxms.ui.eclipse.charts.api.DataComparisonChart) GridData(org.eclipse.swt.layout.GridData) GraphItem(org.netxms.client.datacollection.GraphItem)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2 Control (org.eclipse.swt.widgets.Control)2 GraphItem (org.netxms.client.datacollection.GraphItem)2 ChartColor (org.netxms.ui.eclipse.charts.api.ChartColor)2 DataComparisonChart (org.netxms.ui.eclipse.charts.api.DataComparisonChart)2