TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
neurosoft
- Newbie
- Posts: 35
- Joined: Thu May 06, 2010 12:00 am
Post
by neurosoft » Thu Sep 16, 2010 12:16 pm
Hi steema people!
I have problem with exporting TChart to XAML again.
The following code
Code: Select all
TChart MyTChart = new TChart();
MyTChart.Series.Add(new Bar());
Bar series = MyTChart[0] as Bar;
MyTChart.Aspect.View3D = false;
for (int i = 0; i < 10; i++)
{
series.Add(i);
}
series.ShowInLegend = true;
MyTChart.Legend.CheckBoxes = true;
using (MemoryStream ms = new MemoryStream())
{
MyTChart.Export.Image.XAML.Width = 200;
MyTChart.Export.Image.XAML.Height = 100;
MyTChart.Export.Image.XAML.Save(ms);
}
throws exception:
Unable to cast object of type 'Steema.TeeChart.WPF.Drawing.Graphics3DXAML' to type 'Steema.TeeChart.WPF.Drawing.Graphics3DWPF'
at Steema.TeeChart.WPF.Legend.DrawLegendItem(Int32 ItemIndex, Int32 ItemOrder)
at Steema.TeeChart.WPF.Legend.DrawItems()
at Steema.TeeChart.WPF.Legend.Paint(Graphics3D g, Rect rect)
at Steema.TeeChart.WPF.Chart.DoDrawLegend(Rect& tmp)
at Steema.TeeChart.WPF.Chart.DrawTitlesAndLegend(DrawingContext g, Rect& tmp, Boolean BeforeSeries)
at Steema.TeeChart.WPF.Chart.InternalDraw(DrawingContext g, Boolean noTools)
at Steema.TeeChart.WPF.Chart.Draw(DrawingContext g, Rect r, Boolean noTools)
at Steema.TeeChart.WPF.Chart.Draw(DrawingContext g, Rect r)
at Steema.TeeChart.WPF.Export.XAMLFormat.Save(Stream stream)
Please, check it.
-
neurosoft
- Newbie
- Posts: 35
- Joined: Thu May 06, 2010 12:00 am
Post
by neurosoft » Thu Sep 16, 2010 1:41 pm
Some additional info: the problem is in code line "MyTChart.Legend.CheckBoxes = true"; if you change it to "MyTChart.Legend.CheckBoxes = false" all will be Ok.
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Fri Sep 17, 2010 9:00 am
Hello neurosoft,
I inform you that this is a known bug already in the defect list to be fixed asap (TW16014998).
Thanks,
-
neurosoft
- Newbie
- Posts: 35
- Joined: Thu May 06, 2010 12:00 am
Post
by neurosoft » Wed Sep 22, 2010 6:00 am
Hello Sandra!
I would like to be sure that the bug in TW16014998 is the same that i have described. In the topic
http://www.teechart.net/support/viewtop ... TW16014998 it was discussed exporting TChart to JPEG. Exporting to JPEG don't throw exception when the Legend.CheckBoxes property is true. Checkboxes are just ignored in result image. But I wrote about exporting to XAML and in my case exporting cannot be finished. It throws Exception with message "Unable to cast object of type 'Steema.TeeChart.WPF.Drawing.Graphics3DXAML' to type 'Steema.TeeChart.WPF.Drawing.Graphics3DWPF'".
If you are sure that both of bugs are the result of same problem, I have no questions.
Thanks.
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Wed Sep 22, 2010 11:08 am
Hello neurosoft,
Yes, it's the same. Originally TW16014998 was only about checkboxes not appearing in JPEG export. When we started working on the issue we tested different image formats ( XAML included) to compare with JPEG. Since we found the problem occurring in other formats we extended TW16014998 description.
Thanks,