Note that there are some explanatory texts on larger screens.

plurals
  1. POwpf Area Chart with Different Colors?
    primarykey
    data
    text
    <p>I a musing the MS toolkit charts and cannot figure out how to change the color of the areas. I need to populate the chart dynamically which means I do not know ahead of time how many sections the area chart will have.</p> <p>Here is the code I have.</p> <pre><code>var a = new AreaSeries { Title = "a", IndependentValuePath = "Key", DependentValuePath = "Value", Background = Brushes.Plum }; </code></pre> <p>I have tried to change both the Fore Ground and Background and no dice.</p> <pre><code>mcChart.Series.Add(a); a = new AreaSeries { Title = "b", IndependentValuePath = "Key", DependentValuePath = "Value", Background = Brushes.Peru }; mcChart.Series.Add(a); </code></pre> <p>Fill the chart.</p> <pre><code>((AreaSeries)mcChart.Series[0]).ItemsSource = new[] { new KeyValuePair&lt;string, int&gt;("1", 100), new KeyValuePair&lt;string, int&gt;("2", 180), new KeyValuePair&lt;string, int&gt;("3", 110), new KeyValuePair&lt;string, int&gt;("4", 95), new KeyValuePair&lt;string, int&gt;("5", 40), new KeyValuePair&lt;string, int&gt;("6", 95) }; ((AreaSeries)mcChart.Series[1]).ItemsSource = new[] { new KeyValuePair&lt;string, int&gt;("1", 150), new KeyValuePair&lt;string, int&gt;("2", 280), new KeyValuePair&lt;string, int&gt;("3", 310), new KeyValuePair&lt;string, int&gt;("4", 195), new KeyValuePair&lt;string, int&gt;("5", 340), new KeyValuePair&lt;string, int&gt;("6", 195) }; </code></pre> <p>I am new to wpf and I cannot figure out what is wrong with this.</p> <p>Here is the XAML</p> <pre><code>&lt;chartingToolkit:Chart Width="600" Height="450" Name="mcChart" Background="LightBlue" Foreground="DarkBlue" Title="Area Chart"&gt; &lt;/chartingToolkit:Chart&gt; </code></pre> <p>How do I change the color of area a and area b. Right now they are what ever color is default even though I set the background and foreground.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload