Gráfico de área wpf com cores diferentes?
Estou meditando os gráficos do kit de ferramentas do MS e não consigo descobrir como alterar a cor das áreas. Preciso preencher o gráfico dinamicamente, o que significa que não sei antecipadamente quantas seções o gráfico de área terá.
Aqui está o código que eu tenho.
var a = new AreaSeries
{
Title = "a",
IndependentValuePath = "Key",
DependentValuePath = "Value",
Background = Brushes.Plum
};
Eu tentei mudar o Fore Ground e o Background e nenhum dado.
mcChart.Series.Add(a);
a = new AreaSeries
{
Title = "b",
IndependentValuePath = "Key",
DependentValuePath = "Value",
Background = Brushes.Peru
};
mcChart.Series.Add(a);
Preencha o gráfico.
((AreaSeries)mcChart.Series[0]).ItemsSource = new[]
{
new KeyValuePair<string, int>("1", 100),
new KeyValuePair<string, int>("2", 180),
new KeyValuePair<string, int>("3", 110),
new KeyValuePair<string, int>("4", 95),
new KeyValuePair<string, int>("5", 40),
new KeyValuePair<string, int>("6", 95)
};
((AreaSeries)mcChart.Series[1]).ItemsSource = new[]
{
new KeyValuePair<string, int>("1", 150),
new KeyValuePair<string, int>("2", 280),
new KeyValuePair<string, int>("3", 310),
new KeyValuePair<string, int>("4", 195),
new KeyValuePair<string, int>("5", 340),
new KeyValuePair<string, int>("6", 195)
};
Eu sou novo no wpf e não consigo descobrir o que há de errado nisso.
Aqui está o XAML
<chartingToolkit:Chart
Width="600" Height="450"
Name="mcChart"
Background="LightBlue"
Foreground="DarkBlue"
Title="Area Chart">
</chartingToolkit:Chart>
Como altero a cor da área ae da área b. No momento, eles são o que sempre é a cor padrão, mesmo que eu defina o plano de fundo e o primeiro plano.
Obrigado.