Javascript 在 ChartJS LineGraph 中隐藏点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35073734/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hide points in ChartJS LineGraph
提问by Dan
Originally I set the fill color for each point to be completely transparent. If I run my mouse over the graph, the points pop up. I want to hide all points so that the line graph is smooth.
最初我将每个点的填充颜色设置为完全透明。如果我将鼠标移到图形上,点会弹出。我想隐藏所有点,以便折线图平滑。
回答by Shivam
You can achieve this by setting point's radius property in configuration options as follows:
您可以通过在配置选项中设置点的半径属性来实现这一点,如下所示:
var chartConfig = {
type: 'line',
options: {
elements: {
point:{
radius: 0
}
}
}
}
Tooltips for the points will also gone off.
积分的工具提示也将消失。
回答by Alexander
You can set the pointRadius
to zero.
您可以将 设置pointRadius
为零。
var myChart = new Chart(
ctx, {
type: 'line',
data: {
labels: [...]
datasets: [
{
data: [...],
pointRadius: 0, # <<< Here.
}
]
},
options: {}
})