Select to view content in your preferred language

ClassBreaksRenderer using a date

994
4
Jump to solution
02-03-2012 02:13 AM
LanceCrumbliss
Frequent Contributor
Hello all,

Using XAML (and any required code behind or valueconverter) how can I utilize a date (datetime datatype) value for the max/min properties for the classes in a ClassBreaksRenderer?  Using the values in the date field of a FeauterLayer, I'd like to be able to break the symbology down into the past day (a green MarkerSymbol), the past week (an orange MarkerSymbol), the past month (a yellow MarkerSymbol), and the past year (a white MarkerSymbol).


Lance
0 Kudos
1 Solution

Accepted Solutions
LanceCrumbliss
Frequent Contributor
Upgrading to v2.4 from v2.2 solved it using the original code.

View solution in original post

0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
For time-aware layers, you can use TimeClassBreaksAger, it is similar to ClassBreaksRenderer, except there is TimeUnits associated to MinimumAge and MaximumAge: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.TimeClassB...
0 Kudos
LanceCrumbliss
Frequent Contributor
[HTML]<esri:Map Grid.Column="0" Name="Map1" Loaded="Map1_Loaded" WrapAround="True" ExtentChanged="Map1_ExtentChanged" SnapToLevels="True"> 
            <bing:TileLayer x:Name="Base_Map" ID="Base_Map" Token="<token>" ServerType="Production" LayerStyle="AerialWithLabels"/>
            <esri:FeatureLayer ID="flJobs"    Url="http://<serveraddress>" Initialized="FeatureLayer_Initialized" InitializationFailed="FeatureLayer_InitializationFailed">
                <esri:FeatureLayer.MapTip>
                    <Border CornerRadius="0" BorderBrush="Black" BorderThickness="1" Margin="0,0,15,15" Background="White">
                        <Border.Effect>
                            <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                        </Border.Effect>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Margin="3" Text="{Binding [JobNum]}" FontWeight="Bold" Foreground="Black"  />
                            <TextBlock Margin="3" Text="{Binding [DateEntered]}" FontWeight="Bold" Foreground="Black"  />
                        </StackPanel>


                    </Border>
                </esri:FeatureLayer.MapTip>


                <esri:FeatureLayer.Renderer>                
                    <esri:TemporalRenderer TrackIdField="DateEntered" >
                        <esri:TemporalRenderer.ObservationRenderer>
                            <esri:SimpleRenderer>
                                <esri:SimpleMarkerSymbol Color="Black" Size="4" Style="Circle"/>
                            </esri:SimpleRenderer>
                        </esri:TemporalRenderer.ObservationRenderer>
                        <esri:TemporalRenderer.SymbolAger>
                            <esri:TimeClassBreaksAger Unit="Days">
                                <esri:TimeClassBreakInfo Color="Green" Size="10" MinimumAge="0.0" MaximumAge="1.0"/>
                                <esri:TimeClassBreakInfo Color="Orange" Size="10" MinimumAge="1.0" MaximumAge="7.0"/>
                                <esri:TimeClassBreakInfo Color="Yellow" Size="7" MinimumAge="7.0" MaximumAge="30.0"/>
                                <esri:TimeClassBreakInfo Color="Red" Size="5" MinimumAge="30.0" MaximumAge="90.0"/>
                            </esri:TimeClassBreaksAger>
                        </esri:TemporalRenderer.SymbolAger>
                    </esri:TemporalRenderer>
                </esri:FeatureLayer.Renderer>
            </esri:FeatureLayer>
        </esri:Map>
        [/HTML]

With the time extent set on map load:
Map1.TimeExtent = New TimeExtent(Date.Now.AddDays(-90), Date.Now)


Displays only the black symbols (the ObservationRender symbol) on the map.  What am I missing?
0 Kudos
JenniferNery
Esri Regular Contributor
You can look at the time-aware layers sample in the SDK: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#TimeFeatureLayer. Notice that Map.TimeExtent is set using TimeSlider and TimeSlider Min/Max/Value are based on Layer's TimeExtent.
        <esri:Map x:Name="MyMap" WrapAround="True"
                  TimeExtent="{Binding ElementName=MyTimeSlider, Path=Value}">
<!-- more code goes here -->

        <esri:TimeSlider x:Name="MyTimeSlider" 
      Height="20" TimeMode="TimeExtent"
                        MinimumValue="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent.Start, Mode=OneWay}" 
         MaximumValue="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent.End, Mode=OneWay}"
                        Value="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent, Mode=OneWay}" >
                    </esri:TimeSlider>
0 Kudos
LanceCrumbliss
Frequent Contributor
Upgrading to v2.4 from v2.2 solved it using the original code.
0 Kudos