获取Excel图表线的delphi颜色值
当 Excel 在图表上绘制线条时,它会为每个数据系列的迹线指定默认颜色。第一个为黑色,第二个为青色,等等。这些颜色的分配是否有记录?我想使用 Delphi 在图表上绘制轨迹,但希望保持颜色与 Excel 使用的颜色相同(Delphi 应用程序正在替换当前使用 Excel 工作簿完成的内容)。
When Excel draws lines on a chart, it assigns default colors to the traces for each data series. Black for the first, cyan for the second, etc. Is the assignment of these colors documented? I want to draw traces on a graph using Delphi but want to keep the colors the same as Excel would use (the Delphi app is replacing stuff currently done with Excel workbooks).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“图表填充”和“图表线条”默认颜色可从菜单访问:工具 ->选项->颜色(至少当 Excel 有菜单时 - 我不知道新版本)。每个工作簿都可以更改默认颜色,因此它们是工作簿的属性。 “颜色”选项页上共有 56 种颜色,其中 8 种属于图表填充颜色,8 种属于图表线条颜色。
如果您正在进行自动化,则可以通过以下方式检索工作簿默认颜色:
其中“XL”是 Excel 应用程序,“1”是工作簿索引,“索引”是 1 到 56 之间的数字。使用早期的 Excel 进行一些测试版本显示索引 17-24 是填充颜色,25-32 是线条颜色。但你会自己进行测试,以防发生变化。
顺便说一句,我对 Delphi 覆盖默认颜色的问题感到惊讶。
'Chart fill' and 'chart line' default colors are accessible from the menu: Tools -> Options -> Colors (at least when excel had a menu - I don't know about newer versions). Default colors can be changed per workbook and hence they're a property of the workbook. There are 56 colors in total on the 'Color' option page, with 8 of them belonging to chart fills and 8 to chart lines.
If you're doing automation you can retrieve a workbook default color by:
where 'XL' is the excel application, '1' is the workbook index and 'Index' is a number between 1 and 56. A little test with an earlier excel version shows index 17-24 are fill colors and 25-32 are line colors. But you do your own tests in case there has been changes.
BTW, I am surprised about your problem that Delphi overriding default colors..