use of org.eclipse.swtchart.ILineSeries.PlotSymbolType 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);
}
use of org.eclipse.swtchart.ILineSeries.PlotSymbolType in project swtchart by eclipse.
the class SeriesPage method addLineSeriesGroup.
/**
* Adds the line series group.
*
* @param parent
* the parent to add the line series group
*/
private void addLineSeriesGroup(Composite parent) {
lineSeriesGroup = createGroupControl(parent, "Line series:", true);
stackLayout.topControl = lineSeriesGroup;
createLabelControl(lineSeriesGroup, "Line color:");
lineColorButton = createColorButtonControl(lineSeriesGroup);
lineColorButton.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
lineColors[selectedIndex] = lineColorButton.getColorValue();
}
});
createLabelControl(lineSeriesGroup, "Line style:");
LineStyle[] styles = LineStyle.values();
String[] labels = new String[styles.length];
for (int i = 0; i < styles.length; i++) {
labels[i] = styles[i].label;
}
lineStyleCombo = createComboControl(lineSeriesGroup, labels);
lineStyleCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String value = lineStyleCombo.getText();
LineStyle selectedStyle = LineStyle.NONE;
for (LineStyle style : LineStyle.values()) {
if (style.label.equals(value)) {
selectedStyle = style;
}
}
lineStyles[selectedIndex] = selectedStyle;
}
});
createLabelControl(lineSeriesGroup, "Symbol color:");
symbolColorButton = createColorButtonControl(lineSeriesGroup);
symbolColorButton.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
symbolColors[selectedIndex] = symbolColorButton.getColorValue();
}
});
createLabelControl(lineSeriesGroup, "Symbol type:");
PlotSymbolType[] types = PlotSymbolType.values();
labels = new String[types.length];
for (int i = 0; i < types.length; i++) {
labels[i] = types[i].label;
}
symbolTypeCombo = createComboControl(lineSeriesGroup, labels);
symbolTypeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String value = symbolTypeCombo.getText();
PlotSymbolType selectedType = PlotSymbolType.CIRCLE;
for (PlotSymbolType type : PlotSymbolType.values()) {
if (type.label.equals(value)) {
selectedType = type;
}
}
symbolTypes[selectedIndex] = selectedType;
}
});
createLabelControl(lineSeriesGroup, "Symbol size:");
symbolSizeSpinner = createSpinnerControl(lineSeriesGroup, 1, 10);
symbolSizeSpinner.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
symbolSizes[selectedIndex] = symbolSizeSpinner.getSelection();
}
});
}
Aggregations