Search in sources :

Example 21 with ISeriesData

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

the class LineSeries_Selection_Part method applyChartSettings.

private void applyChartSettings() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = lineChart.getChartSettings();
    chartSettings.setCreateMenu(true);
    /*
		 * Primary X-Axis
		 */
    IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
    primaryAxisSettingsX.setTitle("Retention Time (milliseconds)");
    primaryAxisSettingsX.setDecimalFormat(new DecimalFormat(("0.0##"), new DecimalFormatSymbols(Locale.ENGLISH)));
    primaryAxisSettingsX.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    /*
		 * 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));
    primaryAxisSettingsY.setGridLineStyle(LineStyle.NONE);
    /*
		 * Secondary Y-Axes
		 */
    ISecondaryAxisSettings secondaryAxisSettingsY1 = new SecondaryAxisSettings("Relative Intensity [%]", new RelativeIntensityConverter(SWT.VERTICAL, true));
    secondaryAxisSettingsY1.setPosition(Position.Secondary);
    secondaryAxisSettingsY1.setDecimalFormat(new DecimalFormat(("0.00"), new DecimalFormatSymbols(Locale.ENGLISH)));
    secondaryAxisSettingsY1.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    chartSettings.getSecondaryAxisSettingsListY().add(secondaryAxisSettingsY1);
    // 
    lineChart.applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    ISeriesData seriesDataLine = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_3);
    double[] xSeries = seriesDataLine.getXSeries();
    double[] ySeries = seriesDataLine.getYSeries();
    xValues = new TreeSet<Double>();
    yValues = new HashMap<Double, Double>();
    for (int i = 0; i < xSeries.length; i++) {
        double x = xSeries[i];
        xValues.add(x);
        yValues.put(x, ySeries[i]);
    }
    /*
		 * Line Series
		 */
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    // 
    lineSeriesData = new LineSeriesData(seriesDataLine);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    ILineSeriesSettings lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Selected Point
		 */
    seriesDataPoint = new SeriesData(new double[] { 0.0 }, new double[] { 0.0 }, DATA_POINT_SERIES);
    lineSeriesData = new LineSeriesData(seriesDataPoint);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CROSS);
    lineSeriesSettings.setEnableArea(true);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    lineChart.addSeriesData(lineSeriesDataList);
}
Also used : ISecondaryAxisSettings(org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings) RelativeIntensityConverter(org.eclipse.swtchart.extensions.axisconverter.RelativeIntensityConverter) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) LineSeriesData(org.eclipse.swtchart.extensions.linecharts.LineSeriesData) 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) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) LineSeriesData(org.eclipse.swtchart.extensions.linecharts.LineSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) SeriesData(org.eclipse.swtchart.extensions.core.SeriesData) ISecondaryAxisSettings(org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings) SecondaryAxisSettings(org.eclipse.swtchart.extensions.core.SecondaryAxisSettings) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Example 22 with ISeriesData

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

the class ScatterSeries_Preferences_Part method applySeriesSettings.

private void applySeriesSettings() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    int symbolSize = preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_SYMBOL_SIZE_SERIES);
    // 
    Color symbolColorSeriesLeftTop = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_LEFT_TOP));
    Color symbolColorSeriesRightTop = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_RIGHT_TOP));
    Color symbolColorSeriesLeftBottom = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_LEFT_BOTTOM));
    Color symbolColorSeriesRightBottom = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_RIGHT_BOTTOM));
    PlotSymbolType plotSymbolTypeLeftTop = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_LEFT_TOP));
    boolean isVisibleLeftTop = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_LEFT_TOP);
    PlotSymbolType plotSymbolTypeRightTop = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_RIGHT_TOP));
    boolean isVisibleRightTop = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_RIGHT_TOP);
    PlotSymbolType plotSymbolTypeLeftBottom = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_LEFT_BOTTOM));
    boolean isVisibleLeftBottom = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_LEFT_BOTTOM);
    PlotSymbolType plotSymbolTypeRightBottom = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_RIGHT_BOTTOM));
    boolean isVisibleRightBottom = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_RIGHT_BOTTOM);
    // 
    Color symbolColorSeriesLeftTopHighlight = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_HIGHLIGHT_LEFT_TOP));
    Color symbolColorSeriesRightTopHighlight = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_HIGHLIGHT_RIGHT_TOP));
    Color symbolColorSeriesLeftBottomHighlight = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_HIGHLIGHT_LEFT_BOTTOM));
    Color symbolColorSeriesRightBottomHighlight = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_HIGHLIGHT_RIGHT_BOTTOM));
    PlotSymbolType plotSymbolTypeLeftTopHighlight = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_HIGHLIGHT_LEFT_TOP));
    boolean isVisibleLeftTopHighlight = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_HIGHLIGHT_LEFT_TOP);
    PlotSymbolType plotSymbolTypeRightTopHighlight = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_HIGHLIGHT_RIGHT_TOP));
    boolean isVisibleRightTopHighlight = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_HIGHLIGHT_RIGHT_TOP);
    PlotSymbolType plotSymbolTypeLeftBottomHighlight = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_HIGHLIGHT_LEFT_BOTTOM));
    boolean isVisibleLeftBottomHighlight = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_HIGHLIGHT_LEFT_BOTTOM);
    PlotSymbolType plotSymbolTypeRightBottomHighlight = PlotSymbolType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_HIGHLIGHT_RIGHT_BOTTOM));
    boolean isVisibleRightBottomHighlight = preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VISIBLE_SERIES_HIGHLIGHT_RIGHT_BOTTOM);
    // 
    scatterChart.deleteSeries();
    /*
		 * 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();
        IScatterSeriesSettings scatterSeriesSettingsHighlight = (IScatterSeriesSettings) scatterSeriesSettings.getSeriesSettingsHighlight();
        /*
			 * Set the color and symbol type.
			 */
        double x = seriesData.getXSeries()[0];
        double y = seriesData.getYSeries()[0];
        scatterSeriesSettings.setSymbolSize(symbolSize);
        scatterSeriesSettingsHighlight.setSymbolSize(symbolSize);
        // 
        if (x > 0 && y > 0) {
            scatterSeriesSettings.setSymbolColor(symbolColorSeriesRightTop);
            scatterSeriesSettings.setSymbolType(plotSymbolTypeRightTop);
            scatterSeriesSettings.setVisible(isVisibleRightTop);
            scatterSeriesSettingsHighlight.setSymbolColor(symbolColorSeriesRightTopHighlight);
            scatterSeriesSettingsHighlight.setSymbolType(plotSymbolTypeRightTopHighlight);
            scatterSeriesSettingsHighlight.setVisible(isVisibleRightTopHighlight);
        } else if (x > 0 && y < 0) {
            scatterSeriesSettings.setSymbolColor(symbolColorSeriesRightBottom);
            scatterSeriesSettings.setSymbolType(plotSymbolTypeRightBottom);
            scatterSeriesSettings.setVisible(isVisibleRightBottom);
            scatterSeriesSettingsHighlight.setSymbolColor(symbolColorSeriesRightBottomHighlight);
            scatterSeriesSettingsHighlight.setSymbolType(plotSymbolTypeRightBottomHighlight);
            scatterSeriesSettingsHighlight.setVisible(isVisibleRightBottomHighlight);
        } else if (x < 0 && y > 0) {
            scatterSeriesSettings.setSymbolColor(symbolColorSeriesLeftTop);
            scatterSeriesSettings.setSymbolType(plotSymbolTypeLeftTop);
            scatterSeriesSettings.setVisible(isVisibleLeftTop);
            scatterSeriesSettingsHighlight.setSymbolColor(symbolColorSeriesLeftTopHighlight);
            scatterSeriesSettingsHighlight.setSymbolType(plotSymbolTypeLeftTopHighlight);
            scatterSeriesSettingsHighlight.setVisible(isVisibleLeftTopHighlight);
        } else if (x < 0 && y < 0) {
            scatterSeriesSettings.setSymbolColor(symbolColorSeriesLeftBottom);
            scatterSeriesSettings.setSymbolType(plotSymbolTypeLeftBottom);
            scatterSeriesSettings.setVisible(isVisibleLeftBottom);
            scatterSeriesSettingsHighlight.setSymbolColor(symbolColorSeriesLeftBottomHighlight);
            scatterSeriesSettingsHighlight.setSymbolType(plotSymbolTypeLeftBottomHighlight);
            scatterSeriesSettingsHighlight.setVisible(isVisibleLeftBottomHighlight);
        }
        // 
        scatterSeriesDataList.add(scatterSeriesData);
    }
    // 
    scatterChart.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) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) PlotSymbolType(org.eclipse.swtchart.ILineSeries.PlotSymbolType)

