Jump to content
Software FX Community

Creating Charts Dynamically


Recommended Posts

I would like to create multiple charts on my website. My application does not know how many charts are going to be drawn and it will retrieve their data using a service. I was wondering if ChartFX is capable of handling such a scenario and if anyone could point me in the right direction or provide a sample application that does that.


Link to comment
Share on other sites

Sure you can create charts dynamically using Chart FX. I am assuming you have already downloaded the trial, so here is all you need to do.

Chart chart1 = new Chart();

chart1.ID = "Chart1";

chart1.Height = 400;

chart1.Width = 600;


Another way you can do this (and have even more control of your charts) is instanciate the chart on code behind and export it. Exporting will create three streams: the chart image, the html image tag and the html image map. You can then modify it (if necessary) and add it to the page. Here is some sample code for that.

Chart chart1 = new Chart();System.IO.FileStream fileStream;System.IO.StreamWriter imgMapText;System.IO.StreamWriter htmlTag;

fileStream = new System.IO.FileStream(Server.MapPath("chart.jpg"), System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite);imgMapText = System.IO.File.CreateText(Server.MapPath("MapTags.txt"));htmlTag = System.IO.File.CreateText(Server.MapPath("HTMLTag.txt"));chart1.ImageSettings.ToolTips = ImageToolTipStyle.AsTitle;chart1.ID = "TestChart";chart1.RenderFormat = "Jpeg";

chart1.RenderToStream(fileStream, imgMapText, htmlTag);


Link to comment
Share on other sites

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.

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...