我正在尝试使用 jQplot 系列的 fillToValue
属性将该系列填充到特定值。
我正在使用这个函数来创建一个系列数组:
/**
* This function populates the graphSeries array to contain the different properties of each series.
*
* @param {string} Yaxis: which Y axis to use(yaxis or y2axis)
* @param {string} Color: Color code for the graph line
* @param {string} MarkerColor: Color of the marker for each point on the graph
* @param {string} Style: Shape of the marker(star, diamond, etc)
* @param {string} Label: Text value of the series, which would appear on the legend also.
*/
function seriesCreation(Yaxis, Color, MarkerColor, Style, Label, Show){
graphSeries.push({
yaxis : Yaxis,
shadow : true,
shadowAngle: 45,
shadowOffset : 2.25,
color : Color,
label : Label,
breakOnNull : true,
markerOptions: {
show: true,
size: 12.0,
color: MarkerColor,
style: Style
},
show: true,
fill: Show,
fillToZero : true,
fillToValue : 1
});
}
如果我有一个值数组,其中没有任何 null
值,这很好用,但是如果我有一个包含 null
值的数组,那么它不会填充颜色也不画线。
示例:chartData1 工作正常但 chartData2 不工作(不填充颜色也不显示线条)
var chartData1 = [["19-Jan-2012", 2.61], ["20-Jan-2012", 5.00], ["21-Jan-2012", 6.00], ["22-Jan-2012", 3.00], ["23-Jan-2012", 8.00], ["24-Jan-2012", 1.00]];
var chartData2 = [["19-Jan-2012", null], ["20-Jan-2012", null], ["21-Jan-2012", 6.00], ["22-Jan-2012", 3.00], ["23-Jan-2012", 8.00], ["24-Jan-2012", null]];
有人知道怎么做吗?我认为这个概念可能对很多使用 jqplot
的人有用。
最佳答案
您可以在绘制图表之前进行预处理,您可以在其中将每个等于“null”的值修改为整数值:“0”。
关于javascript - 当某些 x 轴刻度为空值时如何在 Jqplot 中显示 'fillToValue',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16920559/