Example 23 with ISeriesData

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

the class MeasurementSeries_1_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_1_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_1_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 24 with ISeriesData

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

the class MeasurementSeries_2_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.
		 */
    Map<Integer, Color> colors = new HashMap<Integer, Color>();
    colors.put(1, getDisplay().getSystemColor(SWT.COLOR_BLACK));
    colors.put(2, getDisplay().getSystemColor(SWT.COLOR_RED));
    colors.put(3, getDisplay().getSystemColor(SWT.COLOR_GRAY));
    // 
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    ILineSeriesSettings lineSeriesSettingsHighlight;
    // 
    for (int i = 1; i <= 3; i++) {
        /*
			 * Readings
			 */
        seriesData = SeriesConverter.getSeriesXY("Measurement2_Readings_" + i);
        lineSeriesData = new LineSeriesData(seriesData);
        lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
        lineSeriesSettings.setEnableArea(false);
        lineSeriesSettings.setLineStyle(LineStyle.NONE);
        lineSeriesSettings.setSymbolSize(5);
        lineSeriesSettings.setSymbolColor(colors.get(i));
        lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
        lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
        lineSeriesSettingsHighlight.setLineWidth(2);
        lineSeriesDataList.add(lineSeriesData);
        /*
			 * Regression
			 */
        seriesData = SeriesConverter.getSeriesXY("Measurement2_Regression_" + i);
        lineSeriesData = new LineSeriesData(seriesData);
        lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
        lineSeriesSettings.setEnableArea(false);
        lineSeriesSettings.setLineStyle(LineStyle.SOLID);
        lineSeriesSettings.setLineColor(colors.get(i));
        lineSeriesSettings.setSymbolType(PlotSymbolType.NONE);
        lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
        lineSeriesSettingsHighlight.setLineWidth(2);
        lineSeriesDataList.add(lineSeriesData);
    }
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
}
Also used : 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) HashMap(java.util.HashMap) DecimalFormat(java.text.DecimalFormat) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) ILineSeriesSettings(org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Example 25 with ISeriesData

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

the class ScatterSeries_2_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    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_BLACK));
    colors.put(3, getDisplay().getSystemColor(SWT.COLOR_GRAY));
    colors.put(4, getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    colors.put(5, getDisplay().getSystemColor(SWT.COLOR_GRAY));
    colors.put(6, getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN));
    colors.put(7, getDisplay().getSystemColor(SWT.COLOR_GREEN));
    colors.put(8, getDisplay().getSystemColor(SWT.COLOR_DARK_YELLOW));
    colors.put(9, getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));
    // 
    Map<Integer, String> descriptions = new HashMap<Integer, String>();
    descriptions.put(1, "Benzothiophene");
    descriptions.put(2, "Cyclische Alkane");
    descriptions.put(3, "n-/iso-Alkane");
    descriptions.put(4, "Diaromaten");
    descriptions.put(5, "Dibenzothiophene");
    descriptions.put(6, "Monoaromaten");
    descriptions.put(7, "Polyaromaten");
    descriptions.put(8, "Triaromaten");
    descriptions.put(9, "Unknown");
    // 
    List<IScatterSeriesData> scatterSeriesDataList = new ArrayList<IScatterSeriesData>();
    for (int i = 1; i <= 9; i++) {
        String id = descriptions.get(i);
        String fileName = SeriesConverter.SCATTER_SERIES + "2_" + i;
        ISeriesData seriesData = SeriesConverter.getSeriesXY(fileName, id);
        IScatterSeriesData scatterSeriesData = new ScatterSeriesData(seriesData);
        IScatterSeriesSettings scatterSeriesSettings = scatterSeriesData.getScatterSeriesSettings();
        scatterSeriesSettings.setDescription(id);
        scatterSeriesSettings.setSymbolSize(SYMBOL_SIZE);
        scatterSeriesSettings.setSymbolColor(colors.get(i));
        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) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) 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