javascript - 不同颜色的chartjs折线图点
问题描述
我正在为 angularjs 使用 chartjs 图,我担心的是折线图上的点我需要根据数据范围为它们赋予不同的颜色。谁能帮助我如何改变fillcolor属性
function drawChart(placeholder, values1, labels1) {
var plot = $.plot(placeholder,
[{
data: values1,
label: label1,
lines: {
show: true,
lineWidth: 2,
fill: true,
},
points: {
show: true,
lineWidth: 3,
fill: true,
fillColor: '#fafafa'
}
},
});
解决方案
我没有足够的细节来知道您的问题是否来自那里,但您的代码语法不正确。
你应该有 :
function drawChart(placeholder, values1, labels1) {
var plot = $.plot(placeholder,
[{
data: values1,
label: label1,
lines: {
show: true,
lineWidth: 2,
fill: true,
},
points: {
show: true,
lineWidth: 3,
fill: true,
fillColor: '#fafafa'
}
}]
});
}
推荐阅读
- ruby-on-rails - 无法启动 rails 服务器。Rails::Secrets::MissingKeyError
- node.js - 在 Express 路由的 Mocha 单元测试中使用 Sinon 存根环境变量
- powershell - Powershell SmtpClient 发送邮件 - 在某些机器上被阻止?
- reactjs - What's the difference between `yarn add react-router-dom` and `yarn add @types/react-router-dom`?
- pine-script - 在研究和策略之间发送/交流变量
- c++ - C++ SFML 加载图片失败,原因:无法打开文件
- c++ - std::unique_ptr reset() 操作顺序
- python - 使用带有 Tensorflow 的 Iris 数据集的值误差和维度问题
- laravel - 如何强制我的应用使用 Goutte 而不是 Symfony?
- r - github 操作中的 Spotify 身份验证