Home forums Using CanvasJS How to auto fit index label in stacked column chart Reply To: How to auto fit index label in stacked column chart

#24212

I’ve implemented this indexLabelFormatter function, which verifies if the division between the current “y” value and the biggest “y” value (calculated during the dataPoint attribution) is shorter than a constant 6.


indexLabelFormatter: function(e){
                          if ((biggestYValue/e.dataPoint.y) < 6)
                          {
                              return e.dataPoint.y;
                          }
                          else{
                              return "";
                          }
                      }

Is it the best solution?

Thank you,

Guilherme