Home
Analytics
Multiple levels of X-Axis to show groups. This example shows two X-Axis (country and its states).
Clement Wong
Ever wanted to have multiple level of groups in the X-Axis? Want to duplicate the behavior in Excel?<br />
<br />
The sample using commercial BIRT (iHub 3.1) shows two x-axis or grouped x-axis labels using HTML5 charts.<br />
<br />
1. Changed the Category X Axis to:
row["COUNTRY"] +":"+ row["STATE"]
<br />
We will later parse out the two levels using JavaScript's split function.<br />
<br />
2. Modified
beforeDrawAxis
event to change height of chart to make room for 2nd x-axis. Parsed out the subgroup (in example it is STATE) and change the labels.<br />
<br />
3. Added a script in the Chart Area > Load event to build out the new parent group for the 2nd x-axis, built out the tick marks to separate the parent group, added the 2nd x-axis and then formated the labels by centering them.
Find more posts tagged with
Comments
There are no comments yet