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)
[Pareto] Filter on a runningsum column binding
NDJ19_
<p>Hi guys,</p>
<p> </p>
<p>I created a Pareto report to display the quantity ordered on each product, and the cumulative quantity ratio, which is working perfectly. and the final results looks like as image1 as attachment.</p>
<p> </p>
<p>What I need to do now, is to add a filter to highlight only the 80 first percents, to have something like image2 as attachment.</p>
<p> </p>
<p>Is there any way to do it ?</p>
<p> </p>
<p>You can find the report as attachment.</p>
<p> </p>
<p>Thanks in advance for your help</p>
Find more posts tagged with
Comments
NDJ19_
<p>I tried to use another approach.</p>
<p> </p>
<p>In the report as attachment to use computed columns to calculate my percent to be able to use a filter.</p>
<p> </p>
<p>Informations are correctly displayed on the dataset. If generate the report the number of bars corresponds to my filter. But the line and values of axis 2 can't be displayed.</p>
<p> </p>
<p>If you've any suggestion it will be great.</p>
<p> </p>
<p>Thanks</p>
Clement Wong
<p>Is your design running on an iHub? Or are you using Open Source BIRT? If OS BIRT, we should move this topic to the Designing BIRT Reports forums section.</p>
<p> </p>
<p>I took your first report design as a base. Then I added the following code in the <em>afterDataSetFilled </em>event to check which values are less than or equal to 80%, and stored a flag in a array to change the color.</p>
<p> </p>
<p>In the <em>beforeDrawDataPoint </em>event, for each point of each series, we check if the flag is set, and change the color accordingly:</p>
<pre class="_prettyXprint _lang-">
// This debug logger is only available in commercial BIRT. The output will be displayed in Eclipse's Error Log in the UI.
//
// logger = java.util.logging.Logger.getLogger("birt.report.logger");
var under80PercentArray = [];
function afterDataSetFilled( series, dataSet, icsc )
{
if( series.getSeriesIdentifier() == "Series 2"){
var list = dataSet.getValues();
var items=list.length;
for (i=0; i < items; i++) {
// logger.warning (list[i]);
if (list[i] <= .8) under80PercentArray.push(true);
else under80PercentArray.push(false);
// logger.warning (under80PercentArray[i]);
}
}
}
function beforeDrawDataPoint(dph, fill, icsc)
{
if (under80PercentArray[dph.getIndex()]) {
fill.set(255, 0, 0);
}
}
</pre>
<p>Attached is my example.</p>
NDJ19_
<p>I'm using the Open Source BIRT designer and thanks a lot for your reply.<br>
<br>
Another question please, and if I take your example, is there any way to complete it to:<br>
<br>
- Set the line color when i'm under 80 percent<br>
- Display the in bold the CategoryAxis values when I'm under 80 percent or change the font size.<br>
<br>
For the first question I'm not sure that it's possible For second one, I believe we can do it.<br>
<br>
I tried something like that:<br>
</p>
<pre class="_prettyXprint _lang-js">
var i = 0;
var flag;
function beforeDrawAxisLabel( axis, label, context ) {
if (axis.isCategoryAxis()) {
flag = under80PercentArray[i];
if (flag == true){
label.getCaption().getFont().setSize(14);
}
}
i++;
} </pre>
<p>without success<br>
<br>
Thanks again for your help</p>
Clement Wong
<p><em>- Set the line color when i'm under 80 percent</em></p>
<p> </p>
<p>Not with Open Source BIRT default Chart. It's possible with commercial BIRT, or if you try to integrate a 3rd party JavaScript visualization with OS BIRT.</p>
<p> </p>
<p><em>- Display the in bold the CategoryAxis values when I'm under 80 percent or change the font size</em></p>
<p> </p>
<p>Unfortunately, it's not possible to just bold a few labels with Open Source BIRT. It's all or none. If it were to work, you'll need to put the i++; statement at the end of the IF loop, not after.</p>
<p> </p>
<p>It is possible with commercial BIRT, or if you try to integrate a 3rd party JavaScript visualization with OS BIRT.</p>
<p> </p>
<p>On a side note, if you need to draw threshold or marker lines for the 80 percent mark, you can look at this DevShare (<a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1086-bar-chart-with-dynamic-markerthreshold-lines/'>http://developer.actuate.com/community/forum/index.php?/files/file/1086-bar-chart-with-dynamic-markerthreshold-lines/</a>)
. </p>