1

我目前正在使用 Canvas.JS 制作一些甜甜圈图表,但我无法找到设置图表厚度的正确方法。

这些文档非常广泛(您可以在这里查看它们),但我似乎无法为我的“问题”找到合适的解决方案。

现在我正在使用以下代码生成图表:

CanvasJS.addColorSet('circColors', [
  '#7583B2',
  '#E6866A'
]);

var circChartOptions = {
  animationEnabled: true,
  colorSet: 'circColors',
  data: [
    {
      labelFontColor: '#9EA4AC',
      labelFontFamily: 'Lato, sans-serif',
      labelFontWeight: 'normal',
      indexLabelLineColor: 'white',
      type: 'doughnut',
      startAngle:-90,
      toolTipContent: '{label}: {y} - <strong>#percent%</strong>',
      indexLabel: '{label} #percent%',
      dataPoints: [
        { y: 37.47, label: 'Mobile' },
        { y: 62.53, label: 'Desktop' }
      ]
    }
  ]
};

$('#circChart').CanvasJSChart(circChartOptions);

Canvas.JS 是否提供了一种控制图表粗细的方法?任何帮助将不胜感激。

谢谢!

4

2 回答 2

2
data: [
{
  labelFontColor: '#9EA4AC',
  labelFontFamily: 'Lato, sans-serif',
  labelFontWeight: 'normal',
  indexLabelLineColor: 'white',
  type: 'doughnut',
  innerRadius: "85%",
  startAngle:-90,
  toolTipContent: '{label}: {y} - <strong>#percent%</strong>',
  indexLabel: '{label} #percent%',
  dataPoints: [
    { y: 37.47, label: 'Mobile' },
    { y: 62.53, label: 'Desktop' }
  ]
}

使用 innerRadius 控制刻度

于 2016-12-15T23:27:06.457 回答
0

Looks like it's hard coded, so you'll have to change it in the canvasjs file.

var widthPercentage = 0.60;
于 2015-07-25T04:54:22.103 回答