Jump to content
Software FX Community

How TO Export a SVG file by the Chart


linsiyong

Recommended Posts

I want to get the svg file From Chart,but i can not want to make a aspx page  and access this page  and then get the file from the chartFx7/temp documnent.So I make a Consoleapplication and write this source:

  Chart chart1 = new Chart();

  chart1.Gallery = Gallery.Lines;

  chart1.Height = 600;

  chart1.Width = 600;  

  chart1.ID = "test";

  StringBuilder sb = new StringBuilder();

  System.IO.StringWriter oStringWriter = new System.IO.StringWriter(sb);

  System.Web.UI.HtmlTextWriter oWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

  chart1.RenderFormat = "SVG";

  SvgWriter svgWriter = new SvgWriter();

  svgWriter.PluginPage = "http://www.softwarefx.com/svg/svgviewer/";

  chart1.OutputWriter = svgWriter;

 

  chart1.RenderControl(oWriter);

 

  String a = sb.ToString();

  ===================

when it runs at "chart1.RenderControl(oWriter);" i get a nullpointexception.

what is wrong about this source

 

post-7415-13922413089295_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Hi

I created an empty aspnet page and in the page load I coded the following:

using ChartFX.WebForms;using ChartFX.WebForms.Writer.Svg; 

.......... on Page Load method .......

      Chart chart1 = new Chart();   chart1.Gallery = Gallery.Bar;   chart1.Data.Points = 3;   chart1.Data.Series = 1;   chart1.Data[0, 0] = 30;   chart1.Data[0, 1] = 60;   chart1.Data[0, 2] = 90;   chart1.Height = 600;   chart1.Width = 600;   chart1.ID = "test";   chart1.ImageSettings.Interactive = false;   chart1.RenderFormat = "SVG";   SvgWriter svgWriter = new SvgWriter();   chart1.OutputWriter = svgWriter;   chart1.RenderControl();

I also installed the SVG viewer component from Adobe: http://www.adobe.com/svg/viewer/install/

Hope this helps.

Link to comment
Share on other sites

  • 1 month later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...