Jquery Chart.js标签上有换行符?

时间:2015-09-13 11:30:18

标签: javascript jquery charts chart.js

我对JQuery Chart.js有两个问题 -

1-使用雷达图表 - 相同的标签是大牌 - 标签的大小使图表变小。

var data = {
labels: ["Strategy", "Strategic Marketing", "Operacional Marketing", "Innovation Marketing", "Competitive Intelligence", "Marketing Manager", "Research and Investiments"],
datasets: [
    {
        label: "My First dataset",
        fillColor: "rgba(220,220,220,0.2)",
        strokeColor: "rgba(220,220,220,1)",
        pointColor: "rgba(220,220,220,1)",
        pointStrokeColor: "#fff",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgba(220,220,220,1)",
        data: [65, 59, 90, 81, 56, 55, 40]
    },
    {
        label: "My Second dataset",
        fillColor: "rgba(194,208,19,0.2)",
        strokeColor: "rgba(194,208,19,1)",
        pointColor: "rgba(194,208,19,1)",
        pointStrokeColor: "#c2d013",
        pointHighlightFill: "#c2d013",
        pointHighlightStroke: "rgba(151,187,205,1)",
        data: [28, 48, 40, 19, 96, 27, 100]
    }
]

};

2-使用Donut Chart - 我将标签放在中间,带有图表的值。但是我需要打破界限并加上像

这样的东西

“SCORE:”
200pts

chart.js

Chart.types.Doughnut.extend({
    name: "DoughnutAlt",
    draw: function() {
    Chart.types.Doughnut.prototype.draw.apply(this, arguments);
    this.chart.ctx.fillStyle = '#010733';
    this.chart.ctx.textBaseline = 'middle';
    this.chart.ctx.font = 'normal 90px Open Sans';
    this.chart.ctx.fillText(this.segments[0].value + " pts", this.chart.width / 2, this.chart.width / 2, 200);
    this.chart.ctx.textAlign = 'center';

}
});

有可能打破界限吗?

TKS!

0 个答案:

没有答案