Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamically Changing the Axis Chart Grouping in a BIRT Report
Davolio
Story problem:<br />
<br />
I'm using BIRT 2.2.1<br />
<br />
<strong class='bbc'>Fluff: </strong><br />
I've seen this question asked several times, but I'm unable to implement any of the solutions correctly. <br />
<br />
What I'm trying to do is I have a chart and it groups my dates to rollup the data for the last 10 days, months, weeks, quarters. <br />
<br />
<br />
This is how i'm doing it.<br />
<br />
I query in my data for 1 value per date sorted ascending. <br />
<br />
I setup a parameter:<br />
<br />
Days<br />
Weeks<br />
Months<br />
Years<br />
<br />
I then assigned each a value: in our business a week is 5 days so I hardcoded days = 10, weeks = 70 etc, because we want the last ten days.<br />
<br />
I then use that value in a filter to get the top n days n = parameter value. <br />
<br />
Now I am able to get the chart to show the last 10 days correctly in a week. Now my issue is this:<br />
<br />
<br />
<strong class='bbc'>real question:</strong><br />
I need to be able to change the grouping so if I set my parameter to weeks, I can assign my Charts x axis grouping to weeks. <br />
<br />
I've read an example that says in Javascript I should be able to create an instance of my chart doing this:<br />
<br />
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.type.impl);<br />
importPackage(Packages.org.eclipse.birt.chart.model.attribute);<br />
<br />
//Chart must be named<br />
cht = reportContext.getDesignHandle().findElement("MyChart");<br />
mychart = cht.getReportItem().getProperty( "chart.instance" );<br />
<br />
but I can't seem to get that to work. My reportContext object doesn't have a getDesignHandle() method. <br />
<br />
Any help would be greatly appreciated.<br />
<br />
Dave
Find more posts tagged with
Comments
Davolio
Maybe I poorly worded my question:
Question:
How can I dynamically change the grouping on the x-axis of my line chart via javascript?
Thanks for any help!
Dave