setting series color in xaml

2 posts, 0 answers
  1. Omer
    Omer avatar
    5 posts
    Member since:
    Feb 2012

    Posted 09 Feb 2012 Link to this post

    Hi I need to set the series color - the appearence property in xaml rather than code behind Is that possible?
  2. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 09 Feb 2012 Link to this post

    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
  3. DevCraft banner
Back to Top