Hello,
I am looking for solutions to draw a rather very special form of UML Timing Diagram (couldn't find libraries for drawing UML TIming Diagrams):
The diagram displays timeflow on the X axis (1.....NAT). The Y axis displays intervals (Interval 1/2/3), that occur over the time. Intervals may re-occur (Interval 3).
Solid vertical line denotes occurrence of some event (Event 1/2/3) that typically terminates/initiates the interval.
Dashed vertical line denotes the current time.
Would it be possible to draw something like this with JFreeChart?
Thanks!
Gin
Drawing timing intervals on a time axis
Re: Drawing timing intervals on a time axis
It looks like gant chart. You can use something like
private TaskSeriesCollection dataSeries = new TaskSeriesCollection();
JFreeChart defaultChart = ChartFactory.createGanttChart(
"", // chart title
"", // domain axis label
"", // range axis label
dataSeries, // data
true, // include legend
true, // tooltips
false // urls
);
CategoryPlot plot = chart.getCategoryPlot();
DateAxis axis = (DateAxis) plot.getRangeAxis();
axis.setDateFormatOverride(new SimpleDateFormat("dd.MM.yyyy"));
axis.setUpperMargin(0.0f);
axis.setLowerMargin(0.0f);
GanttRenderer renderer = (GanttRenderer) chart.getCategoryPlot().getRenderer();
renderer.setMaximumBarWidth(0.05f);
CategoryAxis axisCategory = (CategoryAxis) plot.getDomainAxis();
axisCategory.setCategoryMargin(0.0f);
// static column keys
dataSeries.getColumnKeys().add("Event1); and so on
....
private TaskSeriesCollection dataSeries = new TaskSeriesCollection();
JFreeChart defaultChart = ChartFactory.createGanttChart(
"", // chart title
"", // domain axis label
"", // range axis label
dataSeries, // data
true, // include legend
true, // tooltips
false // urls
);
CategoryPlot plot = chart.getCategoryPlot();
DateAxis axis = (DateAxis) plot.getRangeAxis();
axis.setDateFormatOverride(new SimpleDateFormat("dd.MM.yyyy"));
axis.setUpperMargin(0.0f);
axis.setLowerMargin(0.0f);
GanttRenderer renderer = (GanttRenderer) chart.getCategoryPlot().getRenderer();
renderer.setMaximumBarWidth(0.05f);
CategoryAxis axisCategory = (CategoryAxis) plot.getDomainAxis();
axisCategory.setCategoryMargin(0.0f);
// static column keys
dataSeries.getColumnKeys().add("Event1); and so on
....