Search in sources :

Example 1 with IBarSeriesData

use of org.eclipse.swtchart.extensions.barcharts.IBarSeriesData 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 IBarSeriesData

use of org.eclipse.swtchart.extensions.barcharts.IBarSeriesData in project swtchart by eclipse.

the class BarSeries_1_3_Part method initialize.

private void initialize() {
    setNumberOfHighestIntensitiesToLabel(5);
    setLabelOption(LabelOption.CUSTOM);
    setCustomLabels(createCustomLabels());
    /*
		 * 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) ArrayList(java.util.ArrayList)

Example 3 with IBarSeriesData

use of org.eclipse.swtchart.extensions.barcharts.IBarSeriesData in project swtchart by eclipse.

the class ImageFactory_2_UITest method test1.

public void test1() {
    try {
        /*
			 * Create the factory.
			 */
        ImageFactory<MassSpectrumChart> imageFactory = new ImageFactory<MassSpectrumChart>(MassSpectrumChart.class, 800, 600);
        /*
			 * Modify the chart.
			 */
        MassSpectrumChart massSpectrumChart = imageFactory.getChart();
        massSpectrumChart.setBackground(massSpectrumChart.getBaseChart().getDisplay().getSystemColor(SWT.COLOR_WHITE));
        List<IBarSeriesData> barSeriesDataList = new ArrayList<IBarSeriesData>();
        ISeriesData seriesData = SeriesConverter.getSeriesXY(TestPathHelper.getAbsolutePath(TestPathHelper.TESTFILE_BAR_SERIES_1));
        // 
        IBarSeriesData barSeriesData = new BarSeriesData(seriesData);
        IBarSeriesSettings barSeriesSettings = barSeriesData.getBarSeriesSettings();
        barSeriesSettings.setDescription("");
        barSeriesDataList.add(barSeriesData);
        massSpectrumChart.addSeriesData(barSeriesDataList);
        /*
			 * Export the images.
			 */
        String exportFolder = TestPathHelper.getAbsolutePath(TestPathHelper.TESTFOLDER_EXPORT);
        String prefix = "BarSeries1";
        // 
        String png = exportFolder + File.separator + prefix + ".png";
        imageFactory.saveImage(png, SWT.IMAGE_PNG);
        File filePng = new File(png);
        assertTrue(filePng.exists());
        filePng.delete();
        // 
        String jpg = exportFolder + File.separator + prefix + ".jpg";
        imageFactory.saveImage(jpg, SWT.IMAGE_JPEG);
        File fileJpg = new File(jpg);
        assertTrue(fileJpg.exists());
        fileJpg.delete();
        // 
        String bmp = exportFolder + File.separator + prefix + ".bmp";
        imageFactory.saveImage(bmp, SWT.IMAGE_BMP);
        File fileBmp = new File(bmp);
        assertTrue(fileBmp.exists());
        fileBmp.delete();
        // 
        imageFactory.closeShell();
    // 
    } catch (InstantiationException e) {
        System.out.println(e);
    } catch (IllegalAccessException e) {
        System.out.println(e);
    }
}
Also used : ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) ArrayList(java.util.ArrayList) ImageFactory(org.eclipse.swtchart.extensions.images.ImageFactory) IBarSeriesSettings(org.eclipse.swtchart.extensions.barcharts.IBarSeriesSettings) IBarSeriesData(org.eclipse.swtchart.extensions.barcharts.IBarSeriesData) IBarSeriesData(org.eclipse.swtchart.extensions.barcharts.IBarSeriesData) BarSeriesData(org.eclipse.swtchart.extensions.barcharts.BarSeriesData) File(java.io.File) MassSpectrumChart(org.eclipse.swtchart.extensions.customcharts.MassSpectrumChart)

Example 4 with IBarSeriesData

use of org.eclipse.swtchart.extensions.barcharts.IBarSeriesData in project swtchart by eclipse.

the class BarSeries_Preferences_Part method applySeriesSettings.

