Search in sources :

Example 1 with IChartSettings

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);
}
Also used : ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) IBarSeriesData(org.eclipse.swtchart.extensions.barcharts.IBarSeriesData) IBarSeriesData(org.eclipse.swtchart.extensions.barcharts.IBarSeriesData) BarSeriesData(org.eclipse.swtchart.extensions.barcharts.BarSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList)

Example 2 with IChartSettings

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);
}
Also used : IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings)

Example 3 with IChartSettings

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);
}
Also used : ISecondaryAxisSettings(org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings)

Example 4 with IChartSettings

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);
}
Also used : IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction)

Example 5 with IChartSettings

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);
}
Also used : Locale(java.util.Locale) DecimalFormatSymbols(java.text.DecimalFormatSymbols) Color(org.eclipse.swt.graphics.Color) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) DecimalFormat(java.text.DecimalFormat) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IPrimaryAxisSettings(org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)

Aggregations

IChartSettings (org.eclipse.swtchart.extensions.core.IChartSettings)35 ArrayList (java.util.ArrayList)24 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)24 ILineSeriesData (org.eclipse.swtchart.extensions.linecharts.ILineSeriesData)15 ILineSeriesSettings (org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings)15 LineSeriesData (org.eclipse.swtchart.extensions.linecharts.LineSeriesData)15 DecimalFormat (java.text.DecimalFormat)14 DecimalFormatSymbols (java.text.DecimalFormatSymbols)14 IPrimaryAxisSettings (org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)14 RangeRestriction (org.eclipse.swtchart.extensions.core.RangeRestriction)8 Color (org.eclipse.swt.graphics.Color)7 ISecondaryAxisSettings (org.eclipse.swtchart.extensions.core.ISecondaryAxisSettings)7 SecondaryAxisSettings (org.eclipse.swtchart.extensions.core.SecondaryAxisSettings)6 HashMap (java.util.HashMap)5 IPlotArea (org.eclipse.swtchart.IPlotArea)5 RelativeIntensityConverter (org.eclipse.swtchart.extensions.axisconverter.RelativeIntensityConverter)5 BarSeriesData (org.eclipse.swtchart.extensions.barcharts.BarSeriesData)5 IBarSeriesData (org.eclipse.swtchart.extensions.barcharts.IBarSeriesData)5 LabelMarker (org.eclipse.swtchart.extensions.marker.LabelMarker)5 IScatterSeriesData (org.eclipse.swtchart.extensions.scattercharts.IScatterSeriesData)4