0

I am trying to style the background the below linked radar chart and would like to be able to

  • Set the color of the radar lines
  • Set the thickness
  • Set the scale from 0-100
  • Set the Font size

I think this has to be done via 'options' (as this is not about the dataset) but I dont have enough of a grasp of JS to get this to work after a few hours trying.

Codepen here Chart JS radar instructions here

new Chart(document.getElementById("radar-chart"), {
type: 'radar',
data: {
  labels: ["Business", "Brand", "Marketing", "Stakeholders", "Clients"],
  datasets: [
     {
      label: "",
      fill: true,
      backgroundColor: "rgba(255,99,132,0.2)",
      borderColor: "rgba(255,99,132,1)", 
      pointBorderColor: "#fff",
      pointBackgroundColor: "rgba(255,99,132,1)",
      pointBorderColor: "#fff",
      data: [25.48,54.16,7.61,8.06,4.45]
    }
  ]
},  

options: {

legend: {
  display: false    
},
borderWidth: 10,

}

});
David
  • 15
  • 4

1 Answers1

3

In order to obtain what you're asking for, you can define ticks, gridLines and pointLabels inside options.scale.

new Chart(document.getElementById("radar-chart"), {
  type: 'radar',
  data: {
    labels: ["Business", "Brand", "Marketing", "Stakeholders", "Clients"],
    datasets: [{
      data: [25.48, 54.16, 7.61, 8.06, 4.45],
      fill: true,
      backgroundColor: "rgba(255,99,132,0.2)",
      borderColor: "rgba(255,99,132,1)",
      pointBorderColor: "#fff",
      pointBackgroundColor: "rgba(255,99,132,1)"
    }]
  },
  options: {
    legend: {
      display: false
    },
    borderWidth: 10,
    scale: {
      ticks: {
        fontSize: 18,
        max: 100
      },
      gridLines: {
        lineWidth: 2,
        color: "lightgreen"
      },
      pointLabels: {
        fontSize: 18,
        fontStyle: "bold"
      }
    }  
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.js"></script>
<canvas id="radar-chart" height="200"></canvas>
uminder
  • 23,831
  • 5
  • 37
  • 72