use of org.eclipse.swtchart.ILineSeries in project swtchart by eclipse.
the class AreaChartExample method createChart.
/**
* create the chart.
*
* @param parent
* The parent composite
* @return The created chart
*/
public static Chart createChart(Composite parent) {
// create a chart
Chart chart = new Chart(parent, SWT.NONE);
// set titles
chart.getTitle().setText("Area Chart");
// create line series
ILineSeries lineSeries1 = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "line series 1");
lineSeries1.setYSeries(ySeries1);
lineSeries1.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
lineSeries1.enableArea(true);
ILineSeries lineSeries2 = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "line series 2");
lineSeries2.setYSeries(ySeries2);
lineSeries2.enableArea(true);
// adjust the axis range
chart.getAxisSet().adjustRange();
return chart;
}
use of org.eclipse.swtchart.ILineSeries in project swtchart by eclipse.
the class LineChartExample method createChart.
/**
* create the chart.
*
* @param parent
* The parent composite
* @return The created chart
*/
public static Chart createChart(Composite parent) {
// create a chart
Chart chart = new Chart(parent, SWT.NONE);
// set titles
chart.getTitle().setText("Line Chart");
chart.getAxisSet().getXAxis(0).getTitle().setText("Data Points");
chart.getAxisSet().getYAxis(0).getTitle().setText("Amplitude");
// create line series
ILineSeries lineSeries = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "line series");
lineSeries.setYSeries(ySeries);
// adjust the axis range
chart.getAxisSet().adjustRange();
return chart;
}
use of org.eclipse.swtchart.ILineSeries in project tracecompass by tracecompass.
the class AbstractSegmentStoreDensityViewer method createAreaSeries.
private ISeries<Integer> createAreaSeries(String name) {
ILineSeries<Integer> series = (ILineSeries<Integer>) fChart.getSeriesSet().createSeries(SeriesType.LINE, name);
series.setVisible(true);
series.enableStep(true);
series.enableArea(true);
series.setSymbolType(PlotSymbolType.NONE);
RGB rgb = getColorForItem(name);
Color color = getColorForRGB(rgb);
series.setLineColor(color);
return series;
}
use of org.eclipse.swtchart.ILineSeries in project tracecompass by tracecompass.
the class SwtScatterChart method setSelection.
@Override
protected void setSelection(@NonNull Set<@NonNull Object> set) {
super.setSelection(set);
/* Set color of selected symbol */
Iterator<Color> colorsIt = Iterators.cycle(COLORS);
Iterator<Color> lightColorsIt = Iterators.cycle(COLORS_LIGHT);
for (ISeries series : getChart().getSeriesSet().getSeries()) {
/* Series color */
Color lightColor = NonNullUtils.checkNotNull(lightColorsIt.next());
Color color = NonNullUtils.checkNotNull(colorsIt.next());
if (set.isEmpty()) {
/* Put all symbols to the normal colors */
((ILineSeries) series).setSymbolColor(color);
} else {
/*
* Fill with light colors to represent the deselected state. The
* paint listener is then responsible for drawing the cross and
* the dark colors for the selection.
*/
((ILineSeries) series).setSymbolColor(lightColor);
}
}
}
Aggregations