ColorMeasureScale examples and docs???

8 posts, 1 answers
  1. James
    James avatar
    30 posts
    Member since:
    Aug 2008

    Posted 23 Nov 2010 Link to this post

    Are there any varied examples of usage and/or documentation that explains how to use this? The docs online right now are very sparse. I know it is new, but I really need to figure out how to handle this properly. I'm getting all sorts of wacky results when I am trying things my users are asking for. ;)

    For example, just doing a two color map from data that runs from 0-100 where red is triggered when at a value of 79 or less, anything 80 or above is green. That was a beast to figure out and even when I got it working I see that the color values are changed...it's trying to blend them just a bit. Now I'm being asked to show multiple shades of red depending on value, but all >80 are one green. Is that even possible, if so, how? I'm not quite und4erstanding the Step mode with Min and Max and TickMarkStep....Count mode does not seem to work for this at all.
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 26 Nov 2010 Link to this post

    Hi James,

     Thank you for pointing out the problem with “Count” mode. We’ve made several tests and found that ColorMasureScale definitely returns wrong ranges for the situation with two MapShapeFills and TickMarkCount property set to 2. This problem will be fixed in the nearest internal build.

    Now for your task -- you can use “Step” mode as follows:

    <telerik:RadMap x:Name="radMap" 
            Center="38,-100"
            ZoomLevel="4">
        <telerik:RadMap.Provider>
            <telerik:OpenStreetMapProvider />
        </telerik:RadMap.Provider>
        <telerik:InformationLayer x:Name="informationLayer">
            <telerik:InformationLayer.Colorizer>
                <telerik:ColorMeasureScale Mode="Step" 
                        TickMarkStep="79" 
                        ExtendedPropertyName="YOUR_PROPERTY_NAME"
                        PrepareCompleted="ChangeRanges">
                    <telerik:ColorMeasureScale.ShapeFillCollection>
                        <telerik:MapShapeFill Fill="Red" Stroke="#B1946D" StrokeThickness="1" />
                        <telerik:MapShapeFill Fill="Green" Stroke="#B1946D" StrokeThickness="1" />
                    </telerik:ColorMeasureScale.ShapeFillCollection>
                </telerik:ColorMeasureScale>
            </telerik:InformationLayer.Colorizer>
            <telerik:InformationLayer.Reader>
                <telerik:MapShapeReader Source="YOUR_SHAPE_FILE" />
            </telerik:InformationLayer.Reader>
        </telerik:InformationLayer>
    </telerik:RadMap>

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
      
        private void ChangeRanges(object sender, Telerik.Windows.Controls.Map.ShapeColorizerEventArgs e)
        {
            // Change range distribution.
            Telerik.Windows.Controls.Map.ColorMeasureScale colorizer = 
                sender as Telerik.Windows.Controls.Map.ColorMeasureScale;
      
            colorizer.RangeCollection[0].MinValue = 0;
            colorizer.RangeCollection[0].MaxValue = 79;
      
            colorizer.RangeCollection[1].MinValue = 80;
            colorizer.RangeCollection[1].MaxValue = 100;
        }
    }

    Hope this helps. I have updated your Telerik points.

    Best regards,
    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. UI for WPF is Visual Studio 2017 Ready
  4. James
    James avatar
    30 posts
    Member since:
    Aug 2008

    Posted 30 Nov 2010 Link to this post

    Andrey,

    Actually, I cannot do it just as you posted:

    <telerik:ColorMeasureScale Mode="Step"
            TickMarkStep="79"
            ExtendedPropertyName="YOUR_PROPERTY_NAME"
            PrepareCompleted="ChangeRanges">

    That gives a divide by zero error. I can do this, however:

    <telerik:ColorMeasureScale
        ExtendedPropertyName="PAT_EST"
        Mode="Step"
        MinValue="0"
        MaxValue="100"
        TickMarkCount="2"
        TickMarkStep="79"
        PrepareCompleted="ChangeRanges">

    Actually, it seems that omitting MinValue and MaxValue causes the divide by zero, they seem to be required in Step mode.

    James
  5. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 03 Dec 2010 Link to this post

    Hello James,

    The sample code I've posted definitely works when resulting map shapes contain extended properties which are necessary to configure ColorMeasureScale automatically. If you, for example, have not DBF file with necessary properties and read them from some external resource (database or WCF service, for example), then you should configure ColorMeasureScale manualy from XAML or code behind.

    Kind regards,
    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  6. James
    James avatar
    30 posts
    Member since:
    Aug 2008

    Posted 03 Dec 2010 Link to this post

    It really does fail for me if I omit Min and Max. If I add them, it all works fine. Of course, I am using an ESRI shapefile. My property does exist in the DBF file. Maybe the error I get only occurs when using shapefiles and omitting Min and Max in Step mode?
  7. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 08 Dec 2010 Link to this post

    Hi James,

    Did you try it with latest internal build? We've fixed a couple problems with ColorMeasureScale in it. Could you, please, provide us with your ESRI shape file and DBF file, so we could check why my solution (with MinValue and MaxValue calculated automatically) doesn't work for you? Thanks.

    All the best,
    Andrey Murzov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  8. James
    James avatar
    30 posts
    Member since:
    Aug 2008

    Posted 09 Dec 2010 Link to this post

    Andrey,

    No. I'm using the latest production release build. I'll try the latest internal, but I'm in a corporate environment all licensed and such. Will the internal nag me about not being registered?

    James
  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 14 Dec 2010 Link to this post

    Hi James,

    The account you have utilized to start this thread does not have licensed products recorded, so if you will only be able to download a trial version, which will occasionally display a trial message. You can ask the license holder to add you as a licensed developer to the purchase, this way you will have direct access to the latest DEV builds and to the corresponding support package.

    Best regards,
    Ves
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
Back to Top
UI for WPF is Visual Studio 2017 Ready