简体   繁体   English

WPF饼图调色板禁用随机笔刷再生

[英]WPF Pie chart palette disable random brushes regeneration

I have a pie chart, every time I update ( Re-assign to a new collection ) my itemssource the colors changes randomly , All I Want is to keep the first palette. 我有一个饼图,每次更新( 重新分配到一个新集合 )时,我的itemssource的颜色都会随机变化,我想要保留的是第一个调色板。

the pie chart is from System.Windows.Controls.DataVisualization.Charting from the assembly System.Windows.Controls.DataVisualization.ToolKit 饼图来自System.Windows.Controls.DataVisualization.ChartingSystem.Windows.Controls.DataVisualization.ToolKit

A quick research shows me that the System.Windows.Controls.DataVisualization.ChartingChart.Chart has a Property Palette which stores by default 15 different ResourceDictionary each section of the PieChart will use the next Colors (or Styles or whatever is strored in the Dictionary). 快速研究表明, System.Windows.Controls.DataVisualization.ChartingChart.Chart具有一个属性Palette ,默认情况下存储15个不同的ResourceDictionary PieChart的每个部分将使用下一个颜色(或样式或在字典中存储的任何内容) 。 If you want to keep the same Color you could add (15 - n) sections where n is the number of sections that was displayed. 如果要保持相同的颜色,可以添加(15-n)个部分,其中n是显示的部分数量。 And then Change the Itemssource to whatever you want. 然后将Itemssource更改为您想要的任何内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM