Search in sources :

Example 11 with LineSeriesData

use of org.eclipse.swtchart.extensions.linecharts.LineSeriesData 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 12 with LineSeriesData

use of org.eclipse.swtchart.extensions.linecharts.LineSeriesData 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 13 with LineSeriesData

use of org.eclipse.swtchart.extensions.linecharts.LineSeriesData in project swtchart by eclipse.

the class LineSeries_Preferences_Part method applySeriesSettings.

private void applySeriesSettings() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    Color lineColorSeries1 = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_LINE_COLOR_SERIES_1));
    Color symbolColorSeries1 = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_1));
    Color lineColorSeries2 = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_LINE_COLOR_SERIES_2));
    Color symbolColorSeries2 = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_2));
    Color lineColorSeries1Highlight = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_LINE_COLOR_SERIES_1_HIGHLIGHT));
    Color symbolColorSeries1Highlight = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_1_HIGHLIGHT));
    Color lineColorSeries2Highlight = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_LINE_COLOR_SERIES_2_HIGHLIGHT));
    Color symbolColorSeries2Highlight = getColor(PreferenceConverter.getColor(preferenceStore, LineSeriesPreferenceConstants.P_SYMBOL_COLOR_SERIES_2_HIGHLIGHT));
    // 
    lineChart.deleteSeries();
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    ILineSeriesSettings lineSeriesSettingsHighlight;
    /*
		 * Series 1
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_4_1);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setDescription(preferenceStore.getString(LineSeriesPreferenceConstants.P_DESCRIPTION_SERIES_1));
    lineSeriesSettings.setAntialias(preferenceStore.getInt(LineSeriesPreferenceConstants.P_ANTIALIAS_SERIES_1));
    lineSeriesSettings.setEnableArea(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_AREA_SERIES_1));
    lineSeriesSettings.setEnableStack(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STACK_SERIES_1));
    lineSeriesSettings.setEnableStep(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STEP_SERIES_1));
    lineSeriesSettings.setLineColor(lineColorSeries1);
    lineSeriesSettings.setLineStyle(LineStyle.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_LINE_STYLE_SERIES_1)));
    lineSeriesSettings.setLineWidth(preferenceStore.getInt(LineSeriesPreferenceConstants.P_LINE_WIDTH_SERIES_1));
    lineSeriesSettings.setSymbolColor(symbolColorSeries1);
    lineSeriesSettings.setSymbolSize(preferenceStore.getInt(LineSeriesPreferenceConstants.P_SYMBOL_SIZE_SERIES_1));
    lineSeriesSettings.setSymbolType(PlotSymbolType.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_1)));
    lineSeriesSettings.setVisible(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_SERIES_1));
    lineSeriesSettings.setVisibleInLegend(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_1));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setAntialias(preferenceStore.getInt(LineSeriesPreferenceConstants.P_ANTIALIAS_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableArea(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_AREA_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableStack(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STACK_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableStep(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STEP_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setLineColor(lineColorSeries1Highlight);
    lineSeriesSettingsHighlight.setLineStyle(LineStyle.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_LINE_STYLE_SERIES_1_HIGHLIGHT)));
    lineSeriesSettingsHighlight.setLineWidth(preferenceStore.getInt(LineSeriesPreferenceConstants.P_LINE_WIDTH_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setSymbolColor(symbolColorSeries1Highlight);
    lineSeriesSettingsHighlight.setSymbolSize(preferenceStore.getInt(LineSeriesPreferenceConstants.P_SYMBOL_SIZE_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setSymbolType(PlotSymbolType.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_1_HIGHLIGHT)));
    lineSeriesSettingsHighlight.setVisible(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_SERIES_1_HIGHLIGHT));
    lineSeriesSettingsHighlight.setVisibleInLegend(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_1_HIGHLIGHT));
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Series 2
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_4_2);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setDescription(preferenceStore.getString(LineSeriesPreferenceConstants.P_DESCRIPTION_SERIES_2));
    lineSeriesSettings.setAntialias(preferenceStore.getInt(LineSeriesPreferenceConstants.P_ANTIALIAS_SERIES_2));
    lineSeriesSettings.setEnableArea(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_AREA_SERIES_2));
    lineSeriesSettings.setEnableStack(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STACK_SERIES_2));
    lineSeriesSettings.setEnableStep(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STEP_SERIES_2));
    lineSeriesSettings.setLineColor(lineColorSeries2);
    lineSeriesSettings.setLineStyle(LineStyle.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_LINE_STYLE_SERIES_2)));
    lineSeriesSettings.setLineWidth(preferenceStore.getInt(LineSeriesPreferenceConstants.P_LINE_WIDTH_SERIES_2));
    lineSeriesSettings.setSymbolColor(symbolColorSeries2);
    lineSeriesSettings.setSymbolSize(preferenceStore.getInt(LineSeriesPreferenceConstants.P_SYMBOL_SIZE_SERIES_2));
    lineSeriesSettings.setSymbolType(PlotSymbolType.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_2)));
    lineSeriesSettings.setVisible(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_SERIES_2));
    lineSeriesSettings.setVisibleInLegend(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_2));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setAntialias(preferenceStore.getInt(LineSeriesPreferenceConstants.P_ANTIALIAS_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableArea(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_AREA_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableStack(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STACK_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setEnableStep(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_ENABLE_STEP_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setLineColor(lineColorSeries2Highlight);
    lineSeriesSettingsHighlight.setLineStyle(LineStyle.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_LINE_STYLE_SERIES_2_HIGHLIGHT)));
    lineSeriesSettingsHighlight.setLineWidth(preferenceStore.getInt(LineSeriesPreferenceConstants.P_LINE_WIDTH_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setSymbolColor(symbolColorSeries2Highlight);
    lineSeriesSettingsHighlight.setSymbolSize(preferenceStore.getInt(LineSeriesPreferenceConstants.P_SYMBOL_SIZE_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setSymbolType(PlotSymbolType.valueOf(preferenceStore.getString(LineSeriesPreferenceConstants.P_SYMBOL_TYPE_SERIES_2_HIGHLIGHT)));
    lineSeriesSettingsHighlight.setVisible(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_SERIES_2_HIGHLIGHT));
    lineSeriesSettingsHighlight.setVisibleInLegend(preferenceStore.getBoolean(LineSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_2_HIGHLIGHT));
    lineSeriesDataList.add(lineSeriesData);
    // 
    lineChart.addSeriesData(lineSeriesDataList, LineChart.HIGH_COMPRESSION);
}
Also used : 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) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 14 with LineSeriesData

use of org.eclipse.swtchart.extensions.linecharts.LineSeriesData in project swtchart by eclipse.

the class LineSeries_10_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    // 
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    /*
		 * Chromatogram [0]
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    ILineSeriesSettings lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Active Peaks [1]
		 */
    indexSeries = 1;
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_ACTIVE_PEAKS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.INVERTED_TRIANGLE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
    /*
		 * Add the label marker.
		 */
    IPlotArea plotArea = (IPlotArea) getBaseChart().getPlotArea();
    LabelMarker labelMarker = new LabelMarker(getBaseChart());
    List<String> labels = new ArrayList<String>();
    labels.add("[1]");
    labels.add("[2]");
    labels.add("[3]");
    labels.add("[4]");
    labels.add("[5]");
    labels.add("[6]");
    labels.add("[7]");
    labels.add("[8]");
    labels.add("[9]");
    labels.add("[10]");
    labelMarker.setLabels(labels, indexSeries, SWT.HORIZONTAL);
    plotArea.addCustomPaintListener(labelMarker);
}
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) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList) IPlotArea(org.eclipse.swtchart.IPlotArea) LabelMarker(org.eclipse.swtchart.extensions.marker.LabelMarker)

