我已经准备了一个图表,其中堆积柱形图结合线图。现在堆积图的即在valueaxis合计值应该是对层叠柱。但合计值表示在线路图。如果没有线图是完美的。 但随着线图的总价值上升。 这里是我的代码
$scope.chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "none",
"legend": {
"position": "top",
"useGraphSettings": true,
"align": "center"
},
"dataProvider": $scope.monthly_chart_data,
"valueAxes": [{
"stackType": "regular",
"axisAlpha": 0.3,
"gridAlpha": 0,
"totalText": "[[total]]"
}],
"graphs": [{
"balloonText": "<span style='font-size:14px'><b>[[value]]</b></span>",
"fillAlphas": 0.8,
"lineAlpha": 0.0,
"title": "Betrag",
"type": "column",
"color": "#000000",
"valueField": "Rechnung",
"fillColors": "#003d6a"
}, {
"balloonText": "<span style='font-size:14px'><b>[[value]]</b></span>",
"fillAlphas": 0.8,
"lineAlpha": 0.0,
"title": "Bestellung",
"type": "column",
"color": "#000000",
"valueField": "Bestellung",
"fillColors": "#8673a4"
}, {
"id": "graph2",
"lineThickness": 1.5,
"fillAlphas": 0,
"lineAlpha": 1,
"lineColor": "#e95f30",
"title": "Budget",
"valueField": "Budget",
"dashLengthField": "dashLengthLine",
"stackable": false
}],
"categoryField": "month",
"categoryAxis": {
"gridPosition": "start",
"axisAlpha": 0,
"gridAlpha": 0,
"position": "left"
},
"numberFormatter" : {
"precision": -1,
"decimalSeparator": ",",
"thousandsSeparator": "."
}
});
如何把总价值即超过valueaxis堆叠列,但低于线图?任何帮助,将不胜感激。提前致谢。
您的线路轴线被添加到相同的堆栈; stacked
适用于整个值轴和所有图相关联的,不只是特定图形或类型,所以该线还包括在所述叠层和总计。如果你不想被包含在堆栈和总计行做的,只是把它分配给不同的值轴。
"synchronizeGrid": true, //optional if you want both axes to have the same scale. Doesn't always work, though.
"valueAxes": [{
"stackType": "regular",
"axisAlpha": 0.3,
"gridAlpha": 0,
"totalText": "[[total]]"
},{
"id": "valueAxis2", //create second axis for the line graph
"axisAlpha": 0,
"position": "right",
"gridAlpha": 0
}],
"graphs": [
// ...
{
"id": "graph2",
"valueAxis": "valueAxis2", //assign line graph to valueAxis2
"lineThickness": 1.5,
"fillAlphas": 0,
"lineAlpha": 1,
"lineColor": "#e95f30",
"title": "Budget",
"valueField": "Budget",
"dashLengthField": "dashLengthLine",
"stackable": false
}]