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)
Stock chart change color
Johnny
I have 2 issues in this post
Issue 1.
On Stock Chart(open, close, hight, low) what's the method can change the line color and fill color?
I did use the function
function beforeDrawDataPoint(dph, fill, icsc)
{
chart = icsc.getChartInstance();
if (dph.getDisplayValue().length() >= 16) {
d1 = dph.getOrthogonalValue().getClose();
d2 = dph.getOrthogonalValue().getOpen();
marker = chart.getAxes().get(0).getAssociatedAxes().get(0).getMarkerLines().get(0).getValue().getValue();
if (d1 > marker) {
fill.set(255, 0, 0);
} else {
fill.set(0, 0, 255);
}
}
}
But this didn't change the color. should I do it under beforeDrawDataPoint() function, or others?
Issue 2.
On item onRender script. We can have beforeDrawDataPoint(), beforeDrawMarker() function.
When I change the marker color, I would like to depends on others column.
Which means same record on same dataset, but different column.
Is there any method I can get others column value on the same record?
Thanks in advance.
Find more posts tagged with
Comments
mwilliams
Johnny,<br />
<br />
For the problem with coloring the stock chart bars, are you getting any color on them at all. When I make one, I'm only getting white for the stocks that had a positive day and the series color for the stocks that had a negative day. I can use script to change the negative ones, but not the positive ones. I have posted a bug on eclipse.org:<br />
<br />
<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236133'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=236133</a><br
/>
<br />
Regards,<br />
<br />
Michael
Johnny
Hi Michael,
This is what the problem i have. By the time, I create 2 series one for positive and one for negative data with customized color. and use scripting to change the marker's color.
It's work.
Johnny
opa
Hi,<br />
<br />
sorry to use this old thread, but I have similar problems. I'm using BIRT 4.2.1.<br />
I created a stock chart which displays a single series with values grouped by a special attribute. The x-Axis displays the values depending on the weekday, the values are grouped by partnumber. Like in the link to the bug report above described, I switched the color to 'positive/negative', after this I got the palette colors (instead of no color).<br />
<br />
But my main problem is that I have to modify the color of the serie as a function of the attribute I used for grouping. I cannot change the palette because the partnumber attribute is changing sometimes, and I don't want to touch the report each time this changing happens. <br />
<br />
I tried it with the 'beforeDrawDataPoint()' function, but I have no idea which sub function (dph.???) I have to use for this. Is this function the right one? Or do I have to use the 'before DrawSeries()' function?<br />
<br />
Thanks for your help.<br />
<br />
Best regards,<br />
<br />
Joerg<br />
<br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Johnny'" data-cid="33457" data-time="1213134995" data-date="10 June 2008 - 02:56 PM"><p>
Hi Michael,<br />
<br />
<br />
This is what the problem i have. By the time, I create 2 series one for positive and one for negative data with customized color. and use scripting to change the marker's color.<br />
<br />
<br />
It's work.<br />
<br />
<br />
Johnny<br /></p></blockquote>
mwilliams
Can you make an example with the sample database that shows your issue and post it? I'll take a look.
opa
Hi,<br />
<br />
attached you find a sample report and a sample xls file with some data out of our database. When you start the report you will see one single serie, grouped by the part number, and the minimum, the maximum and the average value of usage hours for each part number. I use the average value +0.25 and -0.25 to get an area for colorization.<br />
At the moment the report shows the colors of the palette but not the scripted colors. And this is my problem. Which function do I have to use to script the colors of the serie, depending on the part number?<br />
<br />
Thanks, Joerg<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114511" data-time="1361860009" data-date="25 February 2013 - 11:26 PM"><p>
Can you make an example with the sample database that shows your issue and post it? I'll take a look.<br /></p></blockquote>
mwilliams
Take a look at the modified script in the chart.
opa
Thanks a lot, that's exactly that what I need! Regards, Joerg<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114547" data-time="1361911783" data-date="26 February 2013 - 01:49 PM"><p>
Take a look at the modified script in the chart.<br /></p></blockquote>
mwilliams
You're welcome. Let us know whenever you have questions!
opa
Hi, <br />
<br />
I have another question concerning this solution.<br />
I extended the sample report with a second stock chart which displays the start time and the end time of the usage of the parts (xls file is also extended). I use the earliest start time as minimum value, the latest end time as maximum value, and the average of start time and end time as the open and close value of the area I want to colorize.<br />
<br />
I use the same scripts like in the first chart. Why now the scripted colorization doesn't work? How can I solve this? Where can I find additional information about this, maybe for mor complexe stock charts?<br />
<br />
Thanks J?rg<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114638" data-time="1362001022" data-date="27 February 2013 - 02:37 PM"><p>
You're welcome. Let us know whenever you have questions!
<br /></p></blockquote>
mwilliams
Can you attach data that will work with the second chart, so I can see what you're talking about? Thanks!
opa
Hi,
sorry, I uploaded the wrong file. Attached you can find the data file. The report file is the same as in my last post.
Thanks, Joerg
mwilliams
It appears to have something to do with the way you had the fields for the first chart vs the multiple fields for the second chart. In the second chart, for setting the marker colors in the plot, you just need to change the script to have [1] instead of [0].
opa
Hi,
now it works well. Thanks a lot.
Regards, Joerg
mwilliams
You're welcome. Let us know whenever you have questions!