Saturday, 28 July 2018

Change Radius/Point size of Legend Points in chart.js when usePointStyle is true

I want to reduce the point size of legend items

Here is a working Fiddle

I tried all available options given in the documentation but nothing worked

Javascript Code

var options = {
  type: 'line',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [
        {
          label: '# of Votes',
          data: [12, 19, 3, 5, 2, 3],
        borderWidth: 1
        },  
            {
                label: '# of Points',
                data: [7, 11, 5, 8, 3, 7],
                borderWidth: 1
            }
        ]
  },
  options: {
    legend: {
        labels: {
            usePointStyle:true
      }
    },
    scales: {
        yAxes: [{
        ticks: {
                    reverse: false
        }
      }]
    }
  }
}

var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);

Html

<canvas id="chartJSContainer" width="600" height="400"></canvas>



from Change Radius/Point size of Legend Points in chart.js when usePointStyle is true

No comments:

Post a Comment