Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当某些x轴刻度的值为空时,如何在Jqplot中“fillToValue”_Javascript_Jquery_Graph_Charts_Jqplot - Fatal编程技术网

Javascript 当某些x轴刻度的值为空时,如何在Jqplot中“fillToValue”

Javascript 当某些x轴刻度的值为空时,如何在Jqplot中“fillToValue”,javascript,jquery,graph,charts,jqplot,Javascript,Jquery,Graph,Charts,Jqplot,我试图使用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:

我试图使用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
        });
    }
如果我有一个没有任何空值的值数组,这很好,但是如果我有一个空值数组,那么它不会用颜色填充,也不会画线

示例: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。

在绘制图表之前,您可以进行预处理,将每个值等于null修改为整数值:0。

如果用户这样做,然后它会在y轴上产生一条接触0的线,“null”帮助我不画线,这样我只会在有实际数字且为null时得到一条线,它是空白的。我认为为了能够填充两条线之间的空间,jqplot需要在每条线上有相同数量的点。对于空值,chartData1比chartData2有更多的点。但我可能错了,值0和null非常不同。一行中断,通常意味着你没有价值的地方@安托尼莱科维奇,我认为你指的方向是正确的。在具有多个系列的聊天中,一个系列允许有空值,并且仍然正确呈现。也许添加第二个隐藏的伪序列是一种解决方法。如果这样做,那么它将在y轴上产生一条接触0的线,“null”帮助我不画线,这样我只在有实际数字且为null时得到一条线,它是空白的。我想为了能够填充两条线之间的空间,jqplot在每条线上需要相同数量的点数。对于空值,chartData1比chartData2有更多的点。但我可能错了,值0和null非常不同。一行中断,通常意味着你没有价值的地方@安托尼莱科维奇,我认为你指的方向是正确的。在具有多个系列的聊天中,一个系列允许有空值,并且仍然正确呈现。也许添加第二个隐藏的虚拟序列是一个解决方法。