更改 WPFToolkit 图表控件的默认颜色
有谁知道如何在使用 WPFToolkit 图表控件时显式设置数据点系列的颜色或找到任何好的示例?我想将其设置为 XAML 中的样式。
Does anyone know how to or found any good examples of explicitly setting the color of the data points series when using the WPFToolkit chart control? I would like to set this as a style in my XAML.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在图表上设置调色板。此示例适用于 ColumnSeries,但您可以根据您使用的任何类型进行调整。
调色板定义如下所示:
“ColumnSeries1Style”和“ColumnSeries1Style”样式定义系列的背景画笔:
您可以根据需要定义画笔。以下是如何获取默认图表中使用的渐变填充:
You can set the Palette on the Chart. This example is for a ColumnSeries, but you can adapt it for whatever type you are using.
The Palette definition looks like this:
The "ColumnSeries1Style" and "ColumnSeries1Style" styles define the background brush for the series:
You can define the brushes however you like. Here is how to get the gradient fill used in the default charts:
以防万一有人感兴趣,有一种更简单的方法。您只需在 ColumnSeries 中设置 DataPointStyle 并更改 Background 属性即可。
Just in case anybody is interested, there is a simpler way of doing it. You just need to set the DataPointStyle in the ColumnSeries and change the Background property.