Search in sources :

Example 6 with IPlotArea

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

the class LineSeries_9_Part method initialize.

private void initialize() throws Exception {
    /*
		 * Chart Settings
		 */
    IChartSettings chartSettings = getChartSettings();
    chartSettings.setCreateMenu(true);
    applySettings(chartSettings);
    /*
		 * Create series.
		 */
    List<ILineSeriesData> lineSeriesDataList = new ArrayList<ILineSeriesData>();
    // 
    ISeriesData seriesData;
    ILineSeriesData lineSeriesData;
    ILineSeriesSettings lineSeriesSettings;
    /*
		 * Chromatogram [0]
		 */
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(true);
    ILineSeriesSettings lineSeriesSettingsHighlight = (ILineSeriesSettings) lineSeriesSettings.getSeriesSettingsHighlight();
    lineSeriesSettingsHighlight.setLineWidth(2);
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Active Peaks [1]
		 */
    indexSeries = 1;
    seriesData = SeriesConverter.getSeriesXY(SeriesConverter.LINE_SERIES_1_ACTIVE_PEAKS);
    lineSeriesData = new LineSeriesData(seriesData);
    lineSeriesSettings = lineSeriesData.getLineSeriesSettings();
    lineSeriesSettings.setEnableArea(false);
    lineSeriesSettings.setLineStyle(LineStyle.NONE);
    lineSeriesSettings.setSymbolType(PlotSymbolType.INVERTED_TRIANGLE);
    lineSeriesSettings.setSymbolSize(5);
    lineSeriesSettings.setLineColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesSettings.setSymbolColor(getDisplay().getSystemColor(SWT.COLOR_GRAY));
    lineSeriesDataList.add(lineSeriesData);
    /*
		 * Set series.
		 */
    addSeriesData(lineSeriesDataList);
    /*
		 * Add the label marker.
		 */
    IPlotArea plotArea = (IPlotArea) getBaseChart().getPlotArea();
    LabelMarker labelMarker = new LabelMarker(getBaseChart());
    List<String> labels = new ArrayList<String>();
    labels.add("2-Methoxy-4-vinylphenol");
    labels.add("Ethanone, 1-(2-hydroxy-5-methylphenyl)-");
    labels.add("4-Hydroxy-2-methylacetophenone");
    labels.add("Ethanone, 1-(2-hydroxy-5-methylphenyl)-");
    labels.add("4-Hydroxy-3-methylacetophenone");
    labels.add("3-Methoxyacetophenone");
    labels.add("3-Methyl-4-isopropylphenol");
    labels.add("Phenol, 3,4-dimethoxy-");
    labels.add("2,4-Dimethoxyphenol");
    labels.add("3-Amino-2,6-dimethoxypyridine");
    labelMarker.setLabels(labels, indexSeries, SWT.HORIZONTAL);
    plotArea.addCustomPaintListener(labelMarker);
}
Also used : ILineSeriesSettings(org.eclipse.swtchart.extensions.linecharts.ILineSeriesSettings) LineSeriesData(org.eclipse.swtchart.extensions.linecharts.LineSeriesData) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) ISeriesData(org.eclipse.swtchart.extensions.core.ISeriesData) ILineSeriesData(org.eclipse.swtchart.extensions.linecharts.ILineSeriesData) IChartSettings(org.eclipse.swtchart.extensions.core.IChartSettings) ArrayList(java.util.ArrayList) IPlotArea(org.eclipse.swtchart.IPlotArea) LabelMarker(org.eclipse.swtchart.extensions.marker.LabelMarker)

Example 7 with IPlotArea

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

the class LineChart method startSelection.

/**
 * Selection start handler
 * @param e
 */
private void startSelection(MouseEvent e) {
    if (zoomLevel >= MAX_ZOOM_LEVEL)
        return;
    selectionActive = true;
    selection.setStartPoint(e.x, e.y);
    selection.setEndPoint(e.x, e.y);
    final IPlotArea plotArea = getPlotArea();
    moveListener = new MouseMoveListener() {

        @Override
        public void mouseMove(MouseEvent e) {
            selection.setEndPoint(e.x, e.y);
            plotArea.getControl().redraw();
        }
    };
    plotArea.addMouseMoveListener(moveListener);
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) MouseEvent(org.eclipse.swt.events.MouseEvent) IPlotArea(org.eclipse.swtchart.IPlotArea)

