2012-05-23 143 views
8

是否有可能w/jqplot显示一个折线图覆盖条形图?组合线和酒吧w/jqplot

我已经添加了一系列的堆叠条形图,并将渲染器更改为$ .jqplot.LineRender。这显示为一条线,但它被添加到堆积量。

回答

17

是的,可以用jqPlot完成。

一个示例,显示如何在单个图表上显示条形图以及折线图is presented here, see the 3rd plot from the top

Here I made a sample to show line and stacked bar charts on a single plot.

+0

的jqplot网站例子看起来像我想做。谢谢!我可能是错的,但你的例子似乎有'问题'我在谈论线图的添加 – jjdebarros

+0

是的,你是对的,它似乎被添加到以前的系列,因此你可能会成功地将它与在这个例子中,'jqPlot'方法给出了第三个情节。我想,如果这是一个非常烦人的问题,你可以试着将该行的值相应设置为负值,以将其移动到想要的位置。我明天会试验它。还有(+1)有趣的问题。 – Boro

+1

我发现了一个更好的解决方案。您可以通过为其设置'disableStack:true'来禁用堆叠。现在它也被添加到代码示例中。 – Boro

0
series:[ 
       { 
        color:'#0070c0', 
        label : 'Barchart', 
        renderer:$.jqplot.BarRenderer, 
        rendererOptions: { 
          barPadding: 0, 
          barMargin: 0 
        }, 
        pointLabels: { show: true } 
       }, 
     { 
        yaxis: 'y2axis', 
        color: '#ff0000', 
        label : 'Line chart ', 
        renderer:$.jqplot.LineRenderer, 
        rendererOptions: { 
          barPadding: 0, 
          barMargin: 0 
        } 
       } 
     ] 

它将汲取线路和条形图