This is a migrated thread and some comments may be shown as answers.

ColorMeasureScale examples and docs???

7 Answers 76 Views
Map
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 23 Nov 2010, 05:01 PM
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.

7 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 26 Nov 2010, 02:59 PM
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
0
James
Top achievements
Rank 1
answered on 30 Nov 2010, 08:29 PM
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
0
Accepted
Andrey
Telerik team
answered on 03 Dec 2010, 03:15 PM
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
0
James
Top achievements
Rank 1
answered on 03 Dec 2010, 04:11 PM
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?
0
Andrey
Telerik team
answered on 08 Dec 2010, 07:46 PM
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
0
James
Top achievements
Rank 1
answered on 09 Dec 2010, 04:17 PM
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
0
Ves
Telerik team
answered on 14 Dec 2010, 09:04 AM
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
Tags
Map
Asked by
James
Top achievements
Rank 1
Answers by
Andrey
Telerik team
James
Top achievements
Rank 1
Ves
Telerik team
Share this question
or