Search in sources :

Example 26 with ILineSeries

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;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries) Chart(org.eclipse.swtchart.Chart)

Example 27 with ILineSeries

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;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries) Chart(org.eclipse.swtchart.Chart)

Example 28 with ILineSeries

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;
}
Also used : ILineSeries(org.eclipse.swtchart.ILineSeries) Color(org.eclipse.swt.graphics.Color) RGB(org.eclipse.swt.graphics.RGB)

Example 29 with ILineSeries

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);
        }
    }
}
Also used : Color(org.eclipse.swt.graphics.Color) ILineSeries(org.eclipse.swtchart.ILineSeries) ISeries(org.eclipse.swtchart.ISeries)

Aggregations

ILineSeries (org.eclipse.swtchart.ILineSeries)29 Chart (org.eclipse.swtchart.Chart)13 Color (org.eclipse.swt.graphics.Color)7 Point (org.eclipse.swt.graphics.Point)5 IAxis (org.eclipse.swtchart.IAxis)5 IBarSeries (org.eclipse.swtchart.IBarSeries)5 ISeries (org.eclipse.swtchart.ISeries)5 MouseEvent (org.eclipse.swt.events.MouseEvent)3 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)2 ISeriesSet (org.eclipse.swtchart.ISeriesSet)2 InteractiveChart (org.eclipse.swtchart.extensions.charts.InteractiveChart)2 BaseChart (org.eclipse.swtchart.extensions.core.BaseChart)2 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)2 SeriesException (org.eclipse.swtchart.extensions.exceptions.SeriesException)2 Test (org.junit.Test)2 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)1 IAction (org.eclipse.jface.action.IAction)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1