Page 1 of 1
override which series appears in legend
Posted: Tue Apr 15, 2014 4:57 am
by 9337315
Is there a way to exclude a series from appearing in the legend? It must remain visible.
Re: override which series appears in legend
Posted: Tue Apr 15, 2014 7:33 am
by yeray
Hello,
WCantrall wrote:Is there a way to exclude a series from appearing in the legend? It must remain visible.
I've just added it to the wish list to be implemented in future releases:
http://bugs.teechart.net/show_bug.cgi?id=731
Feel free to add your mail to the CC list to be automatically notified when an update arrives.
Re: override which series appears in legend
Posted: Tue Jun 10, 2014 11:48 am
by 15966868
Has this been implemented yet?
We're porting some TeeChart_PHP scripts to Javascript / HTML5 and rely on it quite heavily. Happy to test a beta version, as our system won't be going live immediately.
Alternatively, is there a way to override a legend draw method/event?
Kind regards
Mark
Re: override which series appears in legend
Posted: Tue Jun 10, 2014 2:30 pm
by yeray
Hi Mark,
I'm afraid it hasn't been implemented yet.
I've incremented the issue Importance so it can be reviewed asap.
Re: override which series appears in legend
Posted: Mon Jan 26, 2015 12:19 pm
by 17769562
I've implemented a crude "showInLegend" into javascript version 2014.07.31.1.7 (attached) if that's of any help to anyone?
Hopefully it can be tidied up adopted in the main source
Mark
Re: override which series appears in legend
Posted: Mon Jan 26, 2015 12:24 pm
by yeray
Hi Mark,
I've removed the attachment in your post because it contains a the TeeChart sources.
We'll study your implementation and we'll be back to you here asap.
**** EDIT ****
For those customers interested in the implementation Mark has just proposed, I'll try to explain it here:
1. Initialize the property at Tee.Series:
Code: Select all
Tee.Series=function(o,o2) {
this.chart=null;
this.data={ values:[], labels:[], source:null }
this.yMandatory=true;
this.horizAxis="bottom";
this.vertAxis="left";
this.showInLegend=true; //AMJ: added ShowInLegend
//...
2. Add the appropriate condition at drawSeries:
Code: Select all
this.drawSeries=function(index,order) {
var s=chart.series.items[index];
if ((this.showHidden || s.visible) && s.showInLegend) { //AMJ: added ShowInLegend
this.drawItem(s.titleText(index),s,order,true);
return true;
}
else
return false;
}
3. Change itemsCount accordingly:
Code: Select all
this.itemsCount=function() {
//...
if ((st==="values") && (result>0))
result=ss.firstVisible().legendCount();
else
{
if (((st==="auto") && (result>1)) || (st==="series")) { //AMJ: added ShowInLegend - remove count where not showInLegend?
var t;
for(t=0; t<ss.items.length; t++)
if (!ss.items[t].showInLegend) result--;
}
else
if (result==1)
result=ss.firstVisible().legendCount();
}
//...
Re: override which series appears in legend
Posted: Mon Jan 26, 2015 12:34 pm
by 17769562
Yeray wrote:I've removed the attachment in your post because it contains a the TeeChart sources.
Whoops - Sorry - didn't think!
Re: override which series appears in legend
Posted: Mon Jan 26, 2015 12:35 pm
by yeray
Hi,
amjonas wrote:Whoops - Sorry - didn't think!
No worries. I've edited the post above to show your proposal.
Thanks for sharing it!
Re: override which series appears in legend
Posted: Fri Jul 03, 2015 11:21 pm
by 17769562
There have been two releases of Javascript/HTML5 since this post, and it's not been implemented in the core.
Any problems with the implementation? it matches VCL/PHP which we also use.
Slightly bored of continuing to have to update the new releases!
Mark
Re: override which series appears in legend
Posted: Mon Jul 06, 2015 10:09 am
by yeray
Hello Mark,
Excuse us for the delay here.
I've added your implementation to the internal sources so the next maintenance release with include it.
Re: override which series appears in legend
Posted: Tue Jul 07, 2015 8:11 am
by yeray
Hello,
Note we decided to change showInLegend for legend.visible.
So with the next update you'll be able to do:
Code: Select all
Chart1.series.items[0].legend.visible=false;