Search in sources :

Example 1 with ChartColor

use of org.netxms.ui.eclipse.charts.api.ChartColor 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 ChartColor

use of org.netxms.ui.eclipse.charts.api.ChartColor 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)

Example 3 with ChartColor

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

the class LineChart method setAxisColor.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.charts.api.DataChart#setAxisColor(org.netxms.ui.eclipse.charts.api.ChartColor)
	 */
@Override
public void setAxisColor(ChartColor color) {
    final Color c = colors.create(color.getRGBObject());
    getAxisSet().getXAxis(0).getTick().setForeground(c);
    getAxisSet().getYAxis(0).getTick().setForeground(c);
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) Color(org.eclipse.swt.graphics.Color)

Example 4 with ChartColor

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

the class LineChart method setGridColor.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.charts.api.DataChart#setGridColor(org.netxms.ui.eclipse.charts.api.ChartColor)
	 */
@Override
public void setGridColor(ChartColor color) {
    final Color c = colors.create(color.getRGBObject());
    getAxisSet().getXAxis(0).getGrid().setForeground(c);
    getAxisSet().getYAxis(0).getGrid().setForeground(c);
}
Also used : ChartColor(org.netxms.ui.eclipse.charts.api.ChartColor) Color(org.eclipse.swt.graphics.Color)

Example 5 with ChartColor

use of org.netxms.ui.eclipse.charts.api.ChartColor 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

ChartColor (org.netxms.ui.eclipse.charts.api.ChartColor)5 GraphItem (org.netxms.client.datacollection.GraphItem)3 Color (org.eclipse.swt.graphics.Color)2 GridData (org.eclipse.swt.layout.GridData)2 Control (org.eclipse.swt.widgets.Control)2 DataComparisonChart (org.netxms.ui.eclipse.charts.api.DataComparisonChart)2 GridData (org.eclipse.draw2d.GridData)1 LineBorder (org.eclipse.draw2d.LineBorder)1 AccessPoint (org.netxms.client.objects.AccessPoint)1 BirtChartFigure (org.netxms.ui.eclipse.charts.figures.BirtChartFigure)1