excel - Excel - 在拆分图表第二轴上强制显示 0
问题描述
我正在制作一些图表来表示汽车生产的一些成本的演变。它基于一些成本估算文件,一切都是通过简单的点击生成的。我的问题是显示辅助轴的“0”值...
如您所见,没有表示辅助轴的 0 值...如何强制显示?
这是创建图表的代码部分:
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'creating main graph
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'Application.EnableEvents = False
ActiveSheet.Range("A1").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.Parent.Name = ActiveSheet.Name & " Cumul Chart"
'define the size of the chart
With ActiveSheet.Shapes(ActiveSheet.Name & " Cumul Chart")
.Top = Range("B15").Top
.Left = Range("B15").Left
.Height = Range("P15:P45").Height
.Width = Range("B37:P45").Width
End With
'creating the 4 series
'Cumul Nb Cars
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "='" & ActiveSheet.Name & "'!$B$9"
ActiveChart.SeriesCollection(1).Values = "='" & ActiveSheet.Name & "'!$C$9:$N$9"
ActiveChart.SeriesCollection(1).XValues = "='" & ActiveSheet.Name & "'!$C$3:$N$3"
'Cumul est Nb Cars
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Name = "='" & ActiveSheet.Name & "'!$B$10"
ActiveChart.SeriesCollection(2).Values = "='" & ActiveSheet.Name & "'!$C$10:$N$10"
ActiveChart.SeriesCollection(2).XValues = "='" & ActiveSheet.Name & "'!$C$3:$N$3"
'Cumul price
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Name = "='" & ActiveSheet.Name & "'!$B$11"
ActiveChart.SeriesCollection(3).Values = "='" & ActiveSheet.Name & "'!$C$11:$N$11"
ActiveChart.SeriesCollection(3).XValues = "='" & ActiveSheet.Name & "'!$C$3:$N$3"
'Cumul est price
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).Name = "='" & ActiveSheet.Name & "'!$B$12"
ActiveChart.SeriesCollection(4).Values = "='" & ActiveSheet.Name & "'!$C$12:$N$12"
ActiveChart.SeriesCollection(4).XValues = "='" & ActiveSheet.Name & "'!$C$3:$N$3"
'changing the 2 series to the second axis
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).AxisGroup = 2
ActiveChart.SeriesCollection(4).Select
ActiveChart.SeriesCollection(4).AxisGroup = 2
'Changing the axis max and min values to have the data visibles
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.Axes(xlValue, xlSecondary).MinimumScale = -1 * (ActiveChart.Axes(xlValue, xlSecondary).MaximumScale + 0.1 * WorksheetFunction.Max(Range("n10").Value, Range("N12").Value))
ActiveChart.Axes(xlValue, xlSecondary).MaximumScale = Round(((ActiveChart.Axes(xlValue, xlSecondary).MaximumScale + 0.1 * WorksheetFunction.Max(Range("n10").Value, Range("N12").Value))) / 1000, 0) * 1000
Selection.TickLabels.NumberFormat = "0;;0" 'I guess this will have to be modified?
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MaximumScale = 2 * ActiveChart.Axes(xlValue).MaximumScale + 20
ActiveChart.Axes(xlValue).MinimumScale = 0
Selection.TickLabels.NumberFormat = "[<301];"
ActiveChart.SetElement (msoElementDataTableWithLegendKeys)
'then, there is some formatting, colours, title etc
那么,是不是可以强制两边都显示0呢?
提前致谢
解决方案
推荐阅读
- heroku - 如何使用免费测功机在 Heroku 上保持 App 唤醒
- docker - Kubernetes 中的 Angular 无法提取图像
- python-2.7 - 无法验证 Twitch EventSub 签名
- google-analytics-4 - 更改 Google Analytics 4 中的默认 URL
- flutter - 颤振使用syncfusion创建pdf
- excel - BI Publisher 预览后所有布尔值均为 FALSE
- django - 如何从视图而不是模板分配外键值并保存到Django中的数据库中
- c# - 如何在 C# 中使用 WMI 事件检测 USB 摄像头断开连接?
- javascript - Rails 6 - 如何在 js.erb 文件中引用 javascript 文件变量?
- javascript - Math.sqrt() 缩写 javascript