Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Creating chart on fly
Vineet Joshi
Hi All,
Can we create chart through some code(in oncreate or anywhere else) in the in the .rptdesign file .
I don't want any physical presence of chart on the design ie i want it created on the fly through code when i run the .rpt file
Regards
Find more posts tagged with
Comments
mwilliams
I believe this post in the devShare has an example on how to create a chart using the API.
http://www.birt-exchange.org/org/devshare/deploying-birt-reports/1344-eclipsecon-2011-api-examples/
Vineet Joshi
Hi Mike ,
I am not familiar with the java thing .... :unsure: i downloaded the lik u gave me ..but can u please explain how to move forward
Regards
mwilliams
You should also be able to add the chart in the beforeFactory method, I think. I haven't done it, yet, myself. What's your BIRT version? I'll try to create you a simple example.
Vineet Joshi
Hi Mike ,<br />
<br />
Thanks for replying<br />
<strong class='bbc'>My Birt version is 2.3.2 .</strong><br />
<br />
<br />
<br />
Regards
mwilliams
On your question of how to use Java to write a report design. Here is an old example in the devShare that shows a java class that creates a simple design.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/141-simple-design-engine-api-example/
With the charting examples I posted above, you'd just need to create a new java project, in Eclipse and use the java files in the download as your source files.
If you don't know Java, it's probably easier to use the designer! I'm going to take a look at your issue of adding a chart in script, now. I'll post an example, when I have one.
mwilliams
Here's an example, made in 2.3.2, where a chart is created and added to the report, in the beforeFactory script. It uses a dataSet that already exists in the report.
Vineet Joshi
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="108332" data-time="1344464042" data-date="08 August 2012 - 03:14 PM"><p>
Here's an example, made in 2.3.2, where a chart is created and added to the report, in the beforeFactory script. It uses a dataSet that already exists in the report.<br /></p></blockquote>
<br />
Thanks a lot GURU ..... <a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/public/style_emoticons/'>http://www.birt-exchange.org/org/forum/public/style_emoticons/</a><#EMO_DIR#>/tongue.gif
mwilliams
Not a problem!
madhavil
hi Williams,
Is there a way we can sort the x-axis values using scripting?
We have bar chart where product name is displayed in x-axis and some amount is displayed in y-axis. we are also using Y series grouping.
While fetching the data we r fetching the products in some order(order by product_id), and we need the same order to be used on x-axis. But for some reason the x series (product names) is getting sorted in alphabetical order which we want to alter and display in the order of fetching.
when we try to sort the x series the Sort On field is grayed out. attaching a screen shot of it.
Please suggest a solution for this.
We need to sort the x series by product_id order.
Thanks in advance,
Madhavi.
mwilliams
One solution to this that I've used before is to create a numerical field in your dataSet that uses like the running count aggregation. This way, your field is in the order in which they appear in the dataSet. With grouping, you'd need to track the assigned numbers so you could repeat them for like group values. In your chart, you'd use this numerical field for the x-axis, then replace the label value in script, with your actual axis values. Hopefully I explained this well enough!