Why does jqplot behave this way?

I have a chart that consists of 4 series. Three of the four are stacked bar charts and the forth is a line. Why is the graph acting this way? I assumed that it didn’t matter in what order I passed in the series to the $.jqPlot function. I thought you would be able to adjust your series by using the series property and just giving an empty object for ones you didn’t want to adjust.

scoreArray is the series I want to be a line chart that I want overlayed over the bars. My first attempt was with this code:

$.jqplot("HistoryChart",
    [scoreArray, AvailableArray, UnavailableArray, UnknownArray], {
        stackSeries: true,
        seriesDefaults : {
            renderer: $.jqplot.BarRenderer,
            rendererOptions : {
                barWidth: 40
            }
        },
        series : [{
            disableStack : true,
            renderer: $.jqplot.LineRenderer
        }, {}, {}, {}],
        axesDefaults : {
            tickRenderer: $.jqplot.CanvasAxisTickRenderer,
            tickOptions: {
                angle: -45
            }
        },
        axes: {
            xaxis : {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: dateArray
            }
        }
    }
);

This is the generated graph:

Now if I made scoreArray the last series and adjusted the series property accordingly, it looks correct. Here is the code and graph:

$.jqplot("HistoryChart",
    [AvailableArray, UnavailableArray, UnknownArray, scoreArray], {
        stackSeries: true,
        seriesDefaults : {
            renderer: $.jqplot.BarRenderer,
            rendererOptions : {
                barWidth: 40
            }
        },
        series : [{}, {}, {}, {
            disableStack : true,
            renderer: $.jqplot.LineRenderer
        }],
        axesDefaults : {
            tickRenderer: $.jqplot.CanvasAxisTickRenderer,
            tickOptions: {
                angle: -45
            }
        },
        axes: {
            xaxis : {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: dateArray
            }
        }
    }
);

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Why does jqplot behave this way?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录