use of org.swtchart.Range in project tdi-studio-se by Talend.
the class TimelineChart method refreshChartWidget.
/**
* Refreshes the chart widget.
*/
void refreshChartWidget() {
if (isDisposed()) {
return;
}
deleteMonitoredSeries();
for (IMonitoredMXBeanAttribute attribute : attributeGroup.getAttributes()) {
String seriesId = getSeriesId(attribute);
ISeries series = getSeriesSet().getSeries(seriesId);
if (series == null) {
boolean enableArea = true;
series = addMonitoredSeries(attribute, enableArea);
if (series == null) {
return;
}
}
series.setXDateSeries(attribute.getDates().toArray(new Date[0]));
series.setYSeries(getYSeries(attribute));
setColor((ILineSeries) series, attribute.getRGB());
}
AxisUnit axisUnit = attributeGroup.getAxisUnit();
if (axisUnit == AxisUnit.MBytes) {
//$NON-NLS-1$
getAxisSet().getYAxis(0).getTick().setFormat(new DecimalFormat("#####.#M"));
getAxisSet().adjustRange();
} else if (axisUnit == AxisUnit.Percent) {
//$NON-NLS-1$
getAxisSet().getYAxis(0).getTick().setFormat(new DecimalFormat("###%"));
getAxisSet().getXAxis(0).adjustRange();
int y = getSize().y;
if (y > 0) {
getAxisSet().getYAxis(0).setRange(new Range(0, (y + 10) / (double) y));
}
} else if (axisUnit == AxisUnit.Count) {
getAxisSet().getYAxis(0).getTick().setFormat(NumberFormat.getIntegerInstance());
getAxisSet().adjustRange();
} else {
getAxisSet().adjustRange();
}
section.setText(attributeGroup.getName());
section.layout();
marker.redraw();
redraw();
}
Aggregations