Home Forums Chart Support Control over algorithm to optimize the index labels

Control over algorithm to optimize the index labels

Viewing 4 posts - 1 through 4 (of 4 total)
  • #34945


    if you are making space for the pie chart smaller or larger, then index labels rendered “outside” are appearing and disappearing.
    If we have a pie chart with the single value, the index label is rendered on the left, but if there is not enough space, the label is optimized away and you end up with the single large dot.
    See here: https://jsfiddle.net/206j35tx/ (move the vertical divider to make the space for the pie chart smaller or larger)

    Can we get some control over that algorithm, or at least, can we get it changed so the index label of the single value is not optimized away?

    Glaass Software


    Glaass Software,

    It seems like you have provided us with the JSFiddle link which contains the template code (Basic Column Chart).

    Please fork/save the JSFiddle reproducing the issue you are facing and share the link with us so that we can look into your code, understand the scenario better and help you out.

    Adithya Menon
    Team CanvasJS


    Hello Adithya,

    well, it seems like I get too used to autosave feature of many IDEs ;-)
    Here is the better version: https://jsfiddle.net/ph46kvr2/3




    As of now, it’s not possible to control the auto-hiding of indexLabels in case of pie/doughnut charts. However, you can use startAngle property to set the starting angle of the pie which rotates it. By doing this you can try to show the maximum number of indexlabels even when the width of the chart is reduced. Please find the code snippet below,

    data: [{				
        type: "pie",
        startAngle: 70,
        dataPoints: [
          { label: "This is a label", y: 14}

    Kindly take a look at this JSFiddle for an example on a pie chart with an indexLabel.

    pie chart with index-label

    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.