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



I want to change the colormap so that the:
– minimum (blue) = 4095
– maximum (red) = 800

Also, I want to set 0 to either black or transparent.

I can easily change the min and max values, just wanting to change the color limit and set 0 = black.

Here is my code for creating the heatmap:

public void heatmap(){
    // Create a SciChartSurface
    SciChartSurface surface = new SciChartSurface(this);
    // Get a layout declared in "activity_main.xml" by id
    LinearLayout chartLayout = findViewById(;
    // Add the SciChartSurface to the layout
    // Initialize the SciChartBuilder
    // Obtain the SciChartBuilder instance
    final SciChartBuilder sciChartBuilder = SciChartBuilder.instance();
    final NumericAxis xAxis = sciChartBuilder.newNumericAxis()
            .withGrowBy(0.1, 0.1)
    final NumericAxis yAxis = sciChartBuilder.newNumericAxis()
            .withGrowBy(0.1, 0.1)
    final FastUniformHeatmapRenderableSeries heatmapRenderableSeries = sciChartBuilder.newUniformHeatmap()
    final SciChartSurface chart = surface;
    Collections.addAll(chart.getXAxes(), xAxis);
    Collections.addAll(chart.getYAxes(), yAxis);
    Collections.addAll(chart.getRenderableSeries(), heatmapRenderableSeries);
    Collections.addAll(chart.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
  • You must to post comments

Hi Jazz,

Well for such complex case when you need to set specific color for some specific value I would suggest to use PalletteProvider API, because it would be hard to achieve desired result using only ColorMap, because it interpolates color of cell based on color values provided in ColorMap. We have an example which shows how to use PaletteProvider with heatmap in demo application. You’ll need to implement custom PaletteProvider.

If you just need to override default ColorMap for 0 values to transparent you will need to return true in shouldSetColors override so your ColorMap will be applied to zColors values from UniformHeatmapRenderPassData before calling update() method in PaletteProvider, then you’ll need just to override color for 0 values in update() and set them to transparent color. If you want to completely ignore colors provided by ColorMap, then you need to return false in shouldSetColors and in this case you need to provide color for each cell via PaletteProvider API like we do in our example.

Hope this will help you!

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.