Search in sources :

Example 16 with ILineSeries

use of org.eclipse.swtchart.ILineSeries in project netxms by netxms.

the class LineChart method addLineSeries.

/**
 * Add line series to chart
 *
 * @param description Description
 * @param xSeries X axis data
 * @param ySeries Y axis data
 */
@SuppressWarnings("deprecation")
private ILineSeries<?> addLineSeries(int index, String description, Date[] xSeries, double[] ySeries) {
    ISeriesSet seriesSet = getSeriesSet();
    ILineSeries<?> series = (ILineSeries<?>) seriesSet.createSeries(SeriesType.LINE, Integer.toString(index));
    series.setDescription(description);
    series.setSymbolType(PlotSymbolType.NONE);
    series.setLineWidth(configuration.getLineWidth());
    series.setLineColor(getColorFromPreferences("Chart.Colors.Data." + index));
    series.setXDateSeries(xSeries);
    series.setYSeries(ySeries);
    try {
        series.enableStack(configuration.isStacked());
    } catch (IllegalStateException e) {
        logger.error("Exception while adding chart series", e);
    }
    return series;
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) ILineSeries(org.eclipse.swtchart.ILineSeries)

Example 17 with ILineSeries

use of org.eclipse.swtchart.ILineSeries in project org.eclipse.linuxtools by eclipse-linuxtools.

the class ScatterChartBuilder method createChartISeries.

@Override
protected ISeries createChartISeries(int i) {
    ILineSeries series = (ILineSeries) super.createChartISeries(i);
    series.setSymbolColor(COLORS[i % COLORS.length]);
    series.setLineStyle(LineStyle.NONE);
    return series;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries)

Example 18 with ILineSeries

use of org.eclipse.swtchart.ILineSeries in project org.eclipse.linuxtools by eclipse-linuxtools.

the class AreaChartBuilder method createChartISeries.

@Override
protected ISeries createChartISeries(int i) {
    ILineSeries series = (ILineSeries) super.createChartISeries(i);
    series.enableArea(true);
    return series;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries)

Example 19 with ILineSeries

use of org.eclipse.swtchart.ILineSeries in project org.eclipse.linuxtools by eclipse-linuxtools.

the class LineChartBuilder method createChartISeries.

@Override
protected ISeries createChartISeries(int i) {
    ILineSeries series = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, adapter.getLabels()[i + 1]);
    series.setSymbolColor(COLORS[i % COLORS.length]);
    series.setLineColor(COLORS[i % COLORS.length]);
    series.setLineStyle(LineStyle.SOLID);
    return series;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries)

Example 20 with ILineSeries

use of org.eclipse.swtchart.ILineSeries in project swtchart by eclipse.

the class PlotArea method paintControl.

/*
	 * @see PaintListener#paintControl(PaintEvent)
	 */
public void paintControl(PaintEvent e) {
    Point p = getSize();
    GC gc = e.gc;
    // draw the plot area background
    Color oldBackground = gc.getBackground();
    gc.setBackground(getBackground());
    gc.fillRectangle(0, 0, p.x, p.y);
    // draw grid
    for (IAxis axis : chart.getAxisSet().getAxes()) {
        ((Grid) axis.getGrid()).draw(gc, p.x, p.y);
    }
    // draw behind series
    for (ICustomPaintListener listener : paintListeners) {
        if (listener.drawBehindSeries()) {
            listener.paintControl(e);
        }
    }
    // draw series. The line series should be drawn on bar series.
    for (ISeries series : chart.getSeriesSet().getSeries()) {
        if (series instanceof IBarSeries) {
            ((Series) series).draw(gc, p.x, p.y);
        }
    }
    for (ISeries series : chart.getSeriesSet().getSeries()) {
        if (series instanceof ILineSeries) {
            ((Series) series).draw(gc, p.x, p.y);
        }
    }
    // draw over series
    for (ICustomPaintListener listener : paintListeners) {
        if (!listener.drawBehindSeries()) {
            listener.paintControl(e);
        }
    }
    e.gc.setBackground(oldBackground);
}
Also used : IBarSeries(org.eclipse.swtchart.IBarSeries) ILineSeries(org.eclipse.swtchart.ILineSeries) ISeries(org.eclipse.swtchart.ISeries) Series(org.eclipse.swtchart.internal.series.Series) ICustomPaintListener(org.eclipse.swtchart.ICustomPaintListener) IBarSeries(org.eclipse.swtchart.IBarSeries) Color(org.eclipse.swt.graphics.Color) ILineSeries(org.eclipse.swtchart.ILineSeries) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC) ISeries(org.eclipse.swtchart.ISeries) IAxis(org.eclipse.swtchart.IAxis)

Aggregations

ILineSeries (org.eclipse.swtchart.ILineSeries)29 Chart (org.eclipse.swtchart.Chart)13 Color (org.eclipse.swt.graphics.Color)7 Point (org.eclipse.swt.graphics.Point)5 IAxis (org.eclipse.swtchart.IAxis)5 IBarSeries (org.eclipse.swtchart.IBarSeries)5 ISeries (org.eclipse.swtchart.ISeries)5 MouseEvent (org.eclipse.swt.events.MouseEvent)3 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)2 ISeriesSet (org.eclipse.swtchart.ISeriesSet)2 InteractiveChart (org.eclipse.swtchart.extensions.charts.InteractiveChart)2 BaseChart (org.eclipse.swtchart.extensions.core.BaseChart)2 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)2 SeriesException (org.eclipse.swtchart.extensions.exceptions.SeriesException)2 Test (org.junit.Test)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 IAction (org.eclipse.jface.action.IAction)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1