Chartjs雷达索引标签

Zur*_*uri 8 javascript css jquery radar-chart chart.js

我正在使用chartjs绘制雷达图.

该值在图表的点上悬停显示,但我想始终显示该值.我需要更改视图以在打印页面时显示数据.

这是我目前的图表.标签显示在悬停上

这是我目前的图表. 标签显示在悬停上

我想始终显示值,如下图所示 我想始终显示值,如下图所示

Pri*_*dya 1

在图表 js文档中,您可以在动画完成时运行函数,使用onAnimationComplete : function(){}

小提琴定义

这里

你的html文件可能是这样的

<canvas id="my_chart"></canvas>
Run Code Online (Sandbox Code Playgroud)

那么你的js文件可能如下所示

fillColor: "#79D1CF",
            strokeColor: "#79D1CF",
            data: [60, 80, 81, 56, 55, 40]



 var ctx = document.getElementById("myChart1").getContext("2d");
    var myLine = new Chart(ctx).Line(chartData, {
    showTooltips: false,
    onAnimationComplete: function () {
         //Your other ChartJs features defined here



var ctx = this.chart.ctx;
        ctx.font = //your font
        ctx.fillStyle = //your text color
        ctx.textAlign = "center";
        ctx.textBaseline = "bottom";

        this.datasets.forEach(function (dataset) {
            dataset.points.forEach(function (points) {
                ctx.fillText(points.value, points.x, points.y - 10);//You can change the x and y position of the text as per your requirement
            });
        })
    }
});
Run Code Online (Sandbox Code Playgroud)

//完整归属于作者线程