Search in sources :

Example 26 with ISeries

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

the class TmfXYChartViewer method clearContent.

// ------------------------------------------------------------------------
// Helper Methods
// ------------------------------------------------------------------------
/**
 * Clears the view content.
 */
protected void clearContent() {
    if (!fSwtChart.isDisposed()) {
        ISeriesSet set = fSwtChart.getSeriesSet();
        ISeries<?>[] series = set.getSeries();
        for (int i = 0; i < series.length; i++) {
            set.deleteSeries(series[i].getId());
        }
        for (IAxis axis : fSwtChart.getAxisSet().getAxes()) {
            axis.setRange(new Range(0, 1));
        }
        fSwtChart.redraw();
    }
}
Also used : ISeriesSet(org.eclipse.swtchart.ISeriesSet) Range(org.eclipse.swtchart.Range) ISeries(org.eclipse.swtchart.ISeries) Point(org.eclipse.swt.graphics.Point) IAxis(org.eclipse.swtchart.IAxis)

Example 27 with ISeries

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

the class CallGraphDensityViewTest method getSeries.

private ISeries<Integer> getSeries() {
    AbstractSegmentStoreDensityViewer densityViewer = fDensityViewer;
    assertNotNull(densityViewer);
    ISeries<Integer>[] serieses = densityViewer.getControl().getSeriesSet().getSeries();
    assertNotNull(serieses);
    assertTrue(serieses.length > 0);
    ISeries<Integer> series = serieses[0];
    assertNotNull(series);
    return series;
}
Also used : AbstractSegmentStoreDensityViewer(org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density2.AbstractSegmentStoreDensityViewer) ISeries(org.eclipse.swtchart.ISeries)

Example 28 with ISeries

use of org.eclipse.swtchart.ISeries 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 29 with ISeries

use of org.eclipse.swtchart.ISeries 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 30 with ISeries

use of org.eclipse.swtchart.ISeries 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)

Aggregations

ISeries (org.eclipse.swtchart.ISeries)60 Point (org.eclipse.swt.graphics.Point)21 ISeriesSet (org.eclipse.swtchart.ISeriesSet)11 Chart (org.eclipse.swtchart.Chart)10 IAxis (org.eclipse.swtchart.IAxis)9 Range (org.eclipse.swtchart.Range)9 BaseChart (org.eclipse.swtchart.extensions.core.BaseChart)8 Color (org.eclipse.swt.graphics.Color)5 IBarSeries (org.eclipse.swtchart.IBarSeries)5 ILineSeries (org.eclipse.swtchart.ILineSeries)5 IAxisSettings (org.eclipse.swtchart.extensions.core.IAxisSettings)5 Rectangle (org.eclipse.swt.graphics.Rectangle)4 MouseEvent (org.eclipse.swt.events.MouseEvent)3 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)3 GC (org.eclipse.swt.graphics.GC)3 Test (org.junit.Test)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 PrintWriter (java.io.PrintWriter)2 ArrayList (java.util.ArrayList)2