This is a migrated thread and some comments may be shown as answers.

setting series color in xaml

1 Answer 26 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Omer
Top achievements
Rank 1
Omer asked on 09 Feb 2012, 12:51 PM
Hi I need to set the series color - the appearence property in xaml rather than code behind Is that possible?

1 Answer, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 2
answered on 09 Feb 2012, 06:09 PM
Hi Omer,
 
           You can set series appearance declaratively in XAML like this:

<telerikChart:RadChart VerticalAlignment="Top">
          <telerikChart:RadChart.DefaultView>
              <telerikCharting:ChartDefaultView>
 
                  <telerikCharting:ChartDefaultView.ChartTitle>
                      <telerikCharting:ChartTitle Content="Year 2009" HorizontalAlignment="Center"/>
                  </telerikCharting:ChartDefaultView.ChartTitle>
 
                  <telerikCharting:ChartDefaultView.ChartLegend>
                      <telerikCharting:ChartLegend x:Name="chartLegend" UseAutoGeneratedItems="True" />
                  </telerikCharting:ChartDefaultView.ChartLegend>
 
                  <telerikCharting:ChartDefaultView.ChartArea>
                      <telerikCharting:ChartArea LegendName="chartLegend">
                          <telerikCharting:ChartArea.DataSeries>
 
                              <!-- Bar Chart -->
                              <telerikCharting:DataSeries LegendLabel="Expenses">
                                  <telerikCharting:DataSeries.Definition>
                                      <telerikCharting:BarSeriesDefinition>
                                          <telerikCharting:BarSeriesDefinition.Appearance>
                                              <telerikCharting:SeriesAppearanceSettings Fill="DodgerBlue"/>
                                          </telerikCharting:BarSeriesDefinition.Appearance>
                                      </telerikCharting:BarSeriesDefinition>
                                  </telerikCharting:DataSeries.Definition>
 
                                  <telerikCharting:DataPoint YValue="45" XCategory="Jan"/>
                                  <telerikCharting:DataPoint YValue="48" XCategory="Feb"/>
                                  <telerikCharting:DataPoint YValue="53" XCategory="Mar"/>
                                  <telerikCharting:DataPoint YValue="41" XCategory="Apr"/>
                                  <telerikCharting:DataPoint YValue="32" XCategory="May"/>
                                  <telerikCharting:DataPoint YValue="28" XCategory="Jun"/>
                                  <telerikCharting:DataPoint YValue="63" XCategory="Jul"/>
                                  <telerikCharting:DataPoint YValue="74" XCategory="Aug"/>
                                  <telerikCharting:DataPoint YValue="77" XCategory="Sep"/>
                                  <telerikCharting:DataPoint YValue="85" XCategory="Oct"/>
                                  <telerikCharting:DataPoint YValue="89" XCategory="Nov"/>
                                  <telerikCharting:DataPoint YValue="80" XCategory="Dec"/>
                              </telerikCharting:DataSeries>
                          </telerikCharting:ChartArea.DataSeries>
                      </telerikCharting:ChartArea>
                  </telerikCharting:ChartDefaultView.ChartArea>
              </telerikCharting:ChartDefaultView>
          </telerikChart:RadChart.DefaultView>
      </telerikChart:RadChart>

Hope it will help you

Regards
Rahul
Tags
Chart
Asked by
Omer
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 2
Share this question
or