void BuildLegendCore(Telerik.WinControls.UI.ChartView view)
 {
     layout.Children.Clear();
     if (view.AreaType == ChartAreaType.Cartesian)
     {
         foreach (Telerik.WinControls.UI.ChartSeries series in view.Series)
         {
             Color color;
             if (series is LineSeries)
             {
                 color = series.BorderColor;
             }
             else
             {
                 color = series.Children[0].BackColor;
             }
             layout.Children.Add(new LegendItemElement(series.Name, color));
         }
     }
     if (view.AreaType == ChartAreaType.Pie && view.Series.Count > 0)
     {
         for (int i = 0; i < view.Series[0].DataPoints.Count; i++)
         {
             Color        color = view.Series[0].Children[i].BackColor;
             PieDataPoint point = view.Series[0].DataPoints[i] as PieDataPoint;
             layout.Children.Add(new LegendItemElement(point.Name, color));
         }
     }
 }
 public void BuildLegend(RadChartElement element)
 {
     Telerik.WinControls.UI.ChartView view = element.View;
     BuildLegendCore(view);
 }
Esempio n. 3
0
 private void FillColors(Telerik.WinControls.UI.ChartView view, ChartPalette pallete)
 {
     view.Palette = null;
     view.Palette = pallete;
 }