Page 1 of 1

Legend customization for color grid

Posted: Wed Aug 01, 2018 5:25 am
by 14047022
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

Re: Legend customization for color grid

Posted: Fri Aug 10, 2018 8:23 am
by Marc
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