Search in sources :

Example 11 with ISeriesData

use of org.eclipse.swtchart.extensions.core.ISeriesData in project swtchart by eclipse.

the class MeasurementSeries_3_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setOrientation(SWT.HORIZONTAL);
    chartSettings.setHorizontalSliderVisible(true);
    chartSettings.setVerticalSliderVisible(false);
    chartSettings.getRangeRestriction().setZeroX(true);
    chartSettings.getRangeRestriction().setZeroY(true);
    chartSettings.setCreateMenu(true);
    /*
		 * Primary X-Axis
		 */
    IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
    primaryAxisSettingsX.setTitle("Concentration [mg/g]");
    primaryAxisSettingsX.setDecimalFormat(new DecimalFormat(("0.00"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsX.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    primaryAxisSettingsX.setGridLineStyle(LineStyle.DOT);
    /*
		 * Primary Y-Axis
		 */
    IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
    primaryAxisSettingsY.setTitle("Area");
    primaryAxisSettingsY.setDecimalFormat(new DecimalFormat(("0.00"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsY.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    primaryAxisSettingsY.setGridLineStyle(LineStyle.DOT);
    // 
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    ILineSeriesSettings lineSeriesSettingsHighlight;
    /*
		 * Readings
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.MEASUREMENT_SERIES_3_READINGS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_RED));
    lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Regression
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.MEASUREMENT_SERIES_3_REGRESSION);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.SOLID);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    lineSeriesSettings.setSymbolType(PlotSymbolType.NONE);
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
}
Also used : ILineSeriesSettings(org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings) LineSeriesData(org.eclipse.swtchart.extensions.linecharts.LineSeriesData) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) DecimalFormatSymbols(java.text.DecimalFormatSymbols) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Example 12 with ISeriesData

use of org.eclipse.swtchart.extensions.core.ISeriesData in project swtchart by eclipse.

the class ScatterSeries_1_Part method initialize.

private void initialize() {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    applySettings(chartSettings);
    /*
		 * Data
		 */
    List<ISeriesData> scatterSeriesList = SeriesConverter.getSeriesScatter(SeriesConverter.SCATTER_SERIES_1);
    List<IScatterSeriesData> scatterSeriesDataList = new ArrayList<IScatterSeriesData>();
    // 
    for (ISeriesData seriesData : scatterSeriesList) {
        IScatterSeriesData scatterSeriesData = new ScatterSeriesData(seriesData);
        IScatterSeriesSettings scatterSeriesSettings = scatterSeriesData.getScatterSeriesSettings();
        /*
			 * Set the color and symbol type.
			 */
        double x = seriesData.getXSeries()[0];
        double y = seriesData.getYSeries()[0];
        applySettings(scatterSeriesSettings, x, y, SYMBOL_SIZE);
        scatterSeriesDataList.add(scatterSeriesData);
    }
    /*
		 * Set series.
		 */
    addSeriesData(scatterSeriesDataList);
}
Also used : IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) ScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.ScatterSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) IScatterSeriesSettings(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesSettings) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList)

Example 13 with ISeriesData

use of org.eclipse.swtchart.extensions.core.ISeriesData in project swtchart by eclipse.

the class ScatterSeries_3_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
    rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMinX(0.25d);
    rangeRestriction.setExtendMaxX(0.1d);
    rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMinY(0.25d);
    rangeRestriction.setExtendMaxY(0.1d);
    rangeRestriction.setRestrictZoom(false);
    chartSettings.setCreateMenu(true);
    // 
    IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
    primaryAxisSettingsX.setTitle("1st Dimension");
    primaryAxisSettingsX.setDecimalFormat(new DecimalFormat(("0"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsX.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    // 
    IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
    primaryAxisSettingsY.setTitle("2nd Dimension");
    primaryAxisSettingsY.setDecimalFormat(new DecimalFormat(("0.000"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsY.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    // 
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    Map<Integer, Color> colors = new HashMap<Integer, Color>();
    colors.put(1, getDisplay().getSystemColor(SWT.COLOR_RED));
    colors.put(2, getDisplay().getSystemColor(SWT.COLOR_GRAY));
    colors.put(3, getDisplay().getSystemColor(SWT.COLOR_GREEN));
    colors.put(4, getDisplay().getSystemColor(SWT.COLOR_YELLOW));
    colors.put(5, getDisplay().getSystemColor(SWT.COLOR_CYAN));
    colors.put(6, getDisplay().getSystemColor(SWT.COLOR_BLUE));
    colors.put(7, getDisplay().getSystemColor(SWT.COLOR_BLACK));
    colors.put(8, getDisplay().getSystemColor(SWT.COLOR_DARK_MAGENTA));
    colors.put(9, getDisplay().getSystemColor(SWT.COLOR_DARK_CYAN));
    colors.put(10, getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN));
    colors.put(11, getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    // 
    List<IScatterSeriesData> scatterSeriesDataList = new ArrayList<IScatterSeriesData>();
    for (int i = 1; i <= 5; i++) {
        for (int j = 1; j <= 20; j++) {
            String id = "Series_" + i + "-" + j;
            int y = getRandomValue(10.0d);
            double[] xSeries = new double[] { i };
            double[] ySeries = new double[] { y };
            ISeriesData seriesData = new SeriesData(xSeries, ySeries, id);
            IScatterSeriesData scatterSeriesData = new ScatterSeriesData(seriesData);
            IScatterSeriesSettings scatterSeriesSettings = scatterSeriesData.getScatterSeriesSettings();
            scatterSeriesSettings.setDescription(id);
            scatterSeriesSettings.setSymbolSize(getRandomValue(30.0d));
            scatterSeriesSettings.setSymbolColor(colors.get(y));
            scatterSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
            scatterSeriesDataList.add(scatterSeriesData);
        }
    }
    addSeriesData(scatterSeriesDataList);
}
Also used : IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) ScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.ScatterSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) DecimalFormatSymbols(java.text.DecimalFormatSymbols) IScatterSeriesSettings(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesSettings) HashMap(java.util.HashMap) DecimalFormat(java.text.DecimalFormat) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) SeriesData(org.eclipse.swtchart.extensions.core.SeriesData) IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) ScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.ScatterSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Example 14 with ISeriesData

use of org.eclipse.swtchart.extensions.core.ISeriesData in project swtchart by eclipse.

the class ScatterSeries_Edit_Part method loadScatterData.

private void loadScatterData() {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = handledChart.getChartSettings();
    chartSettings.setCreateMenu(true);
    handledChart.applySettings(chartSettings);
    /*
		 * Data
		 */
    List<ISeriesData> scatterSeriesList = SeriesConverter.getSeriesScatter(SeriesConverter.SCATTER_SERIES_1);
    List<IScatterSeriesData> scatterSeriesDataList = new ArrayList<IScatterSeriesData>();
    // 
    for (ISeriesData seriesData : scatterSeriesList) {
        IScatterSeriesData scatterSeriesData = new ScatterSeriesData(seriesData);
        IScatterSeriesSettings scatterSeriesSettings = scatterSeriesData.getScatterSeriesSettings();
        /*
			 * Set the color and symbol type.
			 */
        double x = seriesData.getXSeries()[0];
        double y = seriesData.getYSeries()[0];
        applySettings(scatterSeriesSettings, x, y, SYMBOL_SIZE);
        scatterSeriesDataList.add(scatterSeriesData);
    }
    /*
		 * Set series.
		 */
    handledChart.addSeriesData(scatterSeriesDataList);
}
Also used : IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) IScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData) ScatterSeriesData(org.eclipse.swtchart.extensions.scattercharts.ScatterSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) IScatterSeriesSettings(org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesSettings) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList)

