vikas gupta

vikas gupta

  • NA
  • 22
  • 0

hOW TO BIND WPF CHARTS WITH SQL DATABASE

Feb 7 2011 8:58 AM
 
How i can bind chart with sql database,my code is that

<chartingToolkit:Chart Grid.Row="0" Grid.Column="0" DataContext="1,100 2,200 3,300 4,400" HorizontalAlignment="Center" Margin="0" Name="chart1" Title="Visits versus browser" VerticalAlignment="Top" Loaded="chart1_Loaded"  Width="400" Height="220" Background="#222222" Foreground="White" Padding="0" BorderBrush="#222222">
                    <chartingToolkit:ColumnSeries   Title="Browsers"  Background="Red" Height="250" Foreground="Black"  />
        </chartingToolkit:Chart>

 DataTable dtBrowserChart = new DataTable();
            dtBrowserChart = GetChartBrowser();
 ((ColumnSeries)chart1.Series[0]).DataContext = dtBrowserChart.DefaultView;
            ((ColumnSeries)chart1.Series[0]).DependentValuePath = "name";
            ((ColumnSeries)chart1.Series[0]).IndependentValuePath = "visitNumber";