Create mulitple scatterseries in code behind

Apr 24, 2010 at 5:27 PM

I have this problem were i am trying to create multiple scatterseries in the code behind, and when they are added to the chart all data points have the same color of the last series added.  Below is the sample code.

For x = 0 To SearchUrl.Count - 1

Dim FindUrl = From url In UrlTotals

Where url.MyUrl = SearchUrl(x)

Select url For Each url In FindUrl

dataFilled.Add(New KeyValuePair(Of String, Integer)(url.MyWord, url.MyTotal))

Next

Dim ScatSeries As New ScatterSeries

ScatSeries.DependentValueBinding =New Binding("Value")

ScatSeries.IndependentValueBinding =New Binding("Key")

ScatSeries.IsSelectionEnabled =True

 

ScatSeries.Title = SearchUrl(x)

 

ScatSeries.ItemsSource = dataFilled

Dim s As New Style(GetType(ScatterDataPoint))s.Setters.Add(New Setter(ScatterDataPoint.BackgroundProperty, MyColors(x)))

ScatSeries.DataPointStyle = s

UrlChart.Series.Add(ScatSeries)

Next