gpt4 book ai didi

javascript - Amcharts 带折线图的堆积柱形图将值轴置于折线图下方

转载 作者:行者123 更新时间:2023-12-03 00:15:43 25 4
gpt4 key购买 nike

我准备了一个图表,其中堆积柱形图与折线图相结合。现在堆积图的总值(value),即值(value)轴应该位于堆积柱上。但总值(value)显示在折线图上。没有折线图就完美了。 enter image description here但使用折线图时,总值(value)会上升。 enter image description here这是我的代码

$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": "."
}
});

如何将总值(即值轴)放在堆积柱上方但折线图下方?任何帮助,将不胜感激。提前致谢。

最佳答案

您的线轴正在添加到同一堆栈中; 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
}]

关于javascript - Amcharts 带折线图的堆积柱形图将值轴置于折线图下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54527889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com