vba 如何绘制这样的“带标记的线”图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5692247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to draw a "Line with Markers" graph like this?
提问by hungbm06
Please view this image (focus to red around area):
请查看此图像(焦点区域周围的红色):
回答by mousio
I cannot get it to work with the letters, but I can get it to work with numbers (=CODE(A1)-CODE("a")+1
):
我不能让它与字母一起工作,但我可以让它与数字 ( =CODE(A1)-CODE("a")+1
)一起工作:
UPDATEafter reading Jean-Fran?ois's answer (but on another computer):
UPDATE?读书让-弗朗索瓦的回答后(但另一台计算机上):
- Added a second series just for the custom labels
- Show data labels for the new series
- Explicitly set the Y axis minimum at 0
- Deleted the original X axis labels
- Deleted the legend entry of the second series
- 为自定义标签添加了第二个系列
- 显示新系列的数据标签
- 显式设置 Y 轴最小值为 0
- 删除了原来的 X 轴标签
- 删除了第二系列的图例条目
A few more steps and we're there:
再走几步,我们就到了:
- multiplied the X axis values by 10, to adjust granularity for positioning stuff
- subtracted 5 for series1 values, to get the data in the middle between major tick marks
- played with series2 values, to get the labels also in the middle between major tick marks
- 将 X 轴值乘以 10,以调整定位内容的粒度
- 为 series1 值减去 5,以获得位于主要刻度线中间的数据
- 使用 series2 值,使标签也位于主要刻度线之间的中间
回答by Jon Peltier
Here's an easier way.
这是一个更简单的方法。
Set up the data like this:
像这样设置数据:
Select the first two columns (blue) and insert a column chart (zero value columns do not appear):
选择前两列(蓝色),插入柱状图(不出现零值列):
Select and copy third and fourth columns (red), select the chart, Paste Special as new series, check first column and first row boxes (it's added as another column):
选择并复制第三和第四列(红色),选择图表,选择性粘贴为新系列,选中第一列和第一行框(它被添加为另一列):
Right click new column series, choose Change Series Chart Type, and select the XY with Lines style:
右键单击新列系列,选择更改系列图表类型,然后选择 XY with Lines 样式:
Right click XY series, choose Format Data Series, change to Primary Axis:
右键单击 XY 系列,选择格式数据系列,更改为主轴: