Aps.com Posted March 28, 2008 Report Share Posted March 28, 2008 I am just attempting to us ChartFX and I would appreciated if someone would provide a basic C# coding example of creating a chart object, setting up the object with heigth, width, (whatever is required) and then rendering the object out to an html page, it can be an image if necessary I just need to drop it on the html page. any simple example would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Frank Posted March 28, 2008 Report Share Posted March 28, 2008 Chart newChart = new Chart(); newChart.ID = "MyChart1"; newChart.Width = 400; newChart.Height = 200; newChart.RenderControl(new HtmlTextWriter(HttpContext.Current.Response.Output)); Quote Link to comment Share on other sites More sharing options...
Aps.com Posted March 31, 2008 Author Report Share Posted March 31, 2008 thanks for that example it help greatly. I have another question though as I go through some of the documentation for ChartFX I see some examples that show Label1.Text=char1.RenderControl(); where it would appear you can assign the chart output to a label location or local variable, however when I attempt to do the same as the documented examples it raises an error. Is it possible to assign the chart output to a variable or some other control? Quote Link to comment Share on other sites More sharing options...
Frank Posted March 31, 2008 Report Share Posted March 31, 2008 I don't know which sample you are referring to but his code is incorrect (the sample is incorrect). RenderControl writes to an HtmlTextWriter object the output tag of the chart, so for example, if the chart is being rendered as an image, the chart will write something like this to the HtmlTextWriter: <img src="<source for the image>"/> Notice that the image itself is not written to the HtmlWriter, the contents of the image are kept in the server and a reference to it is put in the HTML. For more control on where the tag is written to and the image is written to you can use the RenderToStream method. Documentation for RenderToStream as well as sample code can be found here: http://support.softwarefx.com/onlinedoc/cfxnet70/cfxmaps/chart_rendertostream.htm And also in the installed help files. Quote Link to comment Share on other sites More sharing options...
Aps.com Posted March 31, 2008 Author Report Share Posted March 31, 2008 What is or is there an .NET equivalent to the GetHtmlTag method in your previous version of your ChartFX control? Quote Link to comment Share on other sites More sharing options...
Aps.com Posted March 31, 2008 Author Report Share Posted March 31, 2008 Hey don't bother answering the previous question. I found what I needed in this form "GetHtmlTag" on your website. thanks, I am sure as I learn more I'll have more questions. 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.