Home Forums Chart Support How to auto fit index label in stacked column chart

How to auto fit index label in stacked column chart

Viewing 3 posts - 1 through 3 (of 3 total)
  • #24209

    Hi everyone,

    I have an issue concerning the index label auto fit. I have different values in my dataSeries, but not all of them should be displayed, because some will be placed outside the chart or, even worse, will be overlapped each other.

    I haven’t found any property that I could use to fix that.

    Do I have to do any calculations in my indexLabelFormatter function to achieve that?

    Follows a jsfiddle describing my issue.

    What am I supposed to do here?

    Thank you,

    Guilherme

    #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

    #24221

    @guilhermemaranhao,

    You can definitely go ahead with this approach but we will check from our end and let you know.

    ____
    Shashi Ranjan
    Team CanvasJS

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.