It would be great if the chart component would have an export to xaml.
you want the Windows Forms chart to export to XAML? Does that mean it exports the XamChart markup, or would it be acceptable to export XAML graphics, i.e. a Canvas filled with Path objects?
ultrachart -> export -> xaml -> xamlToys-tool -> emf
My final goal is to convert this xaml to emf, whitch works perfect with this tool: http://www.codeplex.com/XamlToys.
I'm not really sure, if "XAML graphics, i.e. a Canvas filled with Path objects" fits the needs of this converstion tool.
It uses a System.Windows.Media.Drawing object from a xaml-markup file, and it would fit perfrectly if ultrachart would also export to such an object. If not possible, xaml markup would be perfect also, then this conversion could be taken by xamlToys also.
then xamlToys converts this object to emf. The results are good!
Perhaps if you (Infragistics) integrate such a pipeline into your code yourself this would be a long awaited feature to export to emf. And if not - I would be happy to have xaml and do the rest for myself.
have you considered using the (WPF) XamChart instead of the (Windows Forms) UltraChart?
well, I thought thats not so easy as we have a classic windows forms application. Is it possible to just change the component without any extra adaptions ?
not really; the object models are different in many ways. maybe exporting the WinChart to SVG or PDF and converting that to EMF would be a better approach.
i am just throwing out suggestions without much knowledge of the EMF format or whether such a conversion can be done, though; sorry I can't be more helpful on this one.
This is quite a old post but how do you export the chart to SVG? I ask because we are just not hitting the no support issue for wmf SaveTo support.
WMF and EMF should be working now if you're using the latest service release. I guess the .NET framework added support for EMF, WMF, and EXIF in the Image.Save method, so a fix was applied to the chart.
if you want to save to SVG, there's an overload of UltraChart.SaveTo which takes a stream and a RenderingType. one of the RenderingTypes is SVG.
Failure.
The resulting emf file is Yes an enhanced metafile but it only contains the image in bitmap form. so resizeing in another applicaition (Word, Excel) produces an unacceptable image.
Metafiles should contain Text, Lines (Vectors), and Images.
The code example about only produces the images portion. :-(
Thanks for your help.
pat
I will test it first thing in the morning.
If this works you saved my butt!
Thanks
you're right, it does save as a PNG. I didn't realize that earlier, but it turns out that is documented here: http://msdn.microsoft.com/en-us/library/system.drawing.imaging.metafile.aspx
I was able to create what I think is a true EMF using this test code:
UltraChart ch = new UltraChart();
ch.Data.DataSource = Infragistics.UltraChart.Data.DemoTable.Table();
ch.Data.DataBind();
Graphics gfx = Graphics.FromImage(ch.Image);
Metafile emf = new Metafile(@"C:\test.emf", gfx.GetHdc());
Graphics emfGraphics = Graphics.FromImage(emf);
emfGraphics.DrawImage(ch.Image, new Point(0, 0));
emfGraphics.Dispose();
gfx.Dispose();
will that work for you?
Ok, i tried the svg with the following code:
Dim fs As System.IO.FileStream = New System.IO.FileStream("C:\Users\pat.knoll\Documents\Man32\t.svg", IO.FileMode.Create) Me.UltraChart1.SaveTo(fs, Infragistics.UltraChart.Shared.Styles.RenderingType.Svg)
So Yes i get an SVG file. i can tell this by opening the file in notepad and observing the xml.
My goal is to export my chart image to Word or Excel so it does not get distorted.
Word does not support the svg format (could have guesed that one. Thanks for nothing Microsoft).
Anyway,l HELP
Exporting bitmaps just does not cut it. we need a method to export that will maintain the charts visual quality.
OK, i upgraded to winchart v11.1 and the following still throws an error.
Case "WMF" Me.UltraChart1.SaveTo(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Wmf)
Case "EMF" Me.UltraChart1.SaveTo(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Emf)
ALSO
Both lines below still create a png file. you can see this by opening the resulting emf and wmf files in notpad and look at the first line.
Dim im As Image im = UltraChart1.Image im.Save(Props.AppDataFolderPath & "Test_1.emf", System.Drawing.Imaging.ImageFormat.Emf) im.Save(Props.AppDataFolderPath & "Test_1.wmf", System.Drawing.Imaging.ImageFormat.Wmf)
I am using .NET 2.0. Is this the issue?
Do you have any proof of concept code that demonstrates this feature working correctly?
thanks