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

Selecting brush color based on value in item

3 Answers 88 Views
TreeMap and PivotMap
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 20 Oct 2011, 04:58 PM

 

 

 

 

<

 

 

telerik:RadTreeMap.TypeDefinitions>

 

 

 

 

 

 

 

 

 

<telerik:TypeDefinition TargetTypeName="StepData" ValuePath="totalTime" ChildrenPath="Children"

 

 

 

LabelPath="stepName" ToolTipPath="totalTime" ToolTipFormat="totalTime: {0:N0} ms">

 

 

 

 

 

 

 

 

 

<telerik:TypeDefinition.Mappings>

 

 

 

 

 

 

 

 

 

<telerik:BrushColorizer Brush="{StaticResource folderBackground}" />

 

 

 

 

 

 

 

 

 

<telerik:BrushColorizer Brush="{Binding Path=Color}" TargetPropertyName="BorderBrush" />

 

 

 

 

 

 

 

 

 

<telerik:BrushColorizer Brush="{StaticResource folderBorder}" TargetPropertyName="BorderBrush" />

 

 

 

 

 

 

 

 

 

</telerik:TypeDefinition.Mappings>

 

 

 

 

 

 

 

 

 

</telerik:TypeDefinition>

 

 

 

 

 

 

 

 

 

<telerik:TypeDefinition TargetTypeName="Measurement" ValuePath="Total"

 

 

 

 

 

 

 

 

LabelPath="stepName" ToolTipPath="totalTime" ToolTipFormat="totalTime: {0:N0} ms" >

 

 

 

 

 

 

 

 

 

<telerik:TypeDefinition.Mappings>

 

 

 

 

 

 

 

 

 

<!--example:FileCustomMapping -->

 

 

 

 

 

 

 

 

 

<telerik:BrushColorizer Brush="{StaticResource folderBorder}" TargetPropertyName="BorderBrush" />

 

 

 

 

 

 

 

 

 

</telerik:TypeDefinition.Mappings>

 

 

 

 

 

 

 

 

 

</telerik:TypeDefinition>

 

 

 

 

 

 

 

 

 

</telerik:RadTreeMap.TypeDefinitions>

 

 

 

 

 

 

 

 

 

</telerik:RadTreeMap>

 

I would like to select my brush color based on the value "Status" in the targettype stepdata.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 21 Oct 2011, 07:57 AM
Hi Peter,

By default all colorizers use the value of the rectangle (RadTreeMapItem) to do their color calculations. You can change this easily by specifying a new property for the colorizer to use with the ValuePath property like this:

<telerik:AbsoluteValueBrushColorizer ValuePath="ChangeRate" Brushes="{StaticResource ColorizerBrushes}" RangeMinimum="-10" RangeMaximum="10" >
</telerik:AbsoluteValueBrushColorizer>
This approach is demonstrated in our AbsoluteValueBrush colorizer demo here.

Another approach could be to use a custom mapping. Custom Mappings work the same way like Style and Template selectors. Take a look at CustomMapping online demo that applies an icon depending on the file type.

Hope this information helps!

Greetings,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 31 Oct 2011, 03:39 PM
Yavor,
Thanks for the suggestion. I tried both of your suggestions but they did not work because of the underlying problem with the data structure that was behind the treemap. In the custom mapping the I was not hiiting the event that allowed me to select the color. Eventually, I took the radfolder data structure that was working and transformed into my structure and then the events in the custom mapping was being processed.
Because of how I resolved the problem, I have no idea what was the issue.
0
Yavor
Telerik team
answered on 02 Nov 2011, 07:43 AM
Hello Peter,

The colorizers look for properties whose name matches the one specified by the *Path property in your business object. Also check that you are binding to properties, not fields. If you want changes made to your business objects to update the treemap you have to implement INotifyPropertyChanged interface.

Regards,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeMap and PivotMap
Asked by
Peter
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Peter
Top achievements
Rank 1
Share this question
or