Dynamic X-Axis Marker Line for Bar Chart

edited November 2013 in DevShare Downloads
I built this example per request from an OS BIRT developer. The required a bar chart where the colors of the bars were based on it's values and there were 2 marker lines based on data.

First I created a table with the values of the two marker lines. In the onCreate even of the report items I set the value to persistent global variables. The visibility of the table was set to false.

I then created the chart. I overrode the onRender event to change the colors of the bars base on the X-Axis values and changed the values of the markers based on the values of the persistent global variables.

The second part was tricky as if 'Is Category Axis' is checked (X-Axis portion of the format chart tab) then the value of the marker is based on the number of bars (1 would be the first tick, 2 the second tick...). If it is unchecked then the marker value would be the value of the X-Axis.

In this case I needed it checked, so I had to perform some extra calculations.

See image below for result

Sign In or Register to comment.