Chart.js雷达标签坐标 [英] Chart.js Radar Labels Coordinates

查看:133
本文介绍了Chart.js雷达标签坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法获得雷达图中标签的坐标?
我正在尝试在标签区域放置图片而不是文字。

is there any way to get the coordinates for the labels in the radar chart? I'm trying to put images instead of text in the labels area.

推荐答案

你可以用它来计算它规模财产。动画完成后,这些内容会在这些点上绘制一个蓝色圆圈。

You can calculate it using the scale property. Here is something that draws a blue circle at those points after the animation completes.

onAnimationComplete: function () {
    for (var i = 0; i < this.scale.valuesCount; i++) {
        // get the poitn position
        var pointLabelPosition = this.scale.getPointPosition(i, this.scale.calculateCenterOffset(this.scale.max) + 5);

        // draw a circle at that point
        this.chart.ctx.beginPath();
        this.chart.ctx.arc(pointLabelPosition.x, pointLabelPosition.y, 5, 0, 2 * Math.PI, false);
        this.chart.ctx.fillStyle = '#77e';
        this.chart.ctx.fill();
        this.chart.ctx.stroke();
    }
}






小提琴 - http://jsfiddle.net/1jgmbyb7/

这篇关于Chart.js雷达标签坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