use of org.eclipse.swtchart.extensions.core.SecondaryAxisSettings in project swtchart by eclipse.
the class MassSpectrumChart method addSecondaryAxisSet.
private void addSecondaryAxisSet(IChartSettings chartSettings) {
ISecondaryAxisSettings secondaryAxisSettingsY = new SecondaryAxisSettings("Relative Intensity [%]", new RelativeIntensityConverter(SWT.VERTICAL, true));
secondaryAxisSettingsY.setPosition(Position.Secondary);
secondaryAxisSettingsY.setDecimalFormat(new DecimalFormat(("0.00"), new DecimalFormatSymbols(Locale.ENGLISH)));
secondaryAxisSettingsY.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
chartSettings.getSecondaryAxisSettingsListY().add(secondaryAxisSettingsY);
}
use of org.eclipse.swtchart.extensions.core.SecondaryAxisSettings in project swtchart by eclipse.
the class PCAChart method addSecondaryAxisSet.
private void addSecondaryAxisSet(IChartSettings chartSettings) {
ISecondaryAxisSettings secondaryAxisSettingsX = new SecondaryAxisSettings(xAxisTitle, new PassThroughConverter());
secondaryAxisSettingsX.setTitle("");
secondaryAxisSettingsX.setPosition(Position.Secondary);
secondaryAxisSettingsX.setDecimalFormat(decimalFormat);
secondaryAxisSettingsX.setColor(COLOR_BLACK);
chartSettings.getSecondaryAxisSettingsListX().add(secondaryAxisSettingsX);
//
ISecondaryAxisSettings secondaryAxisSettingsY = new SecondaryAxisSettings(yAxisTitle, new PassThroughConverter());
secondaryAxisSettingsY.setPosition(Position.Secondary);
secondaryAxisSettingsY.setDecimalFormat(decimalFormat);
secondaryAxisSettingsY.setColor(COLOR_BLACK);
chartSettings.getSecondaryAxisSettingsListY().add(secondaryAxisSettingsY);
}
use of org.eclipse.swtchart.extensions.core.SecondaryAxisSettings in project swtchart by eclipse.
the class BarSeries_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, BarSeriesPreferenceConstants.P_COLOR_HINT_RANGE_SELECTOR));
Color colorTitle = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_TITLE_COLOR));
Color colorBackground = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_BACKGROUND));
Color colorBackgroundChart = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_BACKGROUND_CHART));
Color colorBackgroundPlotArea = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_BACKGROUND_PLOT_AREA));
Color colorPrimaryXAxis = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_COLOR));
Color colorPrimaryYAxis = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_COLOR));
Color colorSecondaryYAxis = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_COLOR));
Locale localePrimaryXAxis = new Locale(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DECIMAL_FORMAT_LOCALE));
Locale localePrimaryYAxis = new Locale(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DECIMAL_FORMAT_LOCALE));
Locale localeSecondaryYAxis = new Locale(preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_DECIMAL_FORMAT_LOCALE));
Color colorPositionMarker = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_COLOR_POSITION_MARKER));
Color colorPlotCenterMarker = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_COLOR_PLOT_CENTER_MARKER));
Color colorLegendMarker = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_COLOR_LEGEND_MARKER));
Color colorAxisZeroMarker = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_COLOR_AXIS_ZERO_MARKER));
Color colorSeriesLabelMarker = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_COLOR_SERIES_LABEL_MARKER));
//
IChartSettings chartSettings = barChart.getChartSettings();
chartSettings.setEnableRangeSelector(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_ENABLE_RANGE_SELECTOR));
chartSettings.setShowRangeSelectorInitially(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_RANGE_SELECTOR_INITIALLY));
chartSettings.setColorHintRangeSelector(colorHintRangeSelector);
chartSettings.setRangeSelectorDefaultAxisX(preferenceStore.getInt(BarSeriesPreferenceConstants.P_RANGE_SELECTOR_DEFAULT_AXIS_X));
chartSettings.setRangeSelectorDefaultAxisY(preferenceStore.getInt(BarSeriesPreferenceConstants.P_RANGE_SELECTOR_DEFAULT_AXIS_Y));
chartSettings.setVerticalSliderVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_VERTICAL_SLIDER_VISIBLE));
chartSettings.setHorizontalSliderVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_HORIZONTAL_SLIDER_VISIBLE));
chartSettings.setTitle(preferenceStore.getString(BarSeriesPreferenceConstants.P_TITLE));
chartSettings.setTitleVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_TITLE_VISIBLE));
chartSettings.setTitleColor(colorTitle);
chartSettings.setLegendPosition(preferenceStore.getInt(BarSeriesPreferenceConstants.P_LEGEND_POSITION));
chartSettings.setLegendVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_LEGEND_VISIBLE));
chartSettings.setOrientation(preferenceStore.getInt(BarSeriesPreferenceConstants.P_ORIENTATION));
chartSettings.setBackground(colorBackground);
chartSettings.setBackgroundChart(colorBackgroundChart);
chartSettings.setBackgroundPlotArea(colorBackgroundPlotArea);
chartSettings.setEnableCompress(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_ENABLE_COMPRESS));
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setZeroX(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_ZERO_X));
rangeRestriction.setZeroY(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_ZERO_Y));
rangeRestriction.setRestrictZoom(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_RESTRICT_ZOOM));
rangeRestriction.setXZoomOnly(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_X_ZOOM_ONLY));
rangeRestriction.setYZoomOnly(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_Y_ZOOM_ONLY));
rangeRestriction.setForceZeroMinY(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_FORCE_ZERO_MIN_Y));
rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_EXTEND_TYPE_X)));
rangeRestriction.setExtendMinX(preferenceStore.getDouble(BarSeriesPreferenceConstants.P_EXTEND_MIN_X));
rangeRestriction.setExtendMaxX(preferenceStore.getDouble(BarSeriesPreferenceConstants.P_EXTEND_MAX_X));
rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_EXTEND_TYPE_Y)));
rangeRestriction.setExtendMinY(preferenceStore.getDouble(BarSeriesPreferenceConstants.P_EXTEND_MIN_Y));
rangeRestriction.setExtendMaxY(preferenceStore.getDouble(BarSeriesPreferenceConstants.P_EXTEND_MAX_Y));
//
chartSettings.setShowPositionMarker(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_POSITION_MARKER));
chartSettings.setColorPositionMarker(colorPositionMarker);
chartSettings.setShowPlotCenterMarker(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_PLOT_CENTER_MARKER));
chartSettings.setColorPlotCenterMarker(colorPlotCenterMarker);
chartSettings.setShowLegendMarker(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_LEGEND_MARKER));
chartSettings.setColorLegendMarker(colorLegendMarker);
chartSettings.setShowAxisZeroMarker(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_AXIS_ZERO_MARKER));
chartSettings.setColorLegendMarker(colorAxisZeroMarker);
chartSettings.setShowSeriesLabelMarker(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SHOW_SERIES_LABEL_MARKER));
chartSettings.setColorSeriesLabelMarker(colorSeriesLabelMarker);
//
chartSettings.setCreateMenu(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_CREATE_MENU));
/*
* Primary X-Axis
*/
IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
primaryAxisSettingsX.setTitle(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_TITLE));
primaryAxisSettingsX.setDescription(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DESCRIPTION));
primaryAxisSettingsX.setDecimalFormat(new DecimalFormat((preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_DECIMAL_FORMAT_PATTERN)), new DecimalFormatSymbols(localePrimaryXAxis)));
primaryAxisSettingsX.setColor(colorPrimaryXAxis);
primaryAxisSettingsX.setPosition(Position.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_POSITION)));
primaryAxisSettingsX.setVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_VISIBLE));
primaryAxisSettingsX.setGridLineStyle(LineStyle.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_GRID_LINE_STYLE)));
primaryAxisSettingsX.setEnableLogScale(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_ENABLE_LOG_SCALE));
primaryAxisSettingsX.setExtraSpaceTitle(preferenceStore.getInt(BarSeriesPreferenceConstants.P_PRIMARY_X_AXIS_EXTRA_SPACE_TITLE));
/*
* Primary Y-Axis
*/
IPrimaryAxisSettings primaryAxisSettingsY = chartSettings.getPrimaryAxisSettingsY();
primaryAxisSettingsY.setTitle(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_TITLE));
primaryAxisSettingsY.setDescription(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DESCRIPTION));
primaryAxisSettingsY.setDecimalFormat(new DecimalFormat((preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_DECIMAL_FORMAT_PATTERN)), new DecimalFormatSymbols(localePrimaryYAxis)));
primaryAxisSettingsY.setColor(colorPrimaryYAxis);
primaryAxisSettingsY.setPosition(Position.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_POSITION)));
primaryAxisSettingsY.setVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_VISIBLE));
primaryAxisSettingsY.setGridLineStyle(LineStyle.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_GRID_LINE_STYLE)));
primaryAxisSettingsY.setEnableLogScale(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_ENABLE_LOG_SCALE));
primaryAxisSettingsY.setExtraSpaceTitle(preferenceStore.getInt(BarSeriesPreferenceConstants.P_PRIMARY_Y_AXIS_EXTRA_SPACE_TITLE));
/*
* Secondary Y-Axes
*/
chartSettings.getSecondaryAxisSettingsListY().clear();
ISecondaryAxisSettings secondaryAxisSettingsY = new SecondaryAxisSettings(preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_TITLE), new RelativeIntensityConverter(SWT.VERTICAL, true));
secondaryAxisSettingsY.setDescription(preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_DESCRIPTION));
secondaryAxisSettingsY.setDecimalFormat(new DecimalFormat((preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_DECIMAL_FORMAT_PATTERN)), new DecimalFormatSymbols(localeSecondaryYAxis)));
secondaryAxisSettingsY.setColor(colorSecondaryYAxis);
secondaryAxisSettingsY.setPosition(Position.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_POSITION)));
secondaryAxisSettingsY.setVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_VISIBLE));
secondaryAxisSettingsY.setGridLineStyle(LineStyle.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_GRID_LINE_STYLE)));
secondaryAxisSettingsY.setEnableLogScale(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_ENABLE_LOG_SCALE));
secondaryAxisSettingsY.setExtraSpaceTitle(preferenceStore.getInt(BarSeriesPreferenceConstants.P_SECONDARY_Y_AXIS_EXTRA_SPACE_TITLE));
chartSettings.getSecondaryAxisSettingsListY().add(secondaryAxisSettingsY);
//
barChart.applySettings(chartSettings);
}
use of org.eclipse.swtchart.extensions.core.SecondaryAxisSettings in project swtchart by eclipse.
the class LineSeries_2_Part method initialize.
private void initialize() throws Exception {
/*
* Chart Settings
*/
IChartSettings chartSettings = getChartSettings();
chartSettings.setCreateMenu(true);
chartSettings.setOrientation(SWT.HORIZONTAL);
chartSettings.setHorizontalSliderVisible(true);
chartSettings.setVerticalSliderVisible(false);
chartSettings.getRangeRestriction().setZeroX(false);
chartSettings.getRangeRestriction().setZeroY(false);
/*
* Primary X-Axis
*/
IPrimaryAxisSettings primaryAxisSettingsX = chartSettings.getPrimaryAxisSettingsX();
primaryAxisSettingsX.setTitle("scan");
primaryAxisSettingsX.setDecimalFormat(new DecimalFormat(("0.0##"), new DecimalFormatSymbols(Locale.ENGLISH)));
primaryAxisSettingsX.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
primaryAxisSettingsX.setPosition(Position.Primary);
primaryAxisSettingsX.setVisible(false);
/*
* 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));
/*
* Secondary X-Axes
*/
ISecondaryAxisSettings secondaryAxisSettingsX1 = new SecondaryAxisSettings("t1 (sec)", new ScanToSecondsConverter());
secondaryAxisSettingsX1.setPosition(Position.Primary);
secondaryAxisSettingsX1.setDecimalFormat(new DecimalFormat(("0"), new DecimalFormatSymbols(Locale.ENGLISH)));
secondaryAxisSettingsX1.setColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
chartSettings.getSecondaryAxisSettingsListX().add(secondaryAxisSettingsX1);
//
applySettings(chartSettings);
/*
* Create series.
*/
List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
ISeriesData seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_2);
//
ILineSeriesData lineSeriesData = new LineSeriesData(seriesData);
ILineSeriesSettings lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
lineSeriesSettings.setEnableArea(false);
ILineSeriesSettings lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
lineSeriesSettingsHighlight.setLineWidth(2);
lineSeriesDataList.add(lineSeriesData);
/*
* Set series.
*/
addSeriesData(lineSeriesDataList);
}
use of org.eclipse.swtchart.extensions.core.SecondaryAxisSettings 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);
}
Aggregations