use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.
the class BarSeries_1_1_Part method initialize.
private void initialize() {
/*
* Chart Settings
*/
IChartSettings chartSettings = getChartSettings();
chartSettings.setCreateMenu(true);
applySettings(chartSettings);
/*
* Additional settings
*/
setNumberOfHighestIntensitiesToLabel(5);
setLabelOption(LabelOption.NOMIMAL);
setCustomLabels(null);
/*
* Create series.
*/
List<IBarSeriesData> barSeriesDataList = new ArrayList<IBarSeriesData>();
ISeriesData seriesData = SeriesConverter.getSeriesXY(SeriesConverter.BAR_SERIES_1);
//
IBarSeriesData barSeriesData = new BarSeriesData(seriesData);
barSeriesDataList.add(barSeriesData);
/*
* Set series.
*/
addSeriesData(barSeriesDataList);
}
use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.
the class ChromatogramChart method initialize.
private void initialize() {
/*
* Chart Settings
*/
IChartSettings chartSettings = getChartSettings();
chartSettings.setOrientation(SWT.HORIZONTAL);
chartSettings.setHorizontalSliderVisible(true);
chartSettings.setVerticalSliderVisible(false);
chartSettings.getRangeRestriction().setZeroX(true);
chartSettings.getRangeRestriction().setZeroY(true);
//
setPrimaryAxisSet(chartSettings);
addSecondaryAxisSet(chartSettings);
applySettings(chartSettings);
}
use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.
the class PCAChart method setDecimalFormat.
public void setDecimalFormat(DecimalFormat decimalFormat) {
this.decimalFormat = decimalFormat;
//
IChartSettings chartSettings = getChartSettings();
chartSettings.getPrimaryAxisSettingsX().setDecimalFormat(decimalFormat);
chartSettings.getPrimaryAxisSettingsY().setDecimalFormat(decimalFormat);
for (ISecondaryAxisSettings secondaryAxisSettings : chartSettings.getSecondaryAxisSettingsListX()) {
secondaryAxisSettings.setDecimalFormat(decimalFormat);
}
for (ISecondaryAxisSettings secondaryAxisSettings : chartSettings.getSecondaryAxisSettingsListY()) {
secondaryAxisSettings.setDecimalFormat(decimalFormat);
}
applySettings(chartSettings);
}
use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.
the class PCAChart method initialize.
private void initialize() {
IChartSettings chartSettings = getChartSettings();
chartSettings.setTitle(chartTitle);
chartSettings.setTitleVisible(true);
chartSettings.setTitleColor(COLOR_BLACK);
chartSettings.setOrientation(SWT.HORIZONTAL);
chartSettings.setHorizontalSliderVisible(false);
chartSettings.setVerticalSliderVisible(false);
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setZeroX(false);
rangeRestriction.setZeroY(false);
rangeRestriction.setRestrictZoom(false);
rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.RELATIVE);
rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.RELATIVE);
rangeRestriction.setExtend(0.25d);
chartSettings.setShowAxisZeroMarker(true);
chartSettings.setColorAxisZeroMarker(COLOR_BLACK);
chartSettings.setShowSeriesLabelMarker(true);
chartSettings.setColorSeriesLabelMarker(COLOR_BLACK);
//
setPrimaryAxisSet(chartSettings);
addSecondaryAxisSet(chartSettings);
//
applySettings(chartSettings);
}
use of org.eclipse.swtchart.extensions.core.IChartSettings 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);
}
Aggregations