CanvasJS 有内置图例吗?

问题描述 投票:0回答:1

我有一个圆环图,我想在底部的图例中显示轴的名称。用小彩色框来识别轴,而不是从轴伸出的标签。这是我当前的代码:

function chart() {
    var Chart = new CanvasJS.Chart("diagramm", {
        animationEnabled: true,
        backgroundColor: "transparent",
        title: {
            test: "Übersicht",
            horizontalAlign: "left"
        },
        data: [{
            type: "doughnut",
            startAngle: 0,
            toolTipContent: "<b>{label}:</b> {y} (#percent%)",
            dataPoints: [
                { y: 9, color: "#fe5b5b"},
                { y: 3, color: "#797979"},
            ]
        }]
    })
    Chart.render();
}

我还没有发现任何内置的东西。有人知道是否有类似的东西吗?如果没有,最好的方法是什么?

提前致谢!

javascript html canvasjs
1个回答
0
投票

答案就在这里:canvasjs.com/docs/charts/basics-of-creating-html5-chart/legend

再次感谢@RoryMcCrossan!

© www.soinside.com 2019 - 2024. All rights reserved.