use of org.eclipse.swtchart.IAxis in project org.eclipse.linuxtools by eclipse-linuxtools.
the class AbstractChartWithAxisBuilder method applyRangeY.
/**
* Updates the visible range of the chart's y-axis.
* @param min The smallest y-value that should be in range.
* @param max The largest y-value that should be in range.
* @since 3.0
*/
protected void applyRangeY(double min, double max) {
IAxis axis = chart.getAxisSet().getYAxis(0);
double actualRange = max - min;
double scaledRange = actualRange * scaleY;
double marginL = scaledRange > 0 ? scaledRange * getChartMarginYL() : 1;
double marginU = scaledRange > 0 ? scaledRange * getChartMarginYU() : 1;
double lower = (actualRange - scaledRange) * scrollY + min;
axis.setRange(new Range(lower - marginL, lower + scaledRange + marginU));
}
use of org.eclipse.swtchart.IAxis in project org.eclipse.linuxtools by eclipse-linuxtools.
the class AbstractChartWithAxisBuilder method applyRangeX.
/**
* Updates the visible range of the chart's x-axis.
* @param min The smallest x-value that should be in range.
* @param max The largest x-value that should be in range.
*/
private void applyRangeX(double min, double max) {
IAxis axis = chart.getAxisSet().getXAxis(0);
double actualRange = max - min;
double scaledRange = actualRange * scale;
double marginL = scaledRange > 0 ? scaledRange * getChartMarginXL() : 1;
double marginU = scaledRange > 0 ? scaledRange * getChartMarginXU() : 1;
double lower = (actualRange - scaledRange) * scroll + min;
axis.setRange(new Range(lower - marginL, lower + scaledRange + marginU));
}
use of org.eclipse.swtchart.IAxis in project org.eclipse.linuxtools by eclipse-linuxtools.
the class AbstractChartWithAxisBuilder method buildYAxis.
/**
* Builds Y axis.
*/
@Override
protected void buildYAxis() {
IAxis yAxis = this.chart.getAxisSet().getYAxis(0);
// $NON-NLS-1$
yAxis.getTitle().setText("");
if (yLineGrid) {
yAxis.getGrid().setStyle(LineStyle.SOLID);
} else {
yAxis.getGrid().setStyle(LineStyle.NONE);
}
yAxis.getTick().setForeground(BLACK);
yAxis.getTick().setTickMarkStepHint(ySeriesTicks);
}
use of org.eclipse.swtchart.IAxis in project org.eclipse.linuxtools by eclipse-linuxtools.
the class BarChartMouseMoveListener method mouseMove.
@Override
public void mouseMove(MouseEvent e) {
super.mouseMove(e);
ISeries[] allSeries = chart.getSeriesSet().getSeries();
if (allSeries.length == 0) {
return;
}
IAxis xAxis = chart.getAxisSet().getXAxis(0);
String[] categorySeries = ((BarChart) chart).getCategorySeries();
int barIndex = (int) xAxis.getDataCoordinate(e.x);
if (0 <= barIndex && barIndex < categorySeries.length) {
// $NON-NLS-1$
String textTip = "";
for (int i = 0; i < allSeries.length; i++) {
textTip = textTip.concat((i > 0 ? "\n" : "") + // $NON-NLS-1$ //$NON-NLS-2$
MessageFormat.format(// $NON-NLS-1$ //$NON-NLS-2$
Messages.BarChartBuilder_ToolTipCoords, allSeries[i].getId(), ((BarChart) chart).getBarValue(i, barIndex)));
}
setTextTip(textTip);
} else {
tipShell.setVisible(false);
}
chart.redraw();
}
use of org.eclipse.swtchart.IAxis in project tracecompass by tracecompass.
the class TmfXYChartViewer method clearContent.
// ------------------------------------------------------------------------
// Helper Methods
// ------------------------------------------------------------------------
/**
* Clears the view content.
*/
protected void clearContent() {
if (!fSwtChart.isDisposed()) {
ISeriesSet set = fSwtChart.getSeriesSet();
ISeries<?>[] series = set.getSeries();
for (int i = 0; i < series.length; i++) {
set.deleteSeries(series[i].getId());
}
for (IAxis axis : fSwtChart.getAxisSet().getAxes()) {
axis.setRange(new Range(0, 1));
}
fSwtChart.redraw();
}
}
Aggregations