在jqplot中显示组图表

时间:2016-05-21 08:39:30

标签: javascript jquery graph jqplot

如何在jqplot中显示刻度线的总和。我希望将每个月的值显示为该行中顶部的总和,如下图所示。

enter image description here

启动fiddler http://jsfiddle.net/bywfc5xx/1/

`var s1 = [200, 600, 700, 1000];
var s2 = [460, 210, 690, 820];
var s3 = [260, 440, 320, 200];
// Can specify a custom tick Array.
// Ticks should match up one for each y value (category) in the series.
var ticks = ['May', 'June', 'July', 'August'];`

请帮助。

1 个答案:

答案 0 :(得分:3)

我不明白你要做的是什么,要有总用途:

var total = [s1[0] + s2[0] + s3[0], s1[1] + s2[1] + s3[1], s1[2] + s2[2] + s3[2], s1[3] + s2[3] + s3[3]];

var plot1 = $.jqplot('chart1', [s1, s2, s3, total], {..

实施: http://jsfiddle.net/e4zasp6L/

好的,明白了,这是更新的答案:http://jsfiddle.net/282tkr12/

series:[
        {
              label:'Total',
              color: 'blue' ,
              renderer: $.jqplot.BarRenderer,
              rendererOptions: { 
                  barWidth:80,
                  shadowAlpha: 0,
                  barPadding: -86,
              }
            },
            {label:'Hotel'},
            {label:'Event Registration'},
            {label:'Airfare'}                
        ]