Search in sources :

Example 31 with IChartSettings

use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.

the class BarSeries_2_2_Part method initialize.

private void initialize() {
    IChartSettings chartSettings = getChartSettings();
    RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
    rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMinX(0.0d);
    rangeRestriction.setExtendMaxX(0.0d);
    rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMaxY(0.1d);
    applySettings(chartSettings);
    // 
    setNumberOfHighestIntensitiesToLabel(5);
    setLabelOption(LabelOption.EXACT);
    setCustomLabels(null);
    /*
		 * Create series.
		 */
    List<IBarSeriesData> barSeriesDataList = new ArrayList<IBarSeriesData>();
    ISeriesData seriesData = SeriesConverter.getSeriesXY(SeriesConverter.BAR_SERIES_2);
    // 
    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) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction)

Example 32 with IChartSettings

use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.

the class BarSeries_3_Part method initialize.

private void initialize() {
    IChartSettings chartSettings = getChartSettings();
    RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
    rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMinY(0.1d);
    applySettings(chartSettings);
    // 
    setNumberOfHighestIntensitiesToLabel(5);
    setLabelOption(LabelOption.NOMIMAL);
    setCustomLabels(null);
    /*
		 * Create series.
		 */
    List<IBarSeriesData> barSeriesDataList = new ArrayList<IBarSeriesData>();
    ISeriesData seriesData;
    IBarSeriesData barSeriesData;
    IBarSeriesSettings barSeriesSettings;
    /*
		 * Positive
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.BAR_SERIES_3_POSITIVE);
    barSeriesData = new BarSeriesData(seriesData);
    barSeriesSettings = barSeriesData.getBarSeriesSettings();
    barSeriesSettings.setBarColor(getDisplay().getSystemColor(SWT.COLOR_RED));
    barSeriesDataList.add(barSeriesData);
    /*
		 * Negative
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.BAR_SERIES_3_NEGATIVE);
    barSeriesData = new BarSeriesData(seriesData);
    barSeriesSettings = barSeriesData.getBarSeriesSettings();
    barSeriesSettings.setBarColor(getDisplay().getSystemColor(SWT.COLOR_BLACK));
    barSeriesDataList.add(barSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(barSeriesDataList);
}
Also used : IBarSeriesSettings(org.eclipse.swtchart.extensions.barcharts.IBarSeriesSettings) 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) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction)

Example 33 with IChartSettings

use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.

the class BarSeries_4_Part method initialize.

private void initialize() {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    applySettings(chartSettings);
    /*
		 * Bar Series [0]
		 */
    indexSeries = 0;
    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);
    /*
		 * Add the label marker.
		 */
    IPlotArea plotArea = (IPlotArea) getBaseChart().getPlotArea();
    LabelMarker labelMarker = new LabelMarker(getBaseChart());
    Map<Integer, String> labels = new HashMap<Integer, String>();
    labels.put(21, "2-Methoxy-4-vinylphenol");
    labels.put(40, "Ethanone, 1-(2-hydroxy-5-methylphenyl)-");
    labels.put(64, "4-Hydroxy-3-methylacetophenone");
    // 
    labelMarker.setLabels(labels, indexSeries, SWT.VERTICAL);
    plotArea.addCustomPaintListener(labelMarker);
}
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) HashMap(java.util.HashMap) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList) IPlotArea(org.eclipse.swtchart.IPlotArea) LabelMarker(org.eclipse.swtchart.extensions.marker.LabelMarker)

Example 34 with IChartSettings

use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.

the class MassSpectrumChart method initialize.

private void initialize() {
    numberOfHighestIntensitiesToLabel = 5;
    barSeriesIonComparator = new BarSeriesIonComparator();
    labelOption = LabelOption.EXACT;
    customLabels = new HashMap<Double, String>();
    // 
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setOrientation(SWT.HORIZONTAL);
    chartSettings.setHorizontalSliderVisible(true);
    chartSettings.setVerticalSliderVisible(true);
    RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
    rangeRestriction.setZeroX(false);
    rangeRestriction.setZeroY(false);
    rangeRestriction.setRestrictZoom(true);
    rangeRestriction.setExtendTypeX(RangeRestriction.ExtendType.ABSOLUTE);
    rangeRestriction.setExtendMinX(2.0d);
    rangeRestriction.setExtendMaxX(2.0d);
    rangeRestriction.setExtendTypeY(RangeRestriction.ExtendType.RELATIVE);
    rangeRestriction.setExtendMaxY(0.1d);
    // 
    setPrimaryAxisSet(chartSettings);
    addSecondaryAxisSet(chartSettings);
    applySettings(chartSettings);
    // 
    addSeriesLabelMarker();
}
Also used : IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) RangeRestriction(org.eclipse.swtchart.extensions.core.RangeRestriction) BarSeriesIonComparator(org.eclipse.swtchart.extensions.internal.support.BarSeriesIonComparator)

Example 35 with IChartSettings

use of org.eclipse.swtchart.extensions.core.IChartSettings in project swtchart by eclipse.

the class PCAChart method setTitles.

public void setTitles(String chartTitle, String xAxisTitle, String yAxisTitle) {
    this.chartTitle = chartTitle;
    this.xAxisTitle = xAxisTitle;
    this.yAxisTitle = yAxisTitle;
    // 
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setTitle(chartTitle);
    chartSettings.getPrimaryAxisSettingsX().setTitle(xAxisTitle);
    chartSettings.getPrimaryAxisSettingsY().setTitle(yAxisTitle);
    applySettings(chartSettings);
}
Also used : IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings)

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