2013-02-22 24 views
2

我使用海军报库显示条形图与海军报JS按类别分组的多个条形图和我这样需要按一定的价值:如何绘制

| 
|   +----+  +----+  
|   | |  | |  
|   | |  | |  
|   | |  | |  
| +----+ | |  | |  
| | | | |  | |  
| | | | |  | |  
| | | | |  | |  
|-+----+---+----+--------+----+---- 
    val 1 val2   val3 
    category #1  category #2 

感谢谢尔盖·G.为Ascii :)

我有变量d1,d2,d3分别为条1,2和3的值(按类别排序)。 现在的问题是: 如何添加滴答下面的类别? 对不起,我的糟糕的“谷歌翻译”英语,非常感谢!

代码:

$.plot(
    $("#placeholder"), 
    [ 

      { 
     label: labelChart, 
     data: d1, 
     color: '#92d5ea', 
     bars: { 
      show: true, 
      barWidth: 0.5, 
      align: "center", 
      order:2 
     }, 

     multiplebars:true 
    }, 
    { 
     label: labelChart, 
     data: d2, 
     color: '#92d5ea', 
     bars: { 
      show: true, 
      barWidth: 0.5, 
      align: "center", 
      order:3 
     }, 

     multiplebars:true 
    }, 
    { 
     label: labelChart, 
     data: d3, 
     color: '#92d5ea', 
     bars: { 
      show: true, 
      barWidth: 0.5, 
      align: "center", 
      order:3 
     }, 

     multiplebars:true 
    } 


    ], 
    { 
     xaxis: { 
      ticks: ticksData 
     }, 

     yaxis: { 
      min:0 
     } 
    } 
); 
+1

这为我工作:http://www.pikemere.co.uk/blog/tutorial-flot-how-to-create-bar-charts/ – 2014-08-24 21:15:30

回答

-4

使用类插件,如this example证明。

+1

对不起,我不得不downvote,因为这并没有回答这个问题。在这个例子中,每个类别给出一个值。但问题是如何使用类别并列绘制多个系列图,大概是并排的。 – 2013-11-08 14:51:13

+0

@DerekHenderson你是对的;我显然误解了这个问题。删除我的答案。 – DNS 2013-11-14 03:32:19

+2

这对我有效:http://www.pikemere.co.uk/blog/tutorial-flot-how-to-create-bar-charts/ – 2014-08-24 21:14:58