anychart.theme(anychart.themes.darkEarth);
anychart.onDocumentReady(function(){
var dataSet = anychart.data.set([
['P1', 969.5, 2040, 1200, 1600,2000],
['P2', 779.1, 1794, 1124, 1724,4000],
['P3', 739.2, 2026, 1006, 1806,5000]
]);
var seriesData_1 = dataSet.mapAs({x: [0], value: [1]});
var seriesData_2 = dataSet.mapAs({x: [0], value: [2]});
var seriesData_3 = dataSet.mapAs({x: [0], value: [3]});
var seriesData_4 = dataSet.mapAs({x: [0], value: [4]});
var seriesData_5 = dataSet.mapAs({x: [0], value: [5]});
chart = anychart.column();
chart.animation(true);
chart.container('container');
chart.title('Combination of Stacked Column and Line Chart (Dual Y-Axis)');
var scale = anychart.scales.linear();
scale.stackMode('value');
chart.column(seriesData_2);
var lineSeries = chart.area(seriesData_1);
lineSeries.yScale(scale);
var lineSeries2 = chart.area(seriesData_5);
lineSeries2.yScale(scale);
chart.column(seriesData_3);
chart.column(seriesData_4);
chart.draw();
});
我正在尝试添加带有堆积区域的系列柱形图。 但是系列列和堆积区域应该具有不同的比例,以使它们与堆叠分离。 如何将这两个Scales集成到Yaxis中。 有没有这样做?请建议!!
答案 0 :(得分:1)
我认为您可以使用图表左侧或右侧的附加轴。
左轴示例:
var secondYAxis = chart.yAxis(1).scale(scale);
http://jsfiddle.net/cgquc1pz/1/
右轴示例:
var secondYAxis = chart.yAxis(1).scale(scale);
secondYAxis.orientation('right');