SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered Closed
1
0

I would like to define two FastHeatMapRenderableSeries.ColorMap s. One in black and white for printing and the other one, … Why not just for the fun of it :D. How would I be able to switch between ColorMaps ( preferably through binding ) in wpf?

  • You must to post comments
Best Answer
0
0

Hi Michel,

The FastHeatMapRenderableSeries.ColorMap property accepts a LinearGradientBrush. We get the gradient stops out (position, color) in order to determine the heatmap colours.

So change this dynamically, simply bind to the ColorMap property with a converter, e.g.

<UserControl.Resources>

    <LinearGradientBrush x:Key="PrintBrush">
        <GradientStop Offset="0" Color="Black" />
        <GradientStop Offset="1" Color="White" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="DefaultBrush">
        <GradientStop Offset="0" Color="DarkBlue" />
        <GradientStop Offset="0.2" Color="CornflowerBlue" />
        <GradientStop Offset="0.4" Color="DarkGreen" />
        <GradientStop Offset="0.6" Color="Chartreuse" />
        <GradientStop Offset="0.8" Color="Yellow" />
        <GradientStop Offset="1" Color="Red" />
    </LinearGradientBrush>

    <BoolToValueConverter x:Key="ColorMapConverter" 
                 TrueValue="{StaticResource PrintBrush}" 
                 FalseValue="{StaticResource DefaultBrush}"/>

</UserControl.Resources>


...

<s:FastHeatmapRenderableSeries ColorMap="{Binding IsPrintModeBooleanProperty, Converter={StaticResource ColorMapConverter}}"/>

There is an example of BoolToValueConverter in the SciChart WPF Examples Suite.

Hope this helps!

  • You must to post comments
1
0

  • Andrew
    awesome, glad to be of help!
  • You must to post comments
Showing 2 results