3

[Update: This may have been fixed in version 2.1.5]

In Chart.js version 1 I used to be able to set the spacing between the scale lines on a radar chart. The desired behaviour was lines from 0 to 100 in steps of 5. I used the following version 1 options:

{
    scaleOverride: true,
    scaleStartValue: 0,
    scaleSteps: 20,
    scaleStepWidth: 5
}

Since upgrading to version 2 (2.1.4) I can't seem to get the same behaviour. Below is a minimal chart based on the documentation for a radar chart with my best guess for how it should work. The stepSize argument seems to be ignored.

<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
    <title>Radar Chart Test</title>
    <script src="Chart.js"></script>        
  </head>
  <body>
  <canvas id="myChart" width="400px" height="400px"></canvas>
<script>
var ctx = document.getElementById("myChart").getContext("2d");
var data = {
    labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
    datasets: [
        {
            label: "My First dataset",
            data: [65, 59, 90, 81, 56, 55, 40]
        },
        {
            label: "My Second dataset",
            data: [28, 48, 40, 19, 96, 27, 100]
        }
    ]
};

var myChart = new Chart(ctx, {
    type: 'radar',
    data: data,
    options: {
            scale: {
                ticks: {
                    min: 0,
                    max: 100,
                    stepSize: 5,
                }
            }
    }
});
</script>
  </body>
</html>

Any thoughts most appreciated.

dougmet
  • 635
  • 4
  • 19

0 Answers0