xAxis.setFont(plot.getTimeAxisFont());
yAxis.setFont(plot.getTimeAxisFont());
// Setup the gridlines
XYGrid grid = new XYGrid(xAxis, yAxis);
grid.setForeground(plot.getGridLineColor());
plot.getPlotView().getContents().add(grid);
xAxis.setMinorTickLength(PlotConstants.MINOR_TICK_MARK_LENGTH);
xAxis.setMajorTickLength(PlotConstants.MAJOR_TICK_MARK_LENGTH);
xAxis.setTextMargin(PlotConstants.MAJOR_TICK_MARK_LENGTH + 2);
yAxis.setMinorTickLength(PlotConstants.MINOR_TICK_MARK_LENGTH);
yAxis.setMajorTickLength(PlotConstants.MAJOR_TICK_MARK_LENGTH);
yAxis.setTextMargin(PlotConstants.MAJOR_TICK_MARK_LENGTH + 5);
} else {
assert (plot.getAxisOrientationSetting() == AxisOrientationSetting.Y_AXIS_AS_TIME);
// Setup the axis.
TimeXYAxis yAxis = new TimeXYAxis(XYDimension.Y);
if(plot.getYAxisMaximumLocation() == YAxisMaximumLocationSetting.MAXIMUM_AT_TOP) {
yAxis.setStart(plot.getStartTime().getTimeInMillis());
yAxis.setEnd(plot.getEndTime().getTimeInMillis());
} else {
yAxis.setStart(plot.getEndTime().getTimeInMillis());
yAxis.setEnd(plot.getStartTime().getTimeInMillis());
}
plot.setTimeAxis(yAxis);
LinearXYAxis xAxis = new LinearXYAxis(XYDimension.X);
if(plot.getXAxisMaximumLocation() == XAxisMaximumLocationSetting.MAXIMUM_AT_RIGHT) {
xAxis.setStart(plot.getPlotAbstraction().getMinNonTime());
xAxis.setEnd(plot.getPlotAbstraction().getMaxNonTime());
} else {
xAxis.setStart(plot.getPlotAbstraction().getMaxNonTime());
xAxis.setEnd(plot.getPlotAbstraction().getMinNonTime());
}
plot.theNonTimeAxis = xAxis;
xAxis.setForeground(plot.getNonTimeAxisColor());
yAxis.setForeground(plot.getTimeAxisColor());
xAxis.setFormat(getNumberFormatter());
xAxis.setPreferredSize(new Dimension(1, 20));
yAxis.setPreferredSize(new Dimension(60, 1));
plot.getPlotView().setXAxis(xAxis);
plot.getPlotView().setYAxis(yAxis);
plot.getPlotView().add(xAxis);
plot.getPlotView().add(yAxis);
// Setup the axis labels.
if (plot.isTimeLabelEnabled) {
SimpleDateFormat format = TimeFormatUtils.makeDataFormat(plot.getTimeFormatSetting());
yAxis.setFormat(new DateNumberFormat(format));
yAxis.setTimeSystemAxisLabelName(timeSystemId);
} else {
yAxis.setShowLabels(false);
}
xAxis.setFont(plot.getTimeAxisFont());
yAxis.setFont(plot.getTimeAxisFont());
// Setup the gridlines
XYGrid grid = new XYGrid(xAxis, yAxis);
grid.setForeground(plot.getGridLineColor());
plot.getPlotView().getContents().add(grid);
xAxis.setMajorTickLength(PlotConstants.MAJOR_TICK_MARK_LENGTH);
xAxis.setMinorTickLength(PlotConstants.MINOR_TICK_MARK_LENGTH);