Search code examples
javascriptscalechart.js

Chart.js how define max tick of polarArea?


I look for way to use polarArea but with limit scale (line of tick) defined at 100. Actualy the scale display scale based in max value, but I want max fixed.

var data = {
    datasets: [{
        data: [10,20,30,40],
    }],
    labels: ["Red","Green","Yellow","Grey","Blue"]
};

var polarArea = new Chart(ctx, {
    data: data,
    type: 'polarArea',
    options: {
      scale: {
        ticks: {
          beginAtZero: true
        }
      }
    }
});

This marked with arrow green as I want the graph. Comparison between what I want and what I have

Can you help me?


Solution

  • var data = {
        datasets: [{
            data: [10,20,30,40],
        }],
        labels: ["Red","Green","Yellow","Grey"]
    };
    var polarArea = new Chart(ctx, {
        data: data,
        type: 'polarArea',
        options: {
          scale: {
            ticks: {
                min: 0,
                max: 100
            }
          }
        }
    });
    

    A JSFiddle would be super helpful for your exact situation, but based on the information provided, this should do it for you. http://jsfiddle.net/andrewborem/vup9o5fx/