Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Custom draw on chart's canvas in BIRT v2.6.x report
dlesin
<p>Hello!<br><br>
Is it possible to lay custom shapes on chart in BIRT report with JavaScript code? Or may be, is there another way to solve my problem?<br><br>
The problem is next. Currently, I have a report which can generate chart like this:<br><br>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>Easiest way will be to hide the labels you don't need through some chart scripting. First and last labels are easy to hide. For the current date, you will need to pass that information to the script somehow. In my example, I'm using a report parameter, but it could be some other way based on your requirement.</p>
<p> </p>
<p>Here's the chart script:</p>
<pre class="_prettyXprint _lang-">
dpSize = 0
cnt = 0;
function afterDataSetFilled( series, dataSet, icsc )
{
dpSize = dataSet.getValues().length;
}
function beforeDrawAxisLabel( axis, label, icsc )
{
currentDate = icsc.getExternalContext().getScriptable().getParameterValue("pCurrentDate");
if (axis.isCategoryAxis()) {
if (cnt != 0 && cnt != dpSize-1 && label.getCaption().getValue() != currentDate) {
label.getCaption().setValue("");
}
}
cnt++;
}
</pre>
<p>A working example is attached.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
<p> </p>
<p> </p>