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)
Chart from grouped table
kszyhooo
<p>Hi all!</p>
<p> </p>
<p>i have big problem with chart. I need to create chart which will show daily FPY value for every product family. I've tried create directly from data source (chart_1) and from table (chart_2) with no success. Am i missing something?</p>
<p> </p>
<p> </p>
<p><img src="
http://i62.tinypic.com/2qi8h7o.jpg"
; alt="2qi8h7o.jpg"></p>
Find more posts tagged with
Comments
kszyhooo
<p>Hi </p>
<p>could somebody help me with my problem? </p>
<p> </p>
<p>Thanks in advance</p>
shamo
<p>Hello take a look at this sample from your data. You still may need to tweak it a little bit regarding the label and legend. Hope it helps </p>
kszyhooo
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Thanks for your response! It's look good. Now i need find the way to remove repeated labels.</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Regards</span></p>
shamo
<p>Ok. Take a look at this modification. Trying to use a script to define the legend. I hope this works for the mean time or if anyone can take it from here. If I'm successful, will post it for you</p>
kszyhooo
<div>In your coloring script you use defined product family names, it's wrong. </div>
<div>In DB is lots of product family and might be added. How to do this dynamicly? </div>
pricher
<p>Hi,</p>
<p> </p>
<p>Here's a solution to your problem that doesn't require chart scripting. The chart is built on a scripted data set that takes its data from your original table. Here's the solution in details:</p>
<p> </p>
<p>1. In the initialize method of the report, create 3 arrays and a counter. The arrays will hold the values of columns <em>day, product_family, and fpy</em> from your table:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">vDay = new Array();<br>
vProductFamily = new Array();<br>
vFpy = new Array();<br>
vCnt = 0;</span></p>
<p> </p>
<p>2. In the onCreate method of the product_family group header of your table, add the script to copy the values of <em>day, product_family and fpy</em> into their respective arrays:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">vDay[vCnt] = this.getRowData().getColumnValue("day");<br>
vProductFamily[vCnt] = this.getRowData().getColumnValue("product_family");<br>
vFpy[vCnt] = this.getRowData().getColumnValue("fpy");<br>
vCnt++;</span></p>
<p> </p>
<p>3. Create a new Scripted Data Set Data Source. (NB: Although typically you need to script the open and close method, you do not need to do this here since we are getting our values from inside the report.)</p>
<p> </p>
<p>4. Create a new Scripted Data Set. Add 3 columns to the data set: <em>day, product_family and fpy</em>.</p>
<p> </p>
<p>5. In the open method of the Scripted Data Set, initialize a counter:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">recordCount = 0;</span></p>
<p> </p>
<p>6. In the fetch method of the Scripted Data Set, add the following script to populate the data set from the values stored in the arrays:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">if (vCnt > recordCount) {<br>
row.day = vDay[recordCount];<br>
row.product_family = vProductFamily[recordCount];<br>
row.fpy = vFpy[recordCount];<br>
recordCount++;<br>
return true;<br>
} else {<br>
return false;<br>
}</span></p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;"><span style="font-family:arial, helvetica, sans-serif;">7. Add a chart to your report and use the Scripted Data Set as the data source. </span></span></p>
<p> </p>
<p>If you don't need to show the results of your original chart, simply change its Visibility attribute to false.</p>
<p> </p>
<p>I have attached a sample report (BIRT 4.4) that works with the original data file you sent.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
<p> </p>