Drawing timing intervals on a time axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
gingaz
Posts: 1
Joined: Thu Oct 30, 2014 9:17 am
antibot: No, of course not.

Drawing timing intervals on a time axis

Post by gingaz » Thu Oct 30, 2014 9:48 am

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):
Image

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

skyhook
Posts: 8
Joined: Tue Mar 03, 2015 2:34 pm
antibot: No, of course not.

Re: Drawing timing intervals on a time axis

Post by skyhook » Wed Mar 04, 2015 12:54 pm

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

....

Locked