2015-07-20 276 views
1

我使用Chart.js創建雷達圖表。我想改變標籤的大小,但我沒有在這裏找到option.ind我的代碼: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, 
 

 
// ** 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 
 
});

你能幫助我嗎?

回答

2

雷達圖有一些圖表特定的選項,可以在全局圖表選項中滾動。其中一個選項是pointLabelFontSize,它取數值。這個選項需要設置在同一個地方,你目前正在設置pointDot值才能生效:

new Chart(ctx).Radar(data, { 
    pointDot: false, 
    pointLabelFontSize: 20 
}); 

注:pointLabelFontSize值在像素

+0

非常感謝!你解決了我的問題! –