首页 > 解决方案 > 在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
});

标签: chart.jschartjs-2.6.0

解决方案


在您的数据集对象中将 backgroundColor 设置为您想要的颜色,这将解决它

datasets: [
  {
    data: []
    backgroundColor: color
  }
]

编辑:我的错误背景颜色是较低的 g 而不是大写的


推荐阅读