Home
Analytics
Waterfall Report with negative Values
awie
Hello!<br />
I found an example for a Waterfallchart (<a class='bbc_url' href='
http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=136)'>http://www.birt-exchange.com/modules/wfdownloads/singlefile.php?cid=2&lid=136)</a>
, but it has only positive values. I tried to test it with negative values but that doesn't work. Has anyone an idea how it works with positive and negative values in one chart? <br />
<br />
Thank's for your help!<br />
awie
Find more posts tagged with
Comments
mwilliams
Hi Awie,
What are you wanting the chart to look like when you encounter a negative number? If you're wanting it to still be on the positive side of the axis only counting down from the last bar, you'll most likely have to do some scripting on the chart to handle the negative values.
Regards,
Micheal
awie
Hi Michael,
thank you for your answer. In the last view minutes i found a way to "go the waterfall" back. I made the negative Values positive and do some scripts. But now I have the next Problem, because I made the values all positive, so that they are all in the correct order, I can not give them another colour. Is there a way in Chart-Programming, to give some values another colour?
Regards,
awie
mwilliams
Awie,
Here is some sample code that should give you an idea of what you need to do changing the bar color for the negative values:
previousFill = null;
//Used for restoring
function beforeDrawElement(dataPointHints, fill)
{
val = dataPointHints.getOrthogonalValue();
if (val < 0)
{
previousFil = new Object();
//Used for restoring
previousFill.r = fill.getRed();
previousFill.g = fill.getGreen();
previousFill.b = fill.getBlue;
fill.set(255, 0, 0);
} else
{
previousFill = null;
}
}
function afterDrawElement(dataPointHints, fill)
{
if (previousFill != null)
{
fill.set(previousFill.r, previousFill.g, previousFill.b);
}
}
Once you get this working. This would be a great example to share on the DevShare!
Regards,
Michael