use of org.eclipse.swtchart.IPlotArea in project swtchart by eclipse.
the class MassSpectrumChart method addSeriesLabelMarker.
private void addSeriesLabelMarker() {
/*
* Plot the series name above the entry.
*/
IPlotArea plotArea = (IPlotArea) getBaseChart().getPlotArea();
plotArea.addCustomPaintListener(new ICustomPaintListener() {
@Override
public void paintControl(PaintEvent e) {
List<BarSeriesIon> barSeriesIons = getBarSeriesIonList();
Collections.sort(barSeriesIons, barSeriesIonComparator);
int barSeriesSize = barSeriesIons.size();
int limit;
/*
* Positive
*/
limit = numberOfHighestIntensitiesToLabel;
for (int i = 0; i < limit; i++) {
if (i < barSeriesSize) {
BarSeriesIon barSeriesIon = barSeriesIons.get(i);
printLabel(barSeriesIon, e);
}
}
/*
* Negative
*/
limit = barSeriesIons.size() - numberOfHighestIntensitiesToLabel;
limit = (limit < 0) ? 0 : limit;
for (int i = barSeriesIons.size() - 1; i >= limit; i--) {
BarSeriesIon barSeriesIon = barSeriesIons.get(i);
if (barSeriesIon.getIntensity() < 0) {
printLabel(barSeriesIon, e);
}
}
}
@Override
public boolean drawBehindSeries() {
return false;
}
});
}
use of org.eclipse.swtchart.IPlotArea in project swtchart by eclipse.
the class ScrollableChart method setPlotCenterMarker.
private void setPlotCenterMarker() {
IPlotArea plotArea = (IPlotArea) baseChart.getPlotArea();
IChartSettings chartSettings = baseChart.getChartSettings();
//
if (plotCenterMarker != null) {
plotArea.removeCustomPaintListener(plotCenterMarker);
}
//
plotCenterMarker = new PlotCenterMarker(baseChart);
plotCenterMarker.setForegroundColor(chartSettings.getColorPlotCenterMarker());
plotArea.addCustomPaintListener(plotCenterMarker);
//
if (chartSettings.isShowPlotCenterMarker()) {
plotCenterMarker.setDraw(true);
} else {
plotCenterMarker.setDraw(false);
}
}
use of org.eclipse.swtchart.IPlotArea in project tracecompass by tracecompass.
the class BaseMouseProvider method deregister.
/**
* Method to deregister the provider from chart viewer.
*/
protected void deregister() {
IPlotArea plotArea = getChart().getPlotArea();
if (plotArea == null) {
return;
}
Control control = plotArea.getControl();
if (!control.isDisposed()) {
if (this instanceof MouseListener) {
control.removeMouseListener((MouseListener) this);
}
if (this instanceof MouseMoveListener) {
control.removeMouseMoveListener((MouseMoveListener) this);
}
if (this instanceof MouseWheelListener) {
control.removeMouseWheelListener((MouseWheelListener) this);
}
if (this instanceof MouseTrackListener) {
control.removeMouseTrackListener((MouseTrackListener) this);
}
if (this instanceof ICustomPaintListener) {
plotArea.removeCustomPaintListener((ICustomPaintListener) this);
} else if (this instanceof PaintListener) {
control.removePaintListener((PaintListener) this);
}
TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
if (tooltipHandler != null) {
tooltipHandler.deactivateHoverHelp(control);
}
}
}
use of org.eclipse.swtchart.IPlotArea in project tracecompass by tracecompass.
the class TmfBaseProvider method deregister.
/**
* Method to deregister the provider from chart viewer.
*/
protected void deregister() {
IPlotArea plotArea = getChart().getPlotArea();
if (plotArea == null) {
return;
}
Control control = plotArea.getControl();
if (!control.isDisposed()) {
if (this instanceof MouseListener) {
control.removeMouseListener((MouseListener) this);
}
if (this instanceof MouseMoveListener) {
control.removeMouseMoveListener((MouseMoveListener) this);
}
if (this instanceof MouseWheelListener) {
control.removeMouseWheelListener((MouseWheelListener) this);
}
if (this instanceof MouseTrackListener) {
control.removeMouseTrackListener((MouseTrackListener) this);
}
if (this instanceof ICustomPaintListener) {
plotArea.removeCustomPaintListener((ICustomPaintListener) this);
} else if (this instanceof PaintListener) {
control.removePaintListener((PaintListener) this);
}
TmfAbstractToolTipHandler tooltipHandler = getTooltipHandler();
if (tooltipHandler != null) {
tooltipHandler.deactivateHoverHelp(control);
}
}
}
Aggregations