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