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();
}
}
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);
}
}
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);
});
}
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;
}
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);
}
}
}
Aggregations