如何配置柱形图的颜色?
我正在寻找一种自定义柱形图的方法。 Open Office 和 Excel 为值为 1、2、3、3、2 的列生成以下图表。但是,我想生成具有以下属性的图表。
- 该图表应有五个条形。
- 所有条形的高度必须相同。
- 图表应根据条形的值为其着色。在此示例中,图表应使用三种颜色,因为存在三个不同的值。
如果您知道任何其他可以自动生成此类图表的软件包,我很乐意尝试一下。
I'm looking for a way to customize a column chart. Open office and Excel produce the following chart for a column with values 1, 2, 3, 3, 2. But, I'd like to generate a chart with the following properties.
- The chart should have five bars.
- All bars must be of the same height.
- The chart should color bars based on their values. In this example, the chart should use three colors because there are three different values.
If you know of any other software package that can automatically generate such a chart, I'd be glad to try it out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Excel 中,您无法通过简单的步骤来完成此操作。 Excel 中唯一的选项是手动更改每列的颜色或按点更改颜色,如您所见 此处。我认为通过 VBA 代码您可以到达那里。
我建议使用 Microsoft ASP.NET 内置图表控件。它会给你很多定制的可能性。我会尝试发布一个工作示例。
编辑:
刚刚设法获得一个工作示例:
这是 aspx 页面代码:
这是我实现的代码隐藏代码 - 不是防弹,因为它需要更多测试...
这是结果图表:
替代文本 http://www.freeimagehosting.net/uploads/22d240b0e0.png
In Excel you can not do this in simple steps. The only options you have in Excel is to change the color of each column manually or vary the color by point as you can see here. I think that through VBA code you can get there.
I'd recommend the use of Microsoft ASP.NET built-in chart control. It'll give you lots of customization possibilities. I'll try to post a working sample.
Edit:
Just managed to get a working sample:
This is the aspx page code:
This is the code-behind code I implemented - not bullet proof because it needs more testing...
This is the resulting chart:
alt text http://www.freeimagehosting.net/uploads/22d240b0e0.png