<chartingToolkit:Chart Title="Typical Use"> <chartingToolkit:ChartSeries> <chartingToolkit:LineSeries Title="Particulate Levels" ItemsSource="{Binding LevelsInRainfall, Source={StaticResource ParticulateLevel}}" IndependentValueBinding="{Binding Rainfall}" DependentValueBinding="{Binding Particulate}"/> </chartingToolkit:Chart.Series> </chartingToolkit:Chart>
I have not used LineSeries myself but if you look at the code and chart sample, you will notice that they set ItemsSource, IndependentValueBinding (X-axis) and DependentValueBinding (Y-axis).
If you need to get one line or one column by graphic, the ItemSources of your chart can be the Graphics property of your layer.Something like (based on this sample : http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#TemporalRendererTracks) :
<Chart.Chart>
In your project, add a reference to System.Windows.Controls.DataVisualization.Toolkit.and in your xaml, add this line: xmlns:Charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
<esri:FeatureLayer ID="WellsFeatureLayer" Url="http://serverprd02/ArcGIS/rest/services/SilverLightDir/Wells_Timeline/MapServer/0" />
<Charting:Chart> <Charting:Chart.Series> <Charting:ColumnSeries Title="Wind Speed" ItemsSource="{Binding ElementName=MyMap, Path=Layers[MyHurricaneFeatureLayer].Graphics}" IndependentValueBinding="{Binding Attributes[EVENTID]}" DependentValueBinding="{Binding Attributes[WINDSPEED]}"/> </Charting:ColumnSeries> </Charting:Chart.Series> </Charting:Chart>
No clue.Do you get something if you use the first version I gave that doesn't need any code: <Charting:Chart> <Charting:Chart.Series> <Charting:ColumnSeries Title="Wind Speed" ItemsSource="{Binding ElementName=MyMap, Path=Layers[MyHurricaneFeatureLayer].Graphics}" IndependentValueBinding="{Binding Attributes[EVENTID]}" DependentValueBinding="{Binding Attributes[WINDSPEED]}"/> </Charting:ColumnSeries> </Charting:Chart.Series> </Charting:Chart>
<esri:ArcGISDynamicMapServiceLayer ID="WellsLayer" Opacity="0.8" Url="http://serverprd02/ArcGIS/rest/services/SilverLightDir/Wells_Timeline/MapServer" Initialized="ArcGISDynamicMapServiceLayer_Initialized" /> <esri:FeatureLayer ID="WellsFeatureLayer" Url="http://serverprd02/ArcGIS/rest/services/SilverLightDir/Wells_Timeline/MapServer/0" />
<charting:Chart HorizontalAlignment="Left" VerticalAlignment="Bottom"> <charting:Chart.Series> <charting:ColumnSeries Title="Wind Speed" ItemsSource="{Binding ElementName=map1, Path=Layers[WellsLayer].Graphics}" IndependentValueBinding="{Binding Attributes[EOM]}" DependentValueBinding="{Binding Attributes[Adj_Close]}"> </charting:ColumnSeries> </charting:Chart.Series> </charting:Chart>
Path=Layers[WellsFeatureLayer].Graphics
You feature layer ID is WellsFeatureLayer (not WellsLayer). Path=Layers[WellsFeatureLayer].Graphics
You need to initialize the OutFields property of your feature layer :OutFields="*" or OutFields="EOM,Adj_Close"Sorry, I should have noticed that at your previous post but I missed the point.
<esri:FeatureLayer ID="WellsFeatureLayer" Url="http://serverprd02/ArcGIS/rest/services/SilverLightDir/Wells_Timeline/MapServer/0" > <esri:FeatureLayer.OutFields> <sys:String>EOM</sys:String> <sys:String>Adj_Close</sys:String> </esri:FeatureLayer.OutFields> </esri:FeatureLayer>
any idea why I get an hour glass?
Perhaps just slow because too much objects in the chart. How many features in your layer?If it's the case, the filtering by timeextent will help.
if (e.PropertyName == "TimeEvent") SetLastObservations();
does it need to say "== MyTimeSlider" or "== TimeEvent"?
public void TemporalRendererTracks(){InitializeComponent();DataContext = this;}
public MainPage() { InitializeComponent(); DataContext = this; }
return from g in graphicswhere g.TimeExtent.Intersects(map1.TimeExtent)group g by g.Attributes["EOM"] into grpselect grp.OrderByDescending(g => g.Attributes["EOM"]).First();
return from g in graphics where g.TimeExtent.Intersects(map1.TimeExtent);
The Chart seems static though
I didn't think 2000 records would be that much for this to handle
Check with the debugger that SetLastObservations is being called when the time extent changed.It's likely only an optimization matter.A chart can handle 2000 objects but with this binding ItemsSource="{Binding ElementName=MyMap, Path=Layers[MyHurricaneFeatureLayer].Graphics}", as Graphics is an observable collection, the chart is reinitialized each time a graphic is added to the feature layer so 2000 times in your case.Hovever the timeextent filtering should reduce this number. How many features are displayed at a time?If you have too ma,y features, you can optimize by replacing the ObservableCollection by a simple collection (IEnumerable) and by firing by yourself the PropertyChanged event each time the collection changed (or another option is to use a dependency property, up to you).
LastObservations.Add(g);
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.