Pre loader

XPS and Heatmap

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


Dear all, I am trying to export a heat map that I have generated that you can see at the right side of the attached image. However, the resulting XPS generated is the figure at the left. As one can see they are not very similar as one would expect. I have checked my code, but can’t seem to find the problem. Parts of my code are shown here to give more info. If anyone has tips why this strange result may occur , let me know please.

 <s:SciChartSurface x:Name="sciChart"  ChartTitle="Carbon and DBE">

           <s:FastHeatMapRenderableSeries x:Name="heatmapSeries" Opacity="0.5" Maximum="100">
                       <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"/>

       </s:SciChartSurface.RenderableSeries> .

and code

    double[,] a = x.Normalized2DArray(100);
                    Heatmap2DArrayDataSeries<double, double, double> heatmap = new Heatmap2DArrayDataSeries<double, double, double>(a, ix => (double)ix * x.binSizeX, iy => (double)iy * x.binSizeY);
                      heatmapSeries.DataSeries = heatmap;
          sciChart.ExportToFile(@"C:\Temp\chart.xps", ExportType.Xps, true, new Size(2000, 2000));
latest from nuget
  • Michel Bieleveld
    I have changed my render surface to xaml and the image is similar to the left with the same data. In my data I can’t find a reason why that weird vertical bar is there, it is not present in the a[,] array mentioned in the above code.
  • You must to post comments

Now with attachment and an image showing the weird bars.

  • Andrew Burnett-Thompson
    Wierdly, I can’t reproduce this with v4.2.0.8826 (which is the version your sample appears to be targetting). I am still trying ..
  • You must to post comments

Another thing I noticed that all xps images of the heatmap are vertically mirrored. Easy to check by modifying the heatmap example solution with the following change;

    private void TimerOnTick(object sender, EventArgs eventArgs)
        Random r = new Random();
        sciChart.ExportToFile(String.Format(@"C:\Temp\chart{0}.xps",r.Next()), Core.ExportType.Xps, true);
        //heatmapSeries.DataSeries = _dataSeries[_timerIndex % _dataSeries.Count];

The axis are correct but the shown data is not. My quest for a solution continues…

  • Andrew Burnett-Thompson
    Wierdly I can’t reproduce this either. I tried to set the data[y,x] = y == 0 ? 20.0 : 0.0. This paints a thin line at the bottom of the chart (where Y=0). Do the same for x == 0 and it paints a thin line on the left as expected.
  • You must to post comments

Okay I have found the problem and it is reproducible. For some reason if the control is within a grid it goes wrong. See the attached projects MainWindow. When the Grids’ row and column definitions are commented out everything goes well (although the image is vertically mirrored) but when the definitions are present the image has strange bars like in the above images and the colors are off. Any ideas what is causing this ? (Ps. Fixed sizes don’t have the problem too).


             <RowDefinition Height="*"/>
             <RowDefinition Height="*"/>
             <ColumnDefinition Width="*"/>
             <ColumnDefinition Width="*"/>

         <example:HeatMapExampleView Grid.Column="1" Grid.Row="1" />
  • You must to post comments

I’m sorry, I cannot reproduce the bars issue using your sample.

I added a video to youtube to show our testing and the result with version v4.2.0.8826.

I did however reproduce the vertically mirrored problem when exporting with useXamlRenderSurface=true. We will investigate this.

Best regards,

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies