在
API不提供一种方式来exclude点颜色,如果是auto-generated
我认为您可以轻松编辑jquery.colorhelpers.js文件并注释/删除auto-colors不需要的文件。
例如(未经测试)
var lookupColors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
// blue:[0,0,255], // --> no blue
brown:[165,42,42],
cyan:[0,255,255],
...
};
Run Code Online (Sandbox Code Playgroud)
编辑:
如果您不手动添加jquery.colorhelpers.js文件,请注意第jquery.flot.js8行文件中的作者注释:
8: // first an inline dependency, jquery.colorhelpers.js, we inline it here
9: // for convenience
Run Code Online (Sandbox Code Playgroud)
内联代码在第32行:
32: (function($){$.color={};$.color.make=...
Run Code Online (Sandbox Code Playgroud)
编辑2:
重要说明
在阅读了一下文件中的代码和作者的注释后jquery.flot.js,我意识到上面的建议是完全错误的lookupColors。var用于将given具有相应RGB值的颜色名称进行匹配...
与自动生成的颜色无关图表。
现在...在同一阅读中,我发现了该color theme声明jquery.flot.js第516行
516: // the color theme used for graphs
517: colors: ["#edc240", "#afd8f8", "#cb4b4b", "#4da74d", "#9440ed"],
Run Code Online (Sandbox Code Playgroud)
猜猜是什么...如果您修改它..将更改图表,所以我认为这将是您的最佳方法。
例:
colors: [
// "#edc240", // --> this removes/disabled the dark-yellow
"#afd8f8",
"#cb4b4b",
"#4da74d",
"#9440ed"
],
Run Code Online (Sandbox Code Playgroud)
因此,现在,您不仅可以设置exclude某种颜色,还可以创建自己的颜色theme。
很好;)
jsFiddle示例:http : //jsfiddle.net/gmolop/9u8tsfum/