2014-04-04 29 views
0

我想在我的圖表右側顯示一個y軸:這裏是thelink如何將正確值的y軸添加到Amcharts列和線混合?

我希望Y軸顯示與「支出」值相關的鏈接,並且與正確的值不同。例如從40到80.

謝謝!

var chart = AmCharts.makeChart("chartdiv", { 
    "type": "serial", 
    "theme": "chalk", 
    "pathToImages": "/lib/3/images/", 
    "autoMargins": false, 
    "marginLeft":30, 
    "marginRight":8, 
    "marginTop":10, 
    "marginBottom":26, 

    "dataProvider": [{ 
     "year": 2009, 
     "income": 23.5, 
     "expenses": 58.1 
    }, { 
     "year": 2010, 
     "income": 26.2, 
     "expenses": 52.8 
    }, { 
     "year": 2011, 
     "income": 30.1, 
     "expenses": 53.9 
    }, { 
     "year": 2012, 
     "income": 29.5, 
     "expenses": 55.1 
    }, { 
     "year": 2013, 
     "income": 30.6, 
     "expenses": 47.2, 
     "dashLengthLine": 5 
    }, { 
     "year": 2014, 
     "income": 34.1, 
     "expenses": 49.9, 
     "dashLengthColumn": 5, 
     "alpha": 0.2, 
     "additional": "(projection)" 
    }], 
    "valueAxes": [{ 
     "axisAlpha": 0, 
     "position": "left" 
    }], 
    "startDuration": 1, 
    "graphs": [{ 
     "alphaField": "alpha", 
     "balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b> [[additional]]</span>", 
     "dashLengthField": "dashLengthColumn", 
     "fillAlphas": 1, 
     "title": "Income", 
     "type": "column", 
     "valueField": "income" 
    }, { 
     "balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b> [[additional]]</span>", 
     "bullet": "round", 
     "dashLengthField": "dashLengthLine", 
     "lineThickness": 3, 
     "bulletSize": 7, 
     "bulletBorderAlpha": 1, 
     "bulletColor": "#FFFFFF", 
     "useLineColorForBulletBorder": true, 
     "bulletBorderThickness": 3, 
     "fillAlphas": 0, 
     "lineAlpha": 1, 
     "title": "Expenses", 
     "valueField": "expenses" 
    }], 
    "categoryField": "year", 
    "categoryAxis": { 
     "gridPosition": "start", 
     "axisAlpha":0, 
     "tickLength":0 
    } 
}); 

回答

0

您需要添加一個新軸。 我在這個示例中添加了三個軸,因爲我在它讀取的CSV文件中有三列,但它應該可以處理任意數量的軸。它向左側添加一個軸,向右側添加一個軸,依此類推:

axises[n] = new amCharts.ValueAxis(); 
      axises[n].title = titles[n]; 
      if (n % 2 == 1) 
       {axises[n].position = "right";} 
      chart.addValueAxis(axises[n]); 
相關問題