如何更改组合图表上的y轴刻度? 我有一个带有第二个折线图的Stacked Bar。我希望堆叠的条形y轴位于左侧,而第二条折线图则使标尺位于右侧。所以这将是两个y轴的交换。
这是我的图表:
chart1 = BarChart()
chart1.type = "col"
chart1.style = 12
chart1.grouping = "stacked"
chart1.overlap = 100
chart1.layout = Layout(
ManualLayout(
x=0.12, y=0.25,
h=0.9, w=0.75,
xMode="edge",
yMode="edge",
)
)
...
chart2 = LineChart()
chart2.style = 12
chart2.y_axis.axId = 0
...
chart1.y_axis.crosses = "max"
chart1 += chart2
WorkSheetOne.add_chart(chart1, 'A1')
答案 0 :(得分:2)
已在评论中解决:
Best bet is to change the order of the charts. The logic for this is hard-coded in the library and difficult to change due to the XML. – Charlie Clark
我尝试用以下方式更改订单:
chart1.y_axis.crosses = "max" chart2 += chart1 WorkSheetOne.add_chart(chart2, 'A1')
但在我改变之前,这并没有奏效:
chart2.y_axis.crosses = "max"
我还必须更改:
chart2.title
,因为chart1.title
现在已被忽略。完善!谢谢!! - 马修考克斯