Search in sources :

Example 6 with ISeries

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

the class AbstractExtendedChart method createSeries.

@Override
public ISeries createSeries(ISeriesData seriesData, ISeriesSettings seriesSettings) throws SeriesException {
    SeriesType seriesType = getSeriesType(seriesSettings);
    double[] xSeries = seriesData.getXSeries();
    double[] ySeries = seriesData.getYSeries();
    // 
    if (xSeries.length == ySeries.length) {
        /*
			 * Put the settings to the map.
			 */
        String id = seriesData.getId();
        seriesSettingsMap.put(id, seriesSettings);
        // 
        ISeriesSet seriesSet = getSeriesSet();
        ISeries series = seriesSet.createSeries(seriesType, id);
        series.setXSeries(xSeries);
        series.setYSeries(ySeries);
        calculateCoordinates(series);
        return series;
    } else {
        throw new SeriesException("The length of x and y series differs.");
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) SeriesType(org.eclipse.swtchart.ISeries.SeriesType) SeriesException(org.eclipse.swtchart.extensions.exceptions.SeriesException) ISeries(org.eclipse.swtchart.ISeries)

Example 7 with ISeries

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

the class AbstractExtendedChart method appendSeries.

@Override
public void appendSeries(ISeriesData seriesData) {
    if (seriesData != null) {
        ISeriesSet seriesSet = getSeriesSet();
        ISeries series = seriesSet.getSeries(seriesData.getId());
        if (series != null) {
            /*
				 * Append the data.
				 */
            double[] xSeriesNew = concatenateSeries(series.getXSeries(), seriesData.getXSeries());
            series.setXSeries(xSeriesNew);
            double[] ySeriesNew = concatenateSeries(series.getYSeries(), seriesData.getYSeries());
            series.setYSeries(ySeriesNew);
            // 
            calculateCoordinates(series);
        }
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) ISeries(org.eclipse.swtchart.ISeries)

Example 8 with ISeries

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

the class BaseChart method showSeries.

public void showSeries(String selectedSeriesId) {
    ISeries dataSeries = getSeriesSet().getSeries(selectedSeriesId);
    if (dataSeries != null) {
        dataSeries.setVisible(true);
        dataSeries.setVisibleInLegend(true);
    }
}
Also used : ISeries(org.eclipse.swtchart.ISeries)

Example 9 with ISeries

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

the class BaseChart method hideSeries.

public void hideSeries(String selectedSeriesId, boolean fireUpdate) {
    ISeries dataSeries = getSeriesSet().getSeries(selectedSeriesId);
    if (dataSeries != null) {
        selectedSeriesIds.remove(selectedSeriesId);
        dataSeries.setVisible(false);
        dataSeries.setVisibleInLegend(false);
        if (fireUpdate) {
            fireSeriesStatusEvent(selectedSeriesId, ISeriesStatusListener.HIDE);
        }
    }
}
Also used : ISeries(org.eclipse.swtchart.ISeries)

Example 10 with ISeries

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

the class BaseChart method createSeries.

@Override
public ISeries createSeries(ISeriesData seriesData, ISeriesSettings seriesSettings) throws SeriesException {
    ISeries series = super.createSeries(seriesData, seriesSettings);
    calculateRedrawFrequency();
    return series;
}
Also used : ISeries(org.eclipse.swtchart.ISeries)

Aggregations

ISeries (org.eclipse.swtchart.ISeries)60 Point (org.eclipse.swt.graphics.Point)21 ISeriesSet (org.eclipse.swtchart.ISeriesSet)11 Chart (org.eclipse.swtchart.Chart)10 IAxis (org.eclipse.swtchart.IAxis)9 Range (org.eclipse.swtchart.Range)9 BaseChart (org.eclipse.swtchart.extensions.core.BaseChart)8 Color (org.eclipse.swt.graphics.Color)5 IBarSeries (org.eclipse.swtchart.IBarSeries)5 ILineSeries (org.eclipse.swtchart.ILineSeries)5 IAxisSettings (org.eclipse.swtchart.extensions.core.IAxisSettings)5 Rectangle (org.eclipse.swt.graphics.Rectangle)4 MouseEvent (org.eclipse.swt.events.MouseEvent)3 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)3 GC (org.eclipse.swt.graphics.GC)3 Test (org.junit.Test)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 PrintWriter (java.io.PrintWriter)2 ArrayList (java.util.ArrayList)2