Search in sources :

Example 1 with BirtChartFigure

use of org.netxms.ui.eclipse.charts.figures.BirtChartFigure in project netxms by netxms.

the class ObjectTooltip method addStatusChart.

/**
 * Status chart
 */
private void addStatusChart(AbstractObject object, MapLabelProvider labelProvider) {
    BirtChartFigure chart = new BirtChartFigure(BirtChartFigure.BAR_CHART, labelProvider.getColors());
    add(chart);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    gd.heightHint = 180;
    gd.widthHint = 320;
    setConstraint(chart, gd);
    int[] objectCount = new int[6];
    collectData(objectCount, object);
    chart.setTitleVisible(true);
    chart.setChartTitle(Messages.get().ObjectTooltip_ChartTitle);
    chart.setLegendPosition(GraphSettings.POSITION_RIGHT);
    chart.setLegendVisible(true);
    chart.set3DModeEnabled(true);
    chart.setTransposed(false);
    chart.setTranslucent(false);
    chart.setBorder(new LineBorder());
    for (int i = 0; i <= ObjectStatus.UNKNOWN.getValue(); i++) {
        // $NON-NLS-1$
        chart.addParameter(// $NON-NLS-1$
        new GraphItem(0, 0, 0, DataType.INT32, StatusDisplayInfo.getStatusText(i), StatusDisplayInfo.getStatusText(i), "%s"), objectCount[i]);
        chart.setPaletteEntry(i, new ChartColor(StatusDisplayInfo.getStatusColor(i).getRGB()));
    }
    chart.initializationComplete();
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) LineBorder(org.eclipse.draw2d.LineBorder) GridData(org.eclipse.draw2d.GridData) GraphItem(org.netxms.client.datacollection.GraphItem) BirtChartFigure(org.netxms.ui.eclipse.charts.figures.BirtChartFigure) AccessPoint(org.netxms.client.objects.AccessPoint)

Aggregations

GridData (org.eclipse.draw2d.GridData)1 LineBorder (org.eclipse.draw2d.LineBorder)1 GraphItem (org.netxms.client.datacollection.GraphItem)1 AccessPoint (org.netxms.client.objects.AccessPoint)1 ChartColor (org.netxms.ui.eclipse.charts.api.ChartColor)1 BirtChartFigure (org.netxms.ui.eclipse.charts.figures.BirtChartFigure)1