use of org.swtchart.IAxisTick in project netxms by netxms.
the class LineChart method setTimeRange.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.charts.api.HistoricalDataChart#setTimeRange(java.util.Date, java.util.Date)
*/
@Override
public void setTimeRange(final Date from, final Date to) {
timeFrom = from.getTime();
timeTo = to.getTime();
getAxisSet().getXAxis(0).setRange(new Range(timeFrom, timeTo));
int seconds = (int) ((timeTo - timeFrom) / 1000);
String formatString;
int angle;
if (seconds <= 600) {
formatString = Messages.get().LineChart_MediumTimeFormat;
angle = 0;
} else if (seconds <= 86400) {
formatString = Messages.get().LineChart_ShortTimeFormat;
angle = 0;
} else if (seconds <= 86400 * 7) {
formatString = Messages.get().LineChart_Medium2TimeFormat;
angle = 0;
} else {
formatString = Messages.get().LineChart_LongTimeFormat;
angle = 45;
}
IAxisTick xTick = getAxisSet().getXAxis(0).getTick();
DateFormat format = new SimpleDateFormat(formatString);
xTick.setFormat(format);
xTick.setTickLabelAngle(angle);
}
use of org.swtchart.IAxisTick in project ACS by ACS-Community.
the class AlarmsPerTenMinutesPart method createPartControl.
public void createPartControl(Composite parent) {
chart = new Chart(parent, SWT.NONE);
ITitle chartTitle = chart.getTitle();
chartTitle.setText("Alarms per 10 minutes");
IAxisSet axisSet = chart.getAxisSet();
IAxis[] xAxis = axisSet.getXAxes();
ITitle xTitle = xAxis[0].getTitle();
xTitle.setText("Time");
IAxis[] yAxis = axisSet.getYAxes();
ITitle yTitle = yAxis[0].getTitle();
yTitle.setText("# alarms");
ISeriesSet seriesSet = chart.getSeriesSet();
nAlarmsSerie = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, "nAlarms");
nAlarmsSerie.enableStep(true);
nAlarmsSerie.setSymbolType(PlotSymbolType.NONE);
IAxisTick xTick = axisSet.getXAxis(0).getTick();
DateFormat format = new SimpleDateFormat("HH:mm");
xTick.setFormat(format);
errorSerie = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, "Threshold");
errorSerie.setSymbolType(PlotSymbolType.NONE);
errorColor = new Color(Display.getDefault(), 255, 0, 0);
errorSerie.setLineColor(errorColor);
TenMinutesContainer.getInstance().setChartViewer(this);
}
Aggregations