Page 1 of 1

SubChart. Exporting to XAML

Posted: Thu May 15, 2014 4:51 am
by 15669262
Hello steema!
I use SubChartTool to show SubTChart over the main TChart via the code like this:

Code: Select all

            Bar bar = new Bar();
            bar.Marks.Visible = false;
            bar.Add(5);            
            bar.Add(7);
            MyTChart.Series.Add(bar);

            SubChartTool subChartTool = new SubChartTool();
            MyTChart.Tools.Add(subChartTool);
            TChart subChart = subChartTool.Charts.AddChart(string.Empty);
            subChart.Aspect.View3D = false;            
            subChart.Panel.Color = Colors.Transparent;
            subChart.Walls.Visible = false;
            subChart.Axes.Visible = false;

            Pie subChartPie = new Pie();
            subChartPie.Marks.Visible = false;
            subChartPie.Add(10);
            subChartPie.Add(6);
            subChartPie.Brush.Color = Colors.Red;
            subChart.Series.Add(subChartPie);
It works for me.
SubChart.jpg
SubChart.jpg (41.29 KiB) Viewed 9576 times
But if I try to export this TChart to XAML:

Code: Select all

MyTChart.Export.Image.XAML.Save(saveDialog.FileName);
The result won't contain subchart data:
ExportedSubChart.jpg
ExportedSubChart.jpg (45.4 KiB) Viewed 9600 times

Re: SubChart. Exporting to XAML

Posted: Thu May 15, 2014 2:36 pm
by Christopher
Hello,

I have been able to reproduce this defect and it has already been fixed.

As a workaround, you can export your chart to XAML with a SubChartTool using TeeChart.dll (WinForm TeeChart) and manually edit the XAML to remove the erroneously nested <Canvas> object.

Re: SubChart. Exporting to XAML

Posted: Mon Aug 18, 2014 9:22 am
by 15669262
Hello steema!
I downloaded the last release of WPF TChart and checked if my problem is solved.
Now I can see a subchart in the exported xaml, but it has wrong background. I set transparent color to the subchart panel's background (subChart.Panel.Color = Colors.Transparent;) but exported xaml contains wrong rectangle:

Code: Select all

<Rectangle
 Canvas.Left="50" Canvas.Top="50" Width="151" Height="101">
 <Rectangle.Fill>
   <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
    <GradientStop Offset="0" Color="#FFEAEAEA"/>
    <GradientStop Offset="1" Color="#FFFFFFFF"/>
  </LinearGradientBrush>
 </Rectangle.Fill>
</Rectangle>
SubchartBackground.jpg
SubchartBackground.jpg (44.86 KiB) Viewed 9536 times
If I set StartColor and EndColor properties of subChart.Panel.Gradient to transparent, then the exported xaml will be ok. But it would be great if the source and exported TChart appear the same.

And finally, it seems that non-transparent value of subChart.Panel.Color property doesn't work in WPF TChart. If I set it to red, for example, then the subchart's background will be gradient of gray and white.

Re: SubChart. Exporting to XAML

Posted: Tue Aug 19, 2014 8:14 am
by 10050769
Hello neurosoft,
I downloaded the last release of WPF TChart and checked if my problem is solved.
Many thanks for your feedback. I am glad your problem is solved using latest Teechart.Net maintenance release.
Now I can see a subchart in the exported xaml, but it has wrong background. I set transparent color to the subchart panel's background (subChart.Panel.Color = Colors.Transparent;) but exported xaml contains wrong rectangle:
......
If I set StartColor and EndColor properties of subChart.Panel.Gradient to transparent, then the exported xaml will be ok. But it would be great if the source and exported TChart appear the same.
And finally, it seems that non-transparent value of subChart.Panel.Color property doesn't work in WPF TChart. If I set it to red, for example, then the subchart's background will be gradient of gray and white.
The problem is produced because you need set the panel gradient to false. The Subchart is exported with a transparent or coloured background without problems here, using the lines below.

Code: Select all

...         
subChart.Panel.Gradient.Visible = false; 
subChart.Panel.Color = Colors.Transparent; 
//subChart.Panel.Color = Colors.Red; 
...
Could you tell us if previous code works in your end?

Hoping it will helps.

Thanks in advance,

Re: SubChart. Exporting to XAML

Posted: Tue Aug 19, 2014 9:48 am
by 15669262
Could you tell us if previous code works in your end?
It works. But the problem is that if I don't hide gradient and set subChart.Panel.Color to transparent the picture on the screen and in the exported xaml are not the same.
It's not normal for me.

Re: SubChart. Exporting to XAML

Posted: Tue Aug 19, 2014 3:17 pm
by 10050769
Hello neurosoft,
It works. But the problem is that if I don't hide gradient and set subChart.Panel.Color to transparent the picture on the screen and in the exported xaml are not the same.It's not normal for me.
I would like inform you that the Chart or SubChart background shouldn't be transparent when the gradient is activated. Therefore, it is a canvas bug instead of xaml export bug. We’ve added the problem in the TeeChart.Net Bugzilla tracker to fix it to upcoming versions of TeeChartNET. Here http://bugs.teechart.net/show_bug.cgi?id=891 you have the link to the ticket. Feel Free to add your email account to the ticket so you can be automatically notified when and update arrives.

Thanks in advance,