using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using C1.Silverlight.Chart;

namespace ChartSamples
{
  public partial class ChartGrid : UserControl
  {
    public ChartGrid()
    {
      InitializeComponent();
      Loaded += (s, e) => LayoutRoot.Background = Background;
    }

    private void C1Chart_Loaded(object sender, RoutedEventArgs e)
    {
      C1Chart chart = (C1Chart)sender;
      chart.Data.Children.Add(new DataSeries() { Label = "s1", ValuesSource = new double[] { 3, 2, 7, 4, 8 } });

      if (chart.ChartType != ChartType.Pie)
      {
        chart.Data.Children.Add(new DataSeries() { Label = "s2", ValuesSource = new double[] { 1, 2, 3, 4, 6 } });
        chart.Data.Children.Add(new DataSeries() { Label = "s3", ValuesSource = new double[] { 0, 1, 6, 2, 3 } });
      }
      
      chart.Loaded -= new RoutedEventHandler(C1Chart_Loaded);
    }
  }
}
