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)
Change color gantt chart comparing two dates
Bordihn
<p>Hi, I would like to change the color of a marker in my gantt chart for a BIRT report. The color schould rely to the result of a substraction operation of two end dates. So, if endDate1 minus endDate2 = <0, I want the marker to turn red (event ends later). If endDate1 minus endDate2 = >0, I want the marker to turn green (event ends earlier). The idea is to compare two dates and visualize, if a date differ to a earlier (default) date. In the chart you will see then always the default date marker in black and the actual date (result of the substraction operation) in green or red.</p>
<p> </p>
<p>I tried different versions of scripting, but get no useful results. So, any ideas about that? Thanks a lot in advance, here is a base version I try to modify to my needs:</p>
<p> </p>
<p>function beforeDrawMarker( marker, dph, icsc )<br>
{ <br>
if (BirtDateTime.diffDay ( row["defaultBaseplan.endDate"], row["endDate"] )<0 )<br>
{marker.setFill(0,255,0);}<br>
<br>
if (BirtDateTime.diffDay ( row["defaultBaseplan.endDate"], row["endDate"] )>0 )<br>
{marker.setFill(0,255,0);}<br><br>
}</p>
<p> </p>
<p>Best regards</p>
Find more posts tagged with
Comments
mwilliams
Inside your chart script you'll have to use DPH to grab the data from the data point. If you could provide a flat file (.csv) or data and a design that uses it so I could actually test on it, I could help more.
Bordihn
<p>Hi Michael,</p>
<p> </p>
<p>first off sorry for the delay. Thanks to your input I found a way to visualize the two different dates,</p>
<p>for a successor report I have now some new challenges:</p>
<p> </p>
<p>
mwilliams
For 1, why specify a y, m, and d? If you just do new Date(), you get the current date.<br><br>For 2 and 3, we might be able to use the data point labels to get what you're wanting to show.
Bordihn
<blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="135573" data-time="1429544654">
<p>For 1, why specify a y, m, and d? If you just do new Date(), you get the current date.<br><br>
For 2 and 3, we might be able to use the data point labels to get what you're wanting to show.</p>
</blockquote>
<p> <br>
Hi Michael,<br>
<br>
that was ... awkward. Thanks to your input it works right now, for 2 and 3 I found a solution even without scripting:<br>
<br>
2. In <em>Select Data</em> within your chart you can define your <em>Task Label</em> like this : BirtDateTime.diffDay(row["date1"], row["date2"])<br>
In <em>Format Chart</em> / Series you can activate the function <em>Show Series Labels</em> and add the label value <em>Task Label </em>(which we defined before). The <em>Insets (Points)</em> moves the displayed divergence if necessary.<br>
<br>
3. Same way like before, just activate<em> Show Series Labels</em> and add the Value endDate (or whatever you need).</p>
<p> </p>
<p>
Thanks for your help Michael, hopefully some others can use some of this stuff.<br>
<br>
Best regards.</p>
mwilliams
Great! Glad everything is working properly, now!
<br><br>Let us know whenever you have questions!