我想在我的图表右边显示一个y轴:这是thelink!
我希望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 :(得分:0)
您需要添加新轴。 我在这个示例中添加了三个轴,因为我在它读取的CSV文件中有三列,但它应该适用于任意数量的轴。它在左侧添加一个轴,在右侧添加一个轴,依此类推:
axises[n] = new amCharts.ValueAxis();
axises[n].title = titles[n];
if ( n % 2 == 1 )
{axises[n].position = "right";}
chart.addValueAxis(axises[n]);