Search in sources :

Example 1 with IPlotArea

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

the class CustomPaintListenerExample 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);
    chart.getTitle().setText("Custom Paint Listener");
    ISeries lineSeries = chart.getSeriesSet().createSeries(SeriesType.LINE, "line series");
    lineSeries.setYSeries(ySeries);
    // add paint listeners
    IPlotArea plotArea = (IPlotArea) chart.getPlotArea();
    plotArea.addCustomPaintListener(new FrontPaintListener());
    plotArea.addCustomPaintListener(new BehindPaintListener());
    // adjust the axis range
    chart.getAxisSet().adjustRange();
    return chart;
}
Also used : IPlotArea(org.eclipse.swtchart.IPlotArea) ISeries(org.eclipse.swtchart.ISeries) Chart(org.eclipse.swtchart.Chart)

Example 2 with IPlotArea

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

the class ScrollableChart method setPositionMarker.

private void setPositionMarker() {
    IPlotArea plotArea = (IPlotArea) baseChart.getPlotArea();
    IChartSettings chartSettings = baseChart.getChartSettings();
    // 
    if (positionMarker != null) {
        plotArea.removeCustomPaintListener(positionMarker);
    }
    // 
    positionMarker = new PositionMarker(baseChart);
    positionMarker.setForegroundColor(chartSettings.getColorPositionMarker());
    plotArea.addCustomPaintListener(positionMarker);
    // 
    if (chartSettings.isShowPositionMarker()) {
        positionMarker.setDraw(true);
    } else {
        positionMarker.setDraw(false);
    }
}
Also used : PositionMarker(org.eclipse.swtchart.extensions.internal.marker.PositionMarker) IPlotArea(org.eclipse.swtchart.IPlotArea)

Example 3 with IPlotArea

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

the class ScrollableChart method setAxisZeroMarker.

private void setAxisZeroMarker() {
    IPlotArea plotArea = (IPlotArea) baseChart.getPlotArea();
    IChartSettings chartSettings = baseChart.getChartSettings();
    // 
    if (axisZeroMarker != null) {
        plotArea.removeCustomPaintListener(axisZeroMarker);
    }
    // 
    axisZeroMarker = new AxisZeroMarker(baseChart);
    axisZeroMarker.setForegroundColor(chartSettings.getColorAxisZeroMarker());
    plotArea.addCustomPaintListener(axisZeroMarker);
    // 
    if (chartSettings.isShowAxisZeroMarker()) {
        axisZeroMarker.setDraw(true);
    } else {
        axisZeroMarker.setDraw(false);
    }
}
Also used : AxisZeroMarker(org.eclipse.swtchart.extensions.internal.marker.AxisZeroMarker) IPlotArea(org.eclipse.swtchart.IPlotArea)

Example 4 with IPlotArea

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

the class ScrollableChart method setLegendMarker.

private void setLegendMarker() {
    IPlotArea plotArea = (IPlotArea) baseChart.getPlotArea();
    IChartSettings chartSettings = baseChart.getChartSettings();
    // 
    if (legendMarker != null) {
        plotArea.removeCustomPaintListener(legendMarker);
    }
    // 
    legendMarker = new LegendMarker(baseChart);
    legendMarker.setForegroundColor(chartSettings.getColorLegendMarker());
    plotArea.addCustomPaintListener(legendMarker);
    // 
    if (chartSettings.isShowLegendMarker()) {
        legendMarker.setDraw(true);
    } else {
        legendMarker.setDraw(false);
    }
}
Also used : LegendMarker(org.eclipse.swtchart.extensions.internal.marker.LegendMarker) IPlotArea(org.eclipse.swtchart.IPlotArea)

Example 5 with IPlotArea

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

the class ScrollableChart method setSeriesLabelMarker.

private void setSeriesLabelMarker() {
    IPlotArea plotArea = (IPlotArea) baseChart.getPlotArea();
    IChartSettings chartSettings = baseChart.getChartSettings();
    // 
    if (seriesLabelMarker != null) {
        plotArea.removeCustomPaintListener(seriesLabelMarker);
    }
    // 
    seriesLabelMarker = new SeriesLabelMarker(baseChart);
    seriesLabelMarker.setForegroundColor(chartSettings.getColorSeriesLabelMarker());
    plotArea.addCustomPaintListener(seriesLabelMarker);
    // 
    if (chartSettings.isShowSeriesLabelMarker()) {
        seriesLabelMarker.setDraw(true);
    } else {
        seriesLabelMarker.setDraw(false);
    }
}
Also used : SeriesLabelMarker(org.eclipse.swtchart.extensions.internal.marker.SeriesLabelMarker) IPlotArea(org.eclipse.swtchart.IPlotArea)

Aggregations

IPlotArea (org.eclipse.swtchart.IPlotArea)19 ArrayList (java.util.ArrayList)6 MouseMoveListener (org.eclipse.swt.events.MouseMoveListener)5 ICustomPaintListener (org.eclipse.swtchart.ICustomPaintListener)5 IChartSettings (org.eclipse.swtchart.extensions.core.IChartSettings)5 ISeriesData (org.eclipse.swtchart.extensions.core.ISeriesData)5 LabelMarker (org.eclipse.swtchart.extensions.marker.LabelMarker)5 MouseListener (org.eclipse.swt.events.MouseListener)4 MouseTrackListener (org.eclipse.swt.events.MouseTrackListener)4 MouseWheelListener (org.eclipse.swt.events.MouseWheelListener)4 PaintListener (org.eclipse.swt.events.PaintListener)4 Control (org.eclipse.swt.widgets.Control)4 ILineSeriesData (org.eclipse.swtchart.extensions.linecharts.ILineSeriesData)4 ILineSeriesSettings (org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings)4 LineSeriesData (org.eclipse.swtchart.extensions.linecharts.LineSeriesData)4 TmfAbstractToolTipHandler (org.eclipse.tracecompass.tmf.ui.viewers.TmfAbstractToolTipHandler)4 HashMap (java.util.HashMap)1 List (java.util.List)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 PaintEvent (org.eclipse.swt.events.PaintEvent)1