Example 15 with LineSeriesData

use of org.eclipse.swtchart.extensions.linecharts.LineSeriesData in project swtchart by eclipse.

the class LineSeries_1_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    // 
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    ILineSeriesSettings lineSeriesSettingsHighlight;
    /*
		 * Chromatogram [0]
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Baseline [1]
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_BASELINE);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettings.setSymbolType(PlotSymbolType.NONE);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Selected Scans [2]
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_SELECTED_SCANS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CROSS);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Active Peaks [3]
		 */
    indexSeries = 3;
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_ACTIVE_PEAKS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.INVERTED_TRIANGLE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Inactive Peaks
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_INACTIVE_PEAKS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.INVERTED_TRIANGLE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Peak 1
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_SELECTED_PEAK_1);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettings.setSymbolSize(2);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Background 1
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_SELECTED_PEAK_1_BACKGROUND);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettings.setSymbolType(PlotSymbolType.NONE);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Peak 2
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_SELECTED_PEAK_2);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettings.setSymbolSize(2);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Background 2
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_SELECTED_PEAK_2_BACKGROUND);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    lineSeriesSettings.setSymbolType(PlotSymbolType.NONE);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Identified Scans
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_IDENTIFIED_SCANS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
    lineSeriesSettings.setSymbolSize(3);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Identified Scans Selected.
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_IDENTIFIED_SCANS_SELECTED);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.CIRCLE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_DARK_RED));
    lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
    /*
		 * Set the labels.
		 */
    IPlotArea plotArea = (IPlotArea) getBaseChart().getPlotArea();
    LabelMarker labelMarker = new LabelMarker(getBaseChart());
    List<String> labels = new ArrayList<String>();
    labels.add("2-Methoxy-4-vinylphenol");
    labels.add("Ethanone, 1-(2-hydroxy-5-methylphenyl)-");
    labels.add("4-Hydroxy-2-methylacetophenone");
    labels.add("Ethanone, 1-(2-hydroxy-5-methylphenyl)-");
    labels.add("4-Hydroxy-3-methylacetophenone");
    labels.add("3-Methoxyacetophenone");
    labels.add("3-Methyl-4-isopropylphenol");
    labels.add("Phenol, 3,4-dimethoxy-");
    labels.add("2,4-Dimethoxyphenol");
    labels.add("3-Amino-2,6-dimethoxypyridine");
    labelMarker.setLabels(labels, indexSeries, SWT.VERTICAL);
    plotArea.addCustomPaintListener(labelMarker);
}
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) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList) IPlotArea(org.eclipse.swtchart.IPlotArea) LabelMarker(org.eclipse.swtchart.extensions.marker.LabelMarker)

Aggregations

ArrayList (java.util.ArrayList)20 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)20 ILineSeriesData (org.eclipse.swtchart.extensions.linecharts.ILineSeriesData)20 ILineSeriesSettings (org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings)20 LineSeriesData (org.eclipse.swtchart.extensions.linecharts.LineSeriesData)20 IChartSettings (org.eclipse.swtchart.extensions.core.IChartSettings)15 DecimalFormat (java.text.DecimalFormat)7 DecimalFormatSymbols (java.text.DecimalFormatSymbols)7 IPrimaryAxisSettings (org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)7 Color (org.eclipse.swt.graphics.Color)4 IPlotArea (org.eclipse.swtchart.IPlotArea)4 LabelMarker (org.eclipse.swtchart.extensions.marker.LabelMarker)4 HashMap (java.util.HashMap)3 ISecondaryAxisSettings (org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings)3 SecondaryAxisSettings (org.eclipse.swtchart.extensions.core.SecondaryAxisSettings)3 RelativeIntensityConverter (org.eclipse.swtchart.extensions.axisconverter.RelativeIntensityConverter)2 ChromatogramChart (org.eclipse.swtchart.extensions.customcharts.ChromatogramChart)2 File (java.io.File)1 List (java.util.List)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1