问题
I use Chart.js to create a radar chart. I would like change the size of label but i don't find the option.ind my code here :
var data = {
labels: ajax_label,
pointLabelFontSize : 16,
scaleFontSize: 16,
datasets: [
{
label: "My First dataset",
fillColor: "rgba(91, 192, 222,0.2)",
strokeColor: "rgba(91, 192, 222,1)",
pointColor: "rgba(91, 192, 222,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(91, 192, 222,1)",
data: ajax_data,
scaleShowLabels : false,
scaleOverride: true,
// ** Required if scaleOverride is true **
// Number - The number of steps in a hard coded scale
scaleSteps: 10,
// Number - The value jump in the hard coded scale
scaleStepWidth: 10,
// Number - The scale starting value
scaleStartValue: 0
}
]
};
var ctx = $("#myChart").get(0).getContext("2d");
var myNewChart = new Chart(ctx);
new Chart(ctx).Radar(data, {
pointDot: false
});
Can you help me please ?
回答1:
The Radar chart has some chart-specific options that can be rolled in the the global chart options. One of these options is pointLabelFontSize which takes a number value. This option needs to be set in the same place you're currently setting the pointDot value in order to take effect:
new Chart(ctx).Radar(data, {
pointDot: false,
pointLabelFontSize: 20
});
Note: the value for pointLabelFontSize is in pixels
来源:https://stackoverflow.com/questions/31522001/chart-js-change-size-of-label-of-radar-chart