Search in sources :

Example 6 with ISeriesSet

use of org.eclipse.swtchart.ISeriesSet in project tracecompass by tracecompass.

the class AbstractSegmentStoreDensityViewer method clearContent.

/**
 * Clears the view content.
 */
private void clearContent() {
    final Chart chart = fChart;
    if (!chart.isDisposed()) {
        ISeriesSet set = chart.getSeriesSet();
        ISeries<?>[] series = set.getSeries();
        for (int i = 0; i < series.length; i++) {
            set.deleteSeries(series[i].getId());
        }
        for (IAxis axis : chart.getAxisSet().getAxes()) {
            axis.setRange(new Range(0, 1));
        }
        chart.redraw();
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) Range(org.eclipse.swtchart.Range) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SegmentStoreWithRange(org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.table.SegmentStoreContentProvider.SegmentStoreWithRange) AxisRange(org.eclipse.tracecompass.tmf.ui.viewers.xychart.AxisRange) ISeries(org.eclipse.swtchart.ISeries) Chart(org.eclipse.swtchart.Chart) IAxis(org.eclipse.swtchart.IAxis)

Example 7 with ISeriesSet

use of org.eclipse.swtchart.ISeriesSet in project tracecompass by tracecompass.

the class MemoryUsageViewTest method testOpenMemoryUsage.

/**
 * Test if Memory Usage is populated
 */
@Test
public void testOpenMemoryUsage() {
    SWTBotView viewBot = fBot.viewById(UstMemoryUsageView.ID);
    viewBot.setFocus();
    // Do some basic validation
    Matcher<Chart> matcher = WidgetOfType.widgetOfType(Chart.class);
    Chart chart = viewBot.bot().widget(matcher);
    checkAllEntries();
    // Verify that the chart has 4 series
    fBot.waitUntil(ConditionHelpers.numberOfSeries(chart, EXPECTED_NUM_SERIES));
    ISeriesSet seriesSet = chart.getSeriesSet();
    ISeries<?>[] series = seriesSet.getSeries();
    // Verify that each series is a ILineSeries
    for (ISeries<?> serie : series) {
        assertTrue(serie instanceof ILineSeries);
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) ILineSeries(org.eclipse.swtchart.ILineSeries) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) ISeries(org.eclipse.swtchart.ISeries) Chart(org.eclipse.swtchart.Chart) Test(org.junit.Test) XYDataProviderBaseTest(org.eclipse.tracecompass.tmf.ui.swtbot.tests.views.xychart.XYDataProviderBaseTest)

Example 8 with ISeriesSet

use of org.eclipse.swtchart.ISeriesSet in project tracecompass by tracecompass.

the class SwtXYChartViewer method createChartSeries.

/**
 * For each series defined for the chart, create the corresponding SWT
 * series and add it to the series map
 */
private final void createChartSeries() {
    ISeriesSet set = NonNullUtils.checkNotNull(getChart().getSeriesSet());
    Iterator<Color> colors = Iterators.cycle(COLORS);
    getData().getChartSeries().forEach(series -> {
        ISeries swtSeries = createSwtSeries(series, set, colors.next());
        fSeriesMap.put(series, swtSeries);
    });
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) Color(org.eclipse.swt.graphics.Color) ISeries(org.eclipse.swtchart.ISeries)

Example 9 with ISeriesSet

use of org.eclipse.swtchart.ISeriesSet in project netxms by netxms.

the class LineChart method addLineSeries.

/**
 * Add line series to chart
 *
 * @param description Description
 * @param xSeries X axis data
 * @param ySeries Y axis data
 */
@SuppressWarnings("deprecation")
private ILineSeries<?> addLineSeries(int index, String description, Date[] xSeries, double[] ySeries) {
    ISeriesSet seriesSet = getSeriesSet();
    ILineSeries<?> series = (ILineSeries<?>) seriesSet.createSeries(SeriesType.LINE, Integer.toString(index));
    series.setDescription(description);
    series.setSymbolType(PlotSymbolType.NONE);
    series.setLineWidth(configuration.getLineWidth());
    series.setLineColor(getColorFromPreferences("Chart.Colors.Data." + index));
    series.setXDateSeries(xSeries);
    series.setYSeries(ySeries);
    try {
        series.enableStack(configuration.isStacked());
    } catch (IllegalStateException e) {
        logger.error("Exception while adding chart series", e);
    }
    return series;
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) ILineSeries(org.eclipse.swtchart.ILineSeries)

Example 10 with ISeriesSet

use of org.eclipse.swtchart.ISeriesSet in project swtchart by eclipse.

the class AbstractExtendedChart method deleteSeries.

@Override
public void deleteSeries(String id) {
    ISeriesSet seriesSet = getSeriesSet();
    if (seriesSet.getSeries(id) != null) {
        resetCoordinates();
        seriesSet.deleteSeries(id);
        seriesSettingsMap.remove(id);
        for (ISeries series : seriesSet.getSeries()) {
            calculateCoordinates(series);
        }
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) ISeries(org.eclipse.swtchart.ISeries)

Aggregations

ISeriesSet (org.eclipse.swtchart.ISeriesSet)12 ISeries (org.eclipse.swtchart.ISeries)11 Chart (org.eclipse.swtchart.Chart)4 Range (org.eclipse.swtchart.Range)3 Test (org.junit.Test)3 Point (org.eclipse.swt.graphics.Point)2 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 IAxis (org.eclipse.swtchart.IAxis)2 ILineSeries (org.eclipse.swtchart.ILineSeries)2 IndexedSeriesModel (org.eclipse.swtchart.model.IndexedSeriesModel)2 Color (org.eclipse.swt.graphics.Color)1 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 SeriesType (org.eclipse.swtchart.ISeries.SeriesType)1 BaseChart (org.eclipse.swtchart.extensions.core.BaseChart)1 IPointSeriesSettings (org.eclipse.swtchart.extensions.core.IPointSeriesSettings)1 ISeriesSettings (org.eclipse.swtchart.extensions.core.ISeriesSettings)1 SeriesException (org.eclipse.swtchart.extensions.exceptions.SeriesException)1 SegmentStoreWithRange (org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.table.SegmentStoreContentProvider.SegmentStoreWithRange)1 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)1