Example 15 with ISeriesData

use of org.eclipse.swtchart.extensions.core.ISeriesData in project swtchart by eclipse.

the class LineSeries_2_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    chartSettings.setOrientation(SWT.HORIZONTAL);
    chartSettings.setHorizontalSliderVisible(true);
    chartSettings.setVerticalSliderVisible(false);
    chartSettings.getRangeRestriction().setZeroX(false);
    chartSettings.getRangeRestriction().setZeroY(false);
    /*
		 * Primary X-Axis
		 */
    IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
    primaryAxisSettingsX.setTitle("scan");
    primaryAxisSettingsX.setDecimalFormat(new DecimalFormat(("0.0##"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsX.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    primaryAxisSettingsX.setPosition(Position.Primary);
    primaryAxisSettingsX.setVisible(false);
    /*
		 * Primary Y-Axis
		 */
    IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
    primaryAxisSettingsY.setTitle("Intensity");
    primaryAxisSettingsY.setDecimalFormat(new DecimalFormat(("0.0#E0"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsY.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    /*
		 * Secondary X-Axes
		 */
    ISecondaryAxisSettings secondaryAxisSettingsX1 = new SecondaryAxisSettings("t1 (sec)", new ScanToSecondsConverter());
    secondaryAxisSettingsX1.setPosition(Position.Primary);
    secondaryAxisSettingsX1.setDecimalFormat(new DecimalFormat(("0"), new DecimalFormatSymbols(Locale.ENGLISH)));
    secondaryAxisSettingsX1.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    chartSettings.getSecondaryAxisSettingsListX().add(secondaryAxisSettingsX1);
    // 
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    ISeriesData seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_2);
    // 
    ILineSeriesData lineSeriesData = new LineSeriesData(seriesData);
    ILineSeriesSettings lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    ILineSeriesSettings lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
}
Also used : ISecondaryAxisSettings(org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings) LineSeriesData(org.eclipse.swtchart.extensions.linecharts.LineSeriesData) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) DecimalFormatSymbols(java.text.DecimalFormatSymbols) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) ILineSeriesSettings(org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings) SecondaryAxisSettings(org.eclipse.swtchart.extensions.core.SecondaryAxisSettings) ISecondaryAxisSettings(org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ScanToSecondsConverter(org.eclipse.swtchart.extensions.examples.converter.ScanToSecondsConverter) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Aggregations

ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)44 ArrayList (java.util.ArrayList)37 IChartSettings (org.eclipse.swtchart.extensions.core.IChartSettings)24 ILineSeriesData (org.eclipse.swtchart.extensions.linecharts.ILineSeriesData)20 ILineSeriesSettings (org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings)20 LineSeriesData (org.eclipse.swtchart.extensions.linecharts.LineSeriesData)20 DecimalFormat (java.text.DecimalFormat)10 DecimalFormatSymbols (java.text.DecimalFormatSymbols)10 IPrimaryAxisSettings (org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)10 BarSeriesData (org.eclipse.swtchart.extensions.barcharts.BarSeriesData)9 IBarSeriesData (org.eclipse.swtchart.extensions.barcharts.IBarSeriesData)9 Color (org.eclipse.swt.graphics.Color)8 SeriesData (org.eclipse.swtchart.extensions.core.SeriesData)8 BufferedReader (java.io.BufferedReader)6 IOException (java.io.IOException)6 InputStreamReader (java.io.InputStreamReader)6 HashMap (java.util.HashMap)6 IScatterSeriesData (org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData)6 IScatterSeriesSettings (org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesSettings)6 ScatterSeriesData (org.eclipse.swtchart.extensions.scattercharts.ScatterSeriesData)6