kailashdhondiyal Posted August 29, 2008 Report Share Posted August 29, 2008 While converting ChartFX 6.2 to ChartFX 7.0, i re-wrote a function like: public static void ConvertChartFromBytes(byte[] data, ChartFX.WinForms.Chart Chart) { try { MemoryStream fs = new MemoryStream(data); Chart.Import(fs); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } It throws an exception after Chart.Import(fs), that shows message like 'Invalid File Format' when i debug this function the i found that value of parameters is passing correct like: data = {Dimensions:[36104]} Chart = {LeftSideChart} (first we set some properties of LeftSideChart and pass it into function) In exception i found following : ex.Message={"Invalid File Format"} ex.Source=ChartFX.WinForms ex.StackTrace: at ChartFX.WinForms.Chart.e(Boolean A_0, IPersistBase A_1, Boolean A_2) at ChartFX.WinForms.Chart.Import(IPersistBase pers) at ChartFX.WinForms.Chart.Import(FileFormat format, Stream stream) at ChartFX.WinForms.Chart.Import(Stream stream) at BTEToolControls.ToolBaseControl.ConvertChartFromBytes(Byte[] data, Chart Chart) in D:\BTETool\Migrated Code\Phoenix\BTEToolControls\ToolBaseControl.cs:line 1281 Plz help that why this function and all the properties worked fine in ChartFX 6.2 and why it is throwing exception now Waiting for your valuable suggestion. Quote Link to comment Share on other sites More sharing options...
Frank Posted August 29, 2008 Report Share Posted August 29, 2008 Chart FX 6.2 files are not compatible with Chart FX 7.0. You need to convert them. You can not import a 6.2 XML or Binary files using just the wrapper. What you need to do is use the Exporter assembly (ChartFX.WebForms.Wrapper.Exporter.dll) as follows: SoftwareFX.ChartFX.Chart chartOld = new SoftwareFX.ChartFX.Chart(); chartOld.Import(SoftwareFX.ChartFX.FileFormat.XML,"fileName");ChartFX.WinForms.Wrapper.Exporting.Exporter exporter = new ChartFX.WinForms.Wrapper.Exporting.Exporter(chartOld); exporter.ExportChart(chartNew); // chartNew is a Chart FX 7.0 chart where the file contents will be loaded. You can also convert all your old XML/Binary files to Chart FX 7.0 format using a command-line tool provided with Chart FX 7.0: C:/>chartfx.winforms.exporter /xml inputFile outputFile Quote Link to comment Share on other sites More sharing options...
kailashdhondiyal Posted August 29, 2008 Author Report Share Posted August 29, 2008 First thing is that we are not using xml file or any kind of file for importing rather we are using a byte array to import. Is there any method like import in exporter assembly like you used in previous example exporter.ExportChart. Looking for an best solution. Quote Link to comment Share on other sites More sharing options...
Frank Posted September 2, 2008 Report Share Posted September 2, 2008 You can follow the same procedure for importing from Binary files and from Streams instead of files. SoftwareFX.ChartFX.Chart chartOld = new SoftwareFX.ChartFX.Chart(); chartOld.Import(SoftwareFX.ChartFX.FileFormat.Binary,inputStream); ChartFX.WinForms.Wrapper.Exporting.Exporter exporter = new ChartFX.WinForms.Wrapper.Exporting.Exporter(chartOld); exporter.ExportChart(chartNew); // chartNew is a Chart FX 7.0 chart where the file contents will be loaded. Quote Link to comment Share on other sites More sharing options...
kailashdhondiyal Posted September 5, 2008 Author Report Share Posted September 5, 2008 Francisco, I did exactly like you mentoned it above. But now it's showing another error after exporter.ExportChart(chartNew); Below is the error description: ex: {"Method not found: 'System.Collections.ICollection SoftwareFX.ChartFX.GalleryObj.Surface.get_Colors()'."} Source: ChartFX.WinForms.Wrapper.Exporter Stack Trace: at ChartFX.WinForms.Wrapper.Exporting.Exporter.ExportGalleryObj(Object importGallery, Object exportGallery) at ChartFX.WinForms.Wrapper.Exporting.Exporter.ExportChart(Chart exportChart) at ChartFX.WinForms.Wrapper.Exporting.Exporter.ExportChart(Chart export) at BTEToolControls.ToolBaseControl.ConvertChartFromBytes(Byte[] data, Chart Chart) in D:\BTETool\Migrated Code\Phoenix\BTEToolControls\ToolBaseControl.cs:line 1286- [system.MissingMethodException] {"Method not found: 'System.Collections.ICollection SoftwareFX.ChartFX.GalleryObj.Surface.get_Colors()'."} System.MissingMethodException Please suggest the best solution possible. Quote Link to comment Share on other sites More sharing options...
JDonoghue Posted January 14, 2009 Report Share Posted January 14, 2009 Hi, I've got this code successfully working in my development environment, but once it's deployed I get the same error. I suspect something is missing from the deployment, but I can't see what, does anybody know a solution? Thanks, John Quote Link to comment Share on other sites More sharing options...
JDonoghue Posted January 14, 2009 Report Share Posted January 14, 2009 To be clear (sorry) I get the second error Method not found: 'System.Collections.ICollection SoftwareFX.ChartFX.GalleryObj.Surface.get_Colors()' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.