2015-08-26 68 views
0

我有這樣的數據,如何更改凹坑中分組條形圖的順序?

income correlation bath_math_count bath_read_count 
High Negative 3 2 
High Not significant 7 12 
High Positive 17 13 
Medium Negative 0 0 
Medium Not significant 2 3 
Medium Positive 9 8 
Low Negative 0 1 
Low Not significant 6 8 
Low Positive 19 16 

我的酒窩代碼讀取,

var svg = dimple.newSvg("#chartContainer", 590, 400); 
d3.tsv("generated_data/test.tsv", function (data) { 
    var myChart = new dimple.chart(svg, data); 
    myChart.setBounds(60, 30, 510, 330); 
    myChart.addCategoryAxis("x", ["correlation", "income"]); 
    myChart.addMeasureAxis("y", "bath_read_count"); 
    var s = myChart.addSeries("income", dimple.plot.bar); 
    // s.addOrderRule(["Low", "Medium", "High"]); 
    myChart.addLegend(65, 10, 510, 20, "right"); 

它看起來像 enter image description here

我想每個組從 「低」 安排「高」。如果我取消註釋上面註釋的那一行,那麼圖例的順序就會改變,但不會變成酒吧。 enter image description here 如何解決它?

+0

我找到解決方案。對不起,急着問問題。我不打算。 – tcya

回答