private void applySeriesSettings() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    Color barColorSeries1 = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_BAR_COLOR_SERIES_1));
    Color barColorSeries1Highlight = getColor(PreferenceConverter.getColor(preferenceStore, BarSeriesPreferenceConstants.P_BAR_COLOR_SERIES_1_HIGHLIGHT));
    // 
    barChart.deleteSeries();
    List<IBarSeriesData> barSeriesDataList = new ArrayList<IBarSeriesData>();
    ISeriesData seriesData;
    IBarSeriesData barSeriesData;
    IBarSeriesSettings barSeriesSettings;
    /*
		 * Series 1
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.BAR_SERIES_1);
    barSeriesData = new BarSeriesData(seriesData);
    barSeriesSettings = barSeriesData.getBarSeriesSettings();
    barSeriesSettings.setDescription(preferenceStore.getString(BarSeriesPreferenceConstants.P_DESCRIPTION_SERIES_1));
    // 
    barSeriesSettings.setVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_VISIBLE_SERIES_1));
    barSeriesSettings.setVisibleInLegend(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_1));
    barSeriesSettings.setBarColor(barColorSeries1);
    barSeriesSettings.setBarPadding(preferenceStore.getInt(BarSeriesPreferenceConstants.P_BAR_PADDING_SERIES_1));
    barSeriesSettings.setBarWidth(preferenceStore.getInt(BarSeriesPreferenceConstants.P_BAR_WIDTH_SERIES_1));
    barSeriesSettings.setBarWidthStyle(BarWidthStyle.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_BAR_WIDTH_STYLE_SERIES_1)));
    // 
    IBarSeriesSettings barSeriesSettingsHighlight = (IBarSeriesSettings) barSeriesSettings.getSeriesSettingsHighlight();
    barSeriesSettingsHighlight.setVisible(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_VISIBLE_SERIES_1_HIGHLIGHT));
    barSeriesSettingsHighlight.setVisibleInLegend(preferenceStore.getBoolean(BarSeriesPreferenceConstants.P_VISIBLE_IN_LEGEND_SERIES_1_HIGHLIGHT));
    barSeriesSettingsHighlight.setBarColor(barColorSeries1Highlight);
    barSeriesSettingsHighlight.setBarPadding(preferenceStore.getInt(BarSeriesPreferenceConstants.P_BAR_PADDING_SERIES_1_HIGHLIGHT));
    barSeriesSettingsHighlight.setBarWidth(preferenceStore.getInt(BarSeriesPreferenceConstants.P_BAR_WIDTH_SERIES_1_HIGHLIGHT));
    barSeriesSettingsHighlight.setBarWidthStyle(BarWidthStyle.valueOf(preferenceStore.getString(BarSeriesPreferenceConstants.P_BAR_WIDTH_STYLE_SERIES_1_HIGHLIGHT)));
    // 
    barSeriesDataList.add(barSeriesData);
    // 
    barChart.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) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 5 with IBarSeriesData

use of org.eclipse.swtchart.extensions.barcharts.IBarSeriesData in project swtchart by eclipse.

the class BarSeries_1_2_Part method initialize.

private void initialize() {
    setNumberOfHighestIntensitiesToLabel(5);
    setLabelOption(LabelOption.EXACT);
    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) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)9 BarSeriesData (org.eclipse.swtchart.extensions.barcharts.BarSeriesData)9 IBarSeriesData (org.eclipse.swtchart.extensions.barcharts.IBarSeriesData)9 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)9 IChartSettings (org.eclipse.swtchart.extensions.core.IChartSettings)5 IBarSeriesSettings (org.eclipse.swtchart.extensions.barcharts.IBarSeriesSettings)3 RangeRestriction (org.eclipse.swtchart.extensions.core.RangeRestriction)2 File (java.io.File)1 DecimalFormat (java.text.DecimalFormat)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 HashMap (java.util.HashMap)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 Color (org.eclipse.swt.graphics.Color)1 IPlotArea (org.eclipse.swtchart.IPlotArea)1 IPrimaryAxisSettings (org.eclipse.swtchart.extensions.core.IPrimaryAxisSettings)1 MassSpectrumChart (org.eclipse.swtchart.extensions.customcharts.MassSpectrumChart)1 ImageFactory (org.eclipse.swtchart.extensions.images.ImageFactory)1 LabelMarker (org.eclipse.swtchart.extensions.marker.LabelMarker)1