use of org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings in project swtchart by eclipse.
the class ChromatogramChart method setPrimaryAxisSet.
private void setPrimaryAxisSet(IChartSettings chartSettings) {
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));
primaryAxisSettingsX.setPosition(Position.Secondary);
primaryAxisSettingsX.setVisible(false);
primaryAxisSettingsX.setGridLineStyle(LineStyle.NONE);
//
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);
}
use of org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings in project swtchart by eclipse.
the class PCAChart method setPrimaryAxisSet.
private void setPrimaryAxisSet(IChartSettings chartSettings) {
IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
primaryAxisSettingsX.setTitle(xAxisTitle);
primaryAxisSettingsX.setDecimalFormat(decimalFormat);
primaryAxisSettingsX.setColor(COLOR_BLACK);
//
IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
primaryAxisSettingsY.setTitle(yAxisTitle);
primaryAxisSettingsY.setDecimalFormat(decimalFormat);
primaryAxisSettingsY.setColor(COLOR_BLACK);
}
use of org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings in project swtchart by eclipse.
the class ScatterSeries_Preferences_Part method applyChartSettings.
private void applyChartSettings() throws Exception {
IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
//
Color colorHintRangeSelector = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_HINT_RANGE_SELECTOR));
Color colorTitle = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_TITLE_COLOR));
Color colorBackground = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_BACKGROUND));
Color colorBackgroundChart = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_BACKGROUND_CHART));
Color colorBackgroundPlotArea = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_BACKGROUND_PLOT_AREA));
Color colorPrimaryXAxis = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_COLOR));
Color colorPrimaryYAxis = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_COLOR));
Locale localePrimaryXAxis = new Locale(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DECIMAL_FORMAT_LOCALE));
Locale localePrimaryYAxis = new Locale(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DECIMAL_FORMAT_LOCALE));
Color colorPositionMarker = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_POSITION_MARKER));
Color colorPlotCenterMarker = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_PLOT_CENTER_MARKER));
Color colorLegendMarker = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_LEGEND_MARKER));
Color colorAxisZeroMarker = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_AXIS_ZERO_MARKER));
Color colorSeriesLabelMarker = getColor(PreferenceConverter.getColor(preferenceStore, ScatterSeriesPreferenceConstants.P_COLOR_SERIES_LABEL_MARKER));
//
IChartSettings chartSettings = scatterChart.getChartSettings();
chartSettings.setEnableRangeSelector(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_ENABLE_RANGE_SELECTOR));
chartSettings.setShowRangeSelectorInitially(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_RANGE_SELECTOR_INITIALLY));
chartSettings.setColorHintRangeSelector(colorHintRangeSelector);
chartSettings.setRangeSelectorDefaultAxisX(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_RANGE_SELECTOR_DEFAULT_AXIS_X));
chartSettings.setRangeSelectorDefaultAxisY(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_RANGE_SELECTOR_DEFAULT_AXIS_Y));
chartSettings.setVerticalSliderVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_VERTICAL_SLIDER_VISIBLE));
chartSettings.setHorizontalSliderVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_HORIZONTAL_SLIDER_VISIBLE));
chartSettings.setTitle(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_TITLE));
chartSettings.setTitleVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_TITLE_VISIBLE));
chartSettings.setTitleColor(colorTitle);
chartSettings.setLegendPosition(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_LEGEND_POSITION));
chartSettings.setLegendVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_LEGEND_VISIBLE));
chartSettings.setOrientation(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_ORIENTATION));
chartSettings.setBackground(colorBackground);
chartSettings.setBackgroundChart(colorBackgroundChart);
chartSettings.setBackgroundPlotArea(colorBackgroundPlotArea);
chartSettings.setEnableCompress(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_ENABLE_COMPRESS));
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setZeroX(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_ZERO_X));
rangeRestriction.setZeroY(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_ZERO_Y));
rangeRestriction.setRestrictZoom(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_RESTRICT_ZOOM));
rangeRestriction.setXZoomOnly(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_X_ZOOM_ONLY));
rangeRestriction.setYZoomOnly(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_Y_ZOOM_ONLY));
rangeRestriction.setForceZeroMinY(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_FORCE_ZERO_MIN_Y));
rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_EXTEND_TYPE_X)));
rangeRestriction.setExtendMinX(preferenceStore.getDouble(ScatterSeriesPreferenceConstants.P_EXTEND_MIN_X));
rangeRestriction.setExtendMaxX(preferenceStore.getDouble(ScatterSeriesPreferenceConstants.P_EXTEND_MAX_X));
rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_EXTEND_TYPE_Y)));
rangeRestriction.setExtendMinY(preferenceStore.getDouble(ScatterSeriesPreferenceConstants.P_EXTEND_MIN_Y));
rangeRestriction.setExtendMaxY(preferenceStore.getDouble(ScatterSeriesPreferenceConstants.P_EXTEND_MAX_Y));
//
chartSettings.setShowPositionMarker(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_POSITION_MARKER));
chartSettings.setColorPositionMarker(colorPositionMarker);
chartSettings.setShowPlotCenterMarker(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_PLOT_CENTER_MARKER));
chartSettings.setColorPlotCenterMarker(colorPlotCenterMarker);
chartSettings.setShowLegendMarker(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_LEGEND_MARKER));
chartSettings.setColorLegendMarker(colorLegendMarker);
chartSettings.setShowAxisZeroMarker(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_AXIS_ZERO_MARKER));
chartSettings.setColorAxisZeroMarker(colorAxisZeroMarker);
chartSettings.setShowSeriesLabelMarker(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_SHOW_SERIES_LABEL_MARKER));
chartSettings.setColorSeriesLabelMarker(colorSeriesLabelMarker);
//
chartSettings.setCreateMenu(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_CREATE_MENU));
/*
* Primary X-Axis
*/
IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
primaryAxisSettingsX.setTitle(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_TITLE));
primaryAxisSettingsX.setDescription(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DESCRIPTION));
primaryAxisSettingsX.setDecimalFormat(new DecimalFormat((preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DECIMAL_FORMAT_PATTERN)), new DecimalFormatSymbols(localePrimaryXAxis)));
primaryAxisSettingsX.setColor(colorPrimaryXAxis);
primaryAxisSettingsX.setPosition(Position.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_POSITION)));
primaryAxisSettingsX.setVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_VISIBLE));
primaryAxisSettingsX.setGridLineStyle(LineStyle.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_GRID_LINE_STYLE)));
primaryAxisSettingsX.setEnableLogScale(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_ENABLE_LOG_SCALE));
primaryAxisSettingsX.setExtraSpaceTitle(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_PRIMARY_X_AXIS_EXTRA_SPACE_TITLE));
/*
* Primary Y-Axis
*/
IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
primaryAxisSettingsY.setTitle(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_TITLE));
primaryAxisSettingsY.setDescription(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DESCRIPTION));
primaryAxisSettingsY.setDecimalFormat(new DecimalFormat((preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DECIMAL_FORMAT_PATTERN)), new DecimalFormatSymbols(localePrimaryYAxis)));
primaryAxisSettingsY.setColor(colorPrimaryYAxis);
primaryAxisSettingsY.setPosition(Position.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_POSITION)));
primaryAxisSettingsY.setVisible(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_VISIBLE));
primaryAxisSettingsY.setGridLineStyle(LineStyle.valueOf(preferenceStore.getString(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_GRID_LINE_STYLE)));
primaryAxisSettingsY.setEnableLogScale(preferenceStore.getBoolean(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_ENABLE_LOG_SCALE));
primaryAxisSettingsY.setExtraSpaceTitle(preferenceStore.getInt(ScatterSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_EXTRA_SPACE_TITLE));
//
scatterChart.applySettings(chartSettings);
}
use of org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings 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);
}
use of org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings 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);
}
Aggregations