Pre loader

2D Heatmap change colormap

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi,

I may have run into a bug with the 2d heatmap where it doesn’t refresh. I implemented a ColorMapConverter similar to the solution here: https://www.scichart.com/questions/question/how-to-switchdefine-multiple-fastheatmaprenderableseries-colormap-for-the-same-chart

The Brushes are defined as

    <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>

    <LinearGradientBrush x:Key="JetBrush">
        <GradientStop Offset="0" Color="#00008F" />
        <GradientStop Offset="0" Color="#00008F" />
        <GradientStop Offset="0.125" Color="#0000FF" />
        <GradientStop Offset="0.375" Color="#00FFFF" />
        <GradientStop Offset="0.625" Color="#FFFF00" />
        <GradientStop Offset="0.875" Color="#FF0000" />
        <GradientStop Offset="1" Color="#800000" />
    </LinearGradientBrush>

The chart will only refresh if the number of gradient stops is different. My workaround is to replicate the first GradientStop in JetBrush. If I remove this line, the chart will not refresh. The colorbar still refreshes correctly, but not the heatmap surface.

I’d like to implement many different colormaps and for now it seems like I can keep replicating GradientStops. I thought it was worth mentioning just in case it’s a bug. Anyway, please let me know if there is a better way to do this.

Version
4.0.6.8482
  • Andrew Burnett-Thompson
    Hi Kevin, Im discussing this with Yuriy. Can you clarify the issue? SciChart should redraw if you change the HeatmapRenderableSeries.ColorMap property to a new colormap. It won’t redraw if you change a gradient stop or a color on an existing colormap as we don’t listen to property changed events on the Gradient stops.
  • Kevin Yeh
    Hi Andrew. I attached some sample code to the original post to demonstrate the issue. It is a modified version of the 2D Heatmap example. I added a combobox to the MainWindow that is bound to a ColorMap property. The Heatmap is also bound to this via a ColorMapConverter (similar to the BoolToValueConverter you implemented in the previous solution). If you switch between the Gray and Cool colormaps (both have 2 Gradient Stops), the colorbar refreshes, but the heatmap doesn’t. The same thing happens when you switch between the Jet and Rainbow colormaps (6 gradient stops). If you switch between Gray (2) and Jet (6), both the colorbar and heatmap refresh. If you replicate gradient stops such that no colormaps have the same number of stops, everything works fine.
  • Yuriy Zadereckiy
    Hi Kevin, please try out the latest build #v4.0.6.8512. We believe the issue is fixed there. You can get it through our NuGet feed: http://support.scichart.com/index.php?/Knowledgebase/Article/View/17232/37/getting-nightly-builds-with-nuget
  • Kevin Yeh
    Thanks! The problem is fixed.
  • You must to post comments
0
0

Hi Kevin,

Thanks for letting us know! The reason why it was implemented in this way is for better performance. Not sure if we will be able to change it, but I’ve logged it for investigation anyway. We will take a look and see what can be done about this.

UPDATE:

The issue has been fixed in the build #v4.0.6.8512. You can get it through our NuGet feed.

Best regards,
Yuriy

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.