Home
Analytics
How to add hyperlink to particular one bar on the bar chart?
nirmal792
Hi,
How to add hyperlink to particular one bar on the bar chart?
suppose bar chart graph has 10 bars on it and all bars on the graph has GREEN color and one bar in different color i.e red..i want to add hyperlink this red bar for drill down purpose..i.e drilling is possible from red bar only and not from green bars
Any suggestions?
Thanks
Find more posts tagged with
Comments
mwilliams
Hi nirmal792,
What version of BIRT are you using?
nirmal792
Eclipse BIRT Designer Version 2.5.1
mwilliams
nirmal792,
The way I found to enable or disable the interactivity in the chart script ended up enabling/disabling the hyperlink one bar too late. I did find a way that works with URI, though. If you use your condition for changing the bar color in the javascript editor for setting the base URL and when it passes, you pass the URL string through, if it doesn't, you pass "null", then the hyperlink is only enabled on the correct bar in your chart.
If I find any more information out on this, I'll let you know.
nirmal792
Thank you very much..
I have tried to sort out this problem by using URI..but its of no use.
Waiting for your reply.
mwilliams
nirmal792,<br />
<br />
If you could log a bug for this interactivity issue, that'd be great. I received the following script from a coworker that should do it using a "look-ahead" array. I'm at a conference this week, so I haven't been able to try it out myself. You'll need to change the orthogonal value check to the value you want it to check against. Hope this helps.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
lookHeadArray = [];
ii=0;
function beforeDrawDataPoint( dph, fill, icsc )
{
if( lookHeadArray[(dph.getIndex()+1)] ){
icsc.getChartInstance().getInteractivity().setEnable(false);
}else{
icsc.getChartInstance().getInteractivity().setEnable(true);
}
}
function beforeDrawSeries( series, isr, icsc )
{
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
if( series.getClass() == BarSeriesImpl ){
var jj = isr.getSeriesRenderingHints().getDataPoints();
for( cc=0; cc< jj.length; cc++ ){
var mydp = jj[cc];
if( mydp.getOrthogonalValue() > 35 ){
lookHeadArray[cc] = true;
}else{
lookHeadArray[cc] = false;
}
}
if( lookHeadArray[0] == true ){
icsc.getChartInstance().getInteractivity().setEnable(false);
}
}
}
</pre>
nirmal792
hey,
Thanks for u r reply,but its not working.i tried to enable interactivity by using following functions.but of no use.please help me in that.
function 1:
function beforeDrawDataPoint(dph, fill, icsc)
{
temp = dph.getOrthogonalValue();
if(temp >7500 )
{
fill.set(255,0,0);
icsc.getChartInstance().getInteractivity().setEnable(true);
}
else
{
fill.set(0,0,255);
icsc.getChartInstance().getInteractivity().setEnable(false);
}
}
function 2:
function beforeDrawDataPoint( dph, fill, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl );
if( dph.getBaseValue( ) == "other" )
{
icsc.getChartInstance().getInteractivity().setEnable(true);
}
else if(dph.getBaseValue()!="other")
{
icsc.getChartInstance().getInteractivity().setEnable(false);
}
}
In this function ,i even used getBaseDisplayvalue function also.
but in all above cases,its giving me CHartInteractivity enabled on first bar of my chart.its highlighting that perticular bar of name "other".in tht case its working fine..but in inteeractivity case its not working.
please Reply soon
mwilliams
nirmal792,
Have you tried the look-ahead array way I posted in my last post? I know the enable/disable doesn't work correctly if not looking ahead, but looking ahead should allow you to set the interactivity enable correctly. Let me know if you have issues.
nirmal792
Hi,
Yes,i tried lookheadarray..but thts not working.
can u please suggest me some other way.
Virgil Dodson
HI Nirmal, please log an enhancement request for this at <a class='bbc_url' href='
http://www.birt-exchange.org/bug-reporting/'>Report
Bugs - BIRT Exchange</a>