Legend customization for color grid

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
vishwa
Newbie
Newbie
Posts: 33
Joined: Mon Oct 15, 2007 12:00 am

Legend customization for color grid

Post by vishwa » Wed Aug 01, 2018 5:25 am

Hi,

We are using ColorGrid to draw 400 series array. By default 12 color palette will be there for legend. We want to customize the legend with more colors might be 30 or 30+ and we want to show all 30 colors in legend. and second thing is even though we are showing 30 colors we do not want to show all labels might be we want to show 5 only. Is there any possible ways to do this? if possible what are the ways we can try, please suggest on this.

Regards,
Sravan

Marc
Site Admin
Site Admin
Posts: 1274
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Legend customization for color grid

Post by Marc » Fri Aug 10, 2018 8:23 am

Hello Sravan,

You could use the ongettext event.

In this case only putting the text label in for every second value:

Code: Select all

  //chart setup code...etc, then:
  
  Chart1.legend.ongettext=function(legend,series,index,res) {
    if (index % 2 != 0)
      return res;
   else
      return "";
  }
  
  //more code of choice then:

  Chart1.draw();
Regards,
Marc
Steema Support

Post Reply