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