jqPlot - 如何更改负色
我正在使用 jqPlot 绘制一个面积图,系列默认值 fill: true, fillToZero: true
和 useNegativeColors
默认为 true
。我可以更改颜色
和fillColor
,但我没有找到如何更改线条颜色或填充颜色的方法> 低于零 x 轴线。我想要一个绿色的正值和一个红色的负值。当前负值默认为蓝色。这是 jqPlot 选项:
var chartOptions = {
title: { show: false },
axesDefaults: {
show: false,
showGridline: false,
borderWidth: 0,
showTicks: false,
showTickMarks: false,
tickOptions: {
show: false,
showLabel: false,
showMark: false,
showGridline: false
}
},
axes: {
xaxis: { min: 0, max: 10 },
yaxis: { min: -5, max: 5 }
},
seriesDefaults: {
fill: true,
fillToZero: true,
fillAndStroke: true,
color: "rgba(190,230,110, 0.8)",
fillColor: "rgba(206,236,145, 0.8)",
shadow: false,
showMarker: false,
lineWidth: 1,
rendererOptions: {
highlightMouseOver: false
}
},
legend: { show: false },
grid: {
drawGridLines: false,
background: "rgba(255,255,255,0)",
shadow: false
}
};
编辑: 添加信息:当前负值默认为蓝色
I am using jqPlot to draw an area graph with series defaults fill: true, fillToZero: true
with useNegativeColors
default to true
. I can change the color
and fillColor
but I did not find a way how to change the line color or fill color below zero x-axis line. I want a positive value with green color and a negative value red color. Currently negative value default to blue. Here is the jqPlot option:
var chartOptions = {
title: { show: false },
axesDefaults: {
show: false,
showGridline: false,
borderWidth: 0,
showTicks: false,
showTickMarks: false,
tickOptions: {
show: false,
showLabel: false,
showMark: false,
showGridline: false
}
},
axes: {
xaxis: { min: 0, max: 10 },
yaxis: { min: -5, max: 5 }
},
seriesDefaults: {
fill: true,
fillToZero: true,
fillAndStroke: true,
color: "rgba(190,230,110, 0.8)",
fillColor: "rgba(206,236,145, 0.8)",
shadow: false,
showMarker: false,
lineWidth: 1,
rendererOptions: {
highlightMouseOver: false
}
},
legend: { show: false },
grid: {
drawGridLines: false,
background: "rgba(255,255,255,0)",
shadow: false
}
};
Edit: Add info: currently negative value default to blue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚在源代码中找到了它,例如:
fillToZero 示例中提到了它: http://www.jqplot.com /tests/fillToZero.php
fillToZero 系列选项将创建一个图表,其中线条或条形朝零轴线向下或向上填充。线低于零的部分的阴影将比高于零的部分更暗。这些颜色可以使用“negativeSeriesColors”选项进行自定义。正值根据“seriesColors”选项着色。
,但文档中没有所有可用选项。
所以我像这样添加负色:
I just found it in source code some thing like:
It is mention in the fillToZero example: http://www.jqplot.com/tests/fillToZero.php
The fillToZero series option will create a chart where lines or bars are filled down or up toward the zero axis line. The portion of the line below zero will be shaded darker than the portion above zero. These colors can be customized with the "negativeSeriesColors" option. Positive values are colored according to the "seriesColors" option.
but don't have in the documentation all available options.
So I add the negative color like this: