当点为负时,我需要更改Line Chart.js中的填充颜色(内部区域).
代码简单而基本:
$(document).ready(function(){
var ctx = $("#myChart").get(0).getContext("2d");
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
//fillColor : "rgba(60,91,87,1)",
// String - the color to fill the area under the line with if fill is true
backgroundColor: "rgba(75,192,192,0.4)",
strokeColor : "rgba(60,91,87,1)",
pointColor : "rgba(60,91,87,1)",
pointStrokeColor : "#58606d",
// The actual data
data: [65, 59, 80, -81, 56, 55, -40],
// String - If specified, binds the dataset to a …Run Code Online (Sandbox Code Playgroud) 让我说我有一个与周一4周的折线图.我希望这4周分为几个部分.我希望星期一的第一个星期一有白色背景颜色.星期五的第二个星期一灰色背景.再次出现白色bg.星期一到星期五的第四周有一个灰色的背景色.我所说的是图表的背景.有没有办法做到这一点?