TAN WhoAMI

TAN WhoAMI

  • NA
  • 291
  • 0

Loop through to show values in a Chart

Mar 3 2015 10:29 PM
with this, I have no problem showing the Chart.

 private void LoadColumnChartData()
        {
            ((ColumnSeries)mcChart.Series[0]).ItemsSource =
                new KeyValuePair<string, int>[]
                {
                    new KeyValuePair<string,int>("Project Manager", 12),
                    new KeyValuePair<string,int>("CEO", 25),
                    new KeyValuePair<string,int>("Software Engg.", 5),
                    new KeyValuePair<string,int>("Team Leader", 6),
                    new KeyValuePair<string,int>("Project Leader", 10),
                    new KeyValuePair<string,int>("Developer", 4) 
                };
        }


But now, I need to display the values (inside a loop) in the chart. Is that possible?
Inside that FOR loop, if I have the below code:
  ((ColumnSeries)mcChart.Series[0]).ItemsSource = new KeyValuePair<string, double>[]
                {
                    new KeyValuePair<string,double>(SelectedTestSystems[i], MeanUtilization)                    
                };
I can only get its last value.
Say I have to loop through ten times, I need to display 10 barcharts showing 10 different SelectedTestSystems and 10 values of MeanUtilization.


Answers (1)