Home Forums Chart Support Pie Label Format for Zip Codes

Pie Label Format for Zip Codes

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

    Anyway to force zero leading labels on a pie chart.

    This example –

    https://www.bankdeposits.com/canvas-zip

    so

    8223 -> 08223
    8230 -> 08230
    8244 -> 08244
    8226 -> 08226

    ?

    #33868

    @jimginn,

    Since you are trying to use two values(y-value & label) in indexLabel, using indexLabelFormatter and formatNumber method to customize each of the values before displaying them as indexLabel should work fine. The code snippet below shows how you can achieve the same:

    indexLabelFormatter: function(e){
          return CanvasJS.formatNumber(e.dataPoint.label, "0####") + " (" + CanvasJS.formatNumber(e.dataPoint.y, "$#,##0.00\"\"") + ") " ;
        }

    Please take a look at this JSFiddle for a working example with sample code.

    CanvasJS basic Pie Chart with customized indexLabel


    Shashi Ranjan
    Team CanvasJS

    #33870

    Shashi,

    Thanks & Better e.g –

    https://www.bankdeposits.com/canvas-zip

    however, function/fix to fix the label on ‘onHover’ over pie section?

    Jim

    #33877

    @jimginn,

    By using toolTipContent property, you can customize both the (y-value & label) values displayed in the toolTip. The code snippet below shows how you can achieve the same:

    toolTipContent: "<span style='\"'color: {color};'\"'>0{label}</span>: {y}"

    Please take a look at this JSFiddle for an example adding custom toolTip Content.

    custom tooltip content


    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.