将值的总和放在圆环图的中心?

编程入门 行业动态 更新时间:2024-10-15 08:27:48
本文介绍了将值的总和放在圆环图的中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在绘制这个饼图:

使用此代码:

dxPieChart: { dataSource: dsAlarmsBySeverity, size: { width: 275, height: 150 }, palette: ['#FFFF00', '#FF9900', '#CC3300', '#33CC33', '#0066FF'], legend: { backgroundColor: '#FCFCFC', border: { color: 'black', width: .5, visible: true, cornerRadius: 10 }, verticalAlign: 'middle' }, series: [{ type: 'doughnut', argumentField: 'severity', valueField: 'count', label: { visible: false, font: { size: 16 }, connector: { visible: true, width: 0.5 }, position: 'columns', customizeText: function(arg) { return arg.argumentText } }, border: { color: 'black', width: .5, visible: true }, hoverStyle: { border: { color: 'black', width: .5, visible: true } } }] }

有没有办法添加甜甜圈中心所有值的总和?像这样:

Is there a way to add the sum of all values to the center of the donut? Like so:

推荐答案

作为一个解决方法,直到打开问题完成,您可以在canvas元素本身上绘制自己的总数。

As a workaround until the open issue is complete, you could just draw your own total on the canvas element itself.

您必须手动计算画布上的x / y位置(如本示例中的[150,100])。

You will have to manually calculate the x/y position on the canvas (like [150,100] in this example).

var canvas=document.getElementById("myChart"); var ctx=canvas.getContext("2d"); ctx.font="36px verdana"; ctx.fillText("76",150,100);

更多推荐

将值的总和放在圆环图的中心?

本文发布于:2023-11-30 03:03:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648506.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:放在   圆环   总和   中心

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!