首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ChartJS雷达图雷达线颜色?

ChartJS雷达图雷达线颜色?
EN

Stack Overflow用户
提问于 2020-03-21 22:48:37
回答 2查看 1.1K关注 0票数 5

所以我一直在研究这个问题,但还没有找到解决方案,我想改变雷达线的颜色,如下所示:

有没有办法做到这一点?

下面是我当前的代码:

代码语言:javascript
复制
new Chart(document.getElementById("result_chart"), {
    "type": "radar",
    "data": {
        "labels": ["Idea", "Timing", "Skills", "Concept", "Market Plan", "MVP", "Revenue Potential", "Competition", "Team", "BMC", "Financial Model"],
        "datasets": [{
            "label": "Your Results",
            "data": [
              10,
              20,
              30,
              40,
              50,
              60,
              70,
              80,
              90,
              100,
              110
            ],
            "fill": true,
            "backgroundColor": "rgba(165, 211, 164, 0.2)",
            "borderColor": "rgb(165, 211, 164)",
            "pointBackgroundColor": "rgb(165, 211, 164)",
            "pointBorderColor": "#fff",
            "pointHoverBackgroundColor": "#fff",
            "pointHoverBorderColor": "rgb(255, 99, 132)"
        }]
    },
    "options": {
        "elements": {
            "line": {
                "tension": 0,
                "borderWidth": 3
            }
        }
    }
});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-03-21 23:20:29

通过将这些道具添加到图表的scale规范中,您可以轻松地完成此操作:

代码语言:javascript
复制
scale: {
      gridLines: {
        color: 'red'
      },
      angleLines: {
        color: 'red'
      }
    },

视觉输出将是您请求的输出

希望这能有所帮助!:)

票数 4
EN

Stack Overflow用户

发布于 2021-09-15 09:43:06

该库的配置似乎已更改,现在应该如下所示:

代码语言:javascript
复制
...
scales: {
          r: {
            grid: {
              color: "lightgreen",
            },
          }
}        
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60789217

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档