Example 8 with IPlotArea

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

the class LineChart method endSelection.

/**
 * Selection end handler
 */
private void endSelection() {
    if (!selectionActive)
        return;
    selectionActive = false;
    final IPlotArea plotArea = getPlotArea();
    plotArea.removeMouseMoveListener(moveListener);
    if (selection.isUsableSize()) {
        for (IAxis axis : getAxisSet().getAxes()) {
            Point range = null;
            if ((getOrientation() == SWT.HORIZONTAL && axis.getDirection() == Direction.X) || (getOrientation() == SWT.VERTICAL && axis.getDirection() == Direction.Y)) {
                range = selection.getHorizontalRange();
            } else {
                range = selection.getVerticalRange();
            }
            if (range != null && range.x != range.y) {
                setRange(range, axis);
            }
        }
        zoomedToSelectionX = true;
        zoomedToSelectionY = true;
    }
    selection.dispose();
    redraw();
}
Also used : IPlotArea(org.eclipse.swtchart.IPlotArea) DataPoint(org.netxms.nxmc.modules.charts.api.DataPoint) Point(org.eclipse.swt.graphics.Point) IAxis(org.eclipse.swtchart.IAxis)

Example 9 with IPlotArea

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

the class TmfBaseProvider method register.

/**
 * Method to register the provider to chart viewer.
 */
protected void register() {
    IPlotArea plotArea = getChart().getPlotArea();
    Control control = plotArea.getControl();
    if (this instanceof MouseListener) {
        control.addMouseListener((MouseListener) this);
    }
    if (this instanceof MouseMoveListener) {
        control.addMouseMoveListener((MouseMoveListener) this);
    }
    if (this instanceof MouseWheelListener) {
        control.addMouseWheelListener((MouseWheelListener) this);
    }
    if (this instanceof MouseTrackListener) {
        control.addMouseTrackListener((MouseTrackListener) this);
    }
    if (this instanceof ICustomPaintListener) {
        plotArea.addCustomPaintListener((ICustomPaintListener) this);
    } else if (this instanceof PaintListener) {
        control.addPaintListener((PaintListener) this);
    }
    TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
    if (tooltipHandler != null) {
        tooltipHandler.activateHoverHelp(control);
    }
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) Control(org.eclipse.swt.widgets.Control) ICustomPaintListener(org.eclipse.swtchart.ICustomPaintListener) MouseListener(org.eclipse.swt.events.MouseListener) PaintListener(org.eclipse.swt.events.PaintListener) ICustomPaintListener(org.eclipse.swtchart.ICustomPaintListener) TmfAbstractToolTipHandler(org.eclipse.tracecompass.tmf.ui.viewers.TmfAbstractToolTipHandler) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) IPlotArea(org.eclipse.swtchart.IPlotArea) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener)

Example 10 with IPlotArea

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

the class BaseMouseProvider method register.

/**
 * Method to register the provider to chart viewer.
 */
protected void register() {
    IPlotArea plotArea = getChart().getPlotArea();
    Control control = plotArea.getControl();
    if (this instanceof MouseListener) {
        control.addMouseListener((MouseListener) this);
    }
    if (this instanceof MouseMoveListener) {
        control.addMouseMoveListener((MouseMoveListener) this);
    }
    if (this instanceof MouseWheelListener) {
        control.addMouseWheelListener((MouseWheelListener) this);
    }
    if (this instanceof MouseTrackListener) {
        control.addMouseTrackListener((MouseTrackListener) this);
    }
    if (this instanceof ICustomPaintListener) {
        plotArea.addCustomPaintListener((ICustomPaintListener) this);
    } else if (this instanceof PaintListener) {
        control.addPaintListener((PaintListener) this);
    }
    TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
    if (tooltipHandler != null) {
        tooltipHandler.activateHoverHelp(control);
    }
}
Also used : MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) Control(org.eclipse.swt.widgets.Control) ICustomPaintListener(org.eclipse.swtchart.ICustomPaintListener) MouseListener(org.eclipse.swt.events.MouseListener) PaintListener(org.eclipse.swt.events.PaintListener) ICustomPaintListener(org.eclipse.swtchart.ICustomPaintListener) TmfAbstractToolTipHandler(org.eclipse.tracecompass.tmf.ui.viewers.TmfAbstractToolTipHandler) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) IPlotArea(org.eclipse.swtchart.IPlotArea) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener)

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