Dynamic X-Axis Marker Line for Bar Chart

micajblock
edited February 11, 2022 in Analytics #1
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.<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
In this case I needed it checked, so I had to perform some extra calculations.<br />
<br />
See image below for result<br />
<br />
mblock_devshare_chart.png