chart.js - 在Chartjs中为指针填充颜色
问题描述
我正在使用散点图。将鼠标悬停在某个点上时,表示该点颜色的框未填充
我需要用线条的颜色填充它,而不仅仅是颜色的边框。
这是我的数据集:
this.ScatterChart.data.datasets.push({
label: this.label,
data: this.Axiscoordinates,
fill: false,
lineTension: 0.1,
borderColor: SetColor,
color: SetColor,
backGroundColor: SetColor,
borderWidth: 1,
yAxisID: this.yAxisUnit,
showLine: true
});
解决方案
在您的数据集对象中将 backgroundColor 设置为您想要的颜色,这将解决它
datasets: [
{
data: []
backgroundColor: color
}
]
编辑:我的错误背景颜色是较低的 g 而不是大写的
推荐阅读
- c - 移动类型宽度时右移不一致的行为(与 K&R 练习 2-06 相关)
- c# - 具有进程内托管的 Dotnet Core 多个启动类
- sql - update 语句不断更新所有行 :( , 'OR' 关系?
- php - 通过键名获取项目计数
- file-io - cypher/neo4j 中的文件 IO,或通过其他语言集成
- javascript - JavaScript:为 jquery ajax 重试添加延迟
- ruby-on-rails - Ruby 默认参数:静态还是动态?
- c# - 使用托管服务帐户将文件从 IIS 写入网络驱动器
- c# - 使用具有不同层的 LINQ 意味着我无法访问特定类型
- python - aws lambda 逐行读取并写入文件