Search in sources :

Example 11 with GraphItem

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;
}
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

GraphItem (org.netxms.client.datacollection.GraphItem)11 GraphItemStyle (org.netxms.client.datacollection.GraphItemStyle)3 ChartColor (org.netxms.ui.eclipse.charts.api.ChartColor)3 ProgressDialog (android.app.ProgressDialog)2 TextView (android.widget.TextView)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Point (org.eclipse.swt.graphics.Point)2 GridData (org.eclipse.swt.layout.GridData)2 Control (org.eclipse.swt.widgets.Control)2 DciDataRow (org.netxms.client.datacollection.DciDataRow)2 DataComparisonChart (org.netxms.ui.eclipse.charts.api.DataComparisonChart)2 LineGraphView (com.jjoe64.graphview.LineGraphView)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 GridData (org.eclipse.draw2d.GridData)1 LineBorder (org.eclipse.draw2d.LineBorder)1 Widget (org.eclipse.swt.widgets.Widget)1 PartInitException (org.eclipse.ui.PartInitException)1 TableCell (org.netxms.client.TableCell)1