SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hello,
This question is related to this discussion :
https://www.scichart.com/questions/wpf/export-chart-with-heatmapcolormap
I want to export a chart as XPS and have the HeatmapColorMap on the XPS. I put the HeatmapColorMap inside a CustomAnnotation. I had an issue with the ticks and labels not appearing on the printed XPS so I was advised to use a workaround :
public class SciChartSurfaceEx : SciChartSurface
{
protected override SciChartSurfaceBase CreateCloneOfSurfaceInMemory(Size newSize)
{
// Grab custom annotation that stores HeatmapColormap on a real chart
var originalColormapAnnotation = (CustomAnnotation)this.Annotations.Where(x => x.GetType() == typeof(CustomAnnotation)).FirstOrDefault();
var originalColorMap = originalColormapAnnotation.Content as HeatmapColorMap;
// Perform exporting functionality(serializing\deserializing)
var cloned = (SciChartSurface)base.CreateCloneOfSurfaceInMemory(newSize);
var newWindow = new Window();
newWindow.Content = cloned;
newWindow.Show();
newWindow.Close();
return cloned;
}
}
Opening a new window is a workaround to prevent the HeatmapColorMap from disappearing after exporting, because it disappears otherwise.
This works fine when exporting a PNG at non-default size but it does not work when exporting as XPS. I get the following exception :
System.InvalidOperationException: ‘Specified element is already the logical child of another element. Disconnect it first.’
Why do I have this exception ? Is there any way around it ?
There are quite a few bugs when exporting charts, it would be nice to have them fixed.
Thank you in advance !
Hello Renaud,
Thanks for your inquiry. I am sorry for the late reply.
In order to export Heatmap and HeatmapColorMap as the same image, HeatmapColorMap should be a child of the SciChartSurface you export.
Please take a look at the following forums thread for more info:
https://www.scichart.com/questions/wpf/exporting-heatmap-to-png-with-included-heatmapcolormap
Hope this helps,
With best regards,
Oleksandr
Hello Oleksandr,
This works fine, thank you for your response !
In order to export Heatmap and HeatmapColorMap as the same image, HeatmapColorMap should be a child of the SciChartSurface you export.
cookie clicker
Please login first to submit.