chart.js改变雷达图的标签大小 [英] chart.js change size of label of radar chart
本文介绍了chart.js改变雷达图的标签大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Chart.js来创建雷达图。我想改变标签的大小,但我没有找到我的代码在这里的选项。
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,// **如果scaleOverride为true,则为必需** //数字 - 硬编码标尺中的步数scaleSteps:10,// Number - 硬编码标尺中的值jumpStepWidth:10 ,// Number - 缩放起始值scaleStartValue:0}]}; var ctx = $(#myChart)。get(0).getContext(2d); var myNewChart = new Chart(ctx); new Chart (ctx).Radar(data,{pointDot:false});
< <>您可以帮我吗?
解决方案
雷达图表有一些特定于图表的选项,图表选项。这些选项之一是 pointLabelFontSize
,它接受一个数字值。此选项需要设置在当前设置 pointDot
值的相同位置,才能生效:
new Chart(ctx).Radar(data,{
pointDot:false,
pointLabelFontSize:20
});
注意: pointLabelFontSize
的值为像素
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 ?
解决方案
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
这篇关于chart.js改变雷达图的标签大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文