I would like to have a line chart with an overview of time periods grouped by months. I have a dataset with columns (startdate(DATETIME), enddate(DATETIME), time period desc(DATETIME), value(FLOAT), indx name (string)).
Taking the time period desc in x-axis (as month data) and the value in y-axis and optional grouping as indx name. The x-axis should get grouped in order to display all the data points between each Time period.
- for example,
If the user selects a 05/31/16 startdate and to plot 5 Years TP, the axis should like (please check the attachment plot1)
the x-axis label would be,
05/16 05/15 05/14 05/13 05/12 05/11
In-between 05/16 to 05/15 we have 12 data points..so we need to show the 12 data points without x-axis TP (04/16, 03/16,02/16,01/16,12/15,11/15,10/15,09/15,08/15,07/15,06/15).
Based on your Question, I assume you’re doing this with Open Source BIRT. If so, there are two ways you can do this:
1. without scripting:
In Select Data, click on Edit Group and Sorting and select Months as the Grouping Unit;
Then, go to Format Chart –> X-Axis –> Label and set the Interval to 12.
2. with scripting:
If for some reasons you need more flexibility, you can also use the following script as an example:
eepLabel = “”;
function beforeDrawAxisLabel( axis, label, icsc )
{
if (axis.isCategoryAxis() == true) {
if (label.getCaption().getValue().substr(3,2) == keepLabel) {
label.getCaption().setValue(“”);
}
else {
keepLabel = label.getCaption().getValue().substr(3,2);
}
}
}