我可以通过调用用户传递的函数动态添加颜色。 我已经默认定义了选项变量,用户传递的颜色应该位于选项变量中。这可能吗?请帮忙
var options = {
series: {
lines: {
show: true
},
points: {
show: true
},
color: '#00c7ce'--> user should pass dynamically
},
xaxis: {
mode: "time",
tickSize: [1, "month"],
tickLength: 0,
},
yaxis: {
show: false
}
}
};
答案 0 :(得分:3)
您应该能够将颜色传递给选项。设置输入然后使用该变量作为颜色。
<input id="userInput"></input>
var usrColor = $("#userInput").val();
var options = {
series: {
lines: { show: true},
points: {show: true, radius: 4},
color: usrColor
}
};