Sign in to follow this  
thoth

Fusion Charts and Widget Gauge...trying to program in code-behind..need a lilttle help.

Recommended Posts

Ive been using datareaders and strings to produce most of my charts in the code-behinds of my aspx pages. I'm getting the hange of if for the FusionCharts but I cant seem the do the same with a gauge.

private void MedianChart()
{
//xmlData will be used to store the entire XML document generated
StringBuilder xmlData = new StringBuilder();
//Generate the chart element
xmlData.AppendFormat("<chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Bad' upperLimitDisplay='Good' gaugeStartAngle='180' gaugeEndAngle='0' palette='1' numberSuffix='%' tickValueDistance='20' showValue='1'>");
xmlData.Append("<colorRange>");
xmlData.Append("<color minValue='0' maxValue='75' code='FF654F'/>");
xmlData.Append("<color minValue='75' maxValue='90' code='F6BD0F'/>");
xmlData.Append("<color minValue='90' maxValue='100' code='8BBA00'/>");
xmlData.Append("</colorRange>");
xmlData.Append("<dials>");
xmlData.Append("<dial value='75' rearExtension='10'/>");
xmlData.Append("</dials>");
xmlData.Append("</chart>");
//outPut will store the HTML of the chart rendered as string 
//when an ajax call is made we use RenderChartHTML method
string outPut2 = "";
outPut2 = FusionCharts.RenderChartHTML("../../FusionCharts/AngularGauge.swf", "", xmlData.ToString(), "MedianHitGauge", "330", "300", false, true);
//Clear panel which will contain the chart
Panel6.Controls.Clear();
//Add Litaral control to Panel which adds the chart from outPut string
Panel6.Controls.Add(new LiteralControl(outPut2));
}

This doesnt work for the widget angular gauge. I get an error saying "invalid XML data". I have managed to use the data url method and set the url to an aspx page that generates XML but I what I really need to do is something similar to above that can be directly placed in the pages code-behind. Eventually, I want to add a data reader to pull the values for the dial from a database (based on a parameter that is passed to it). Are there any examples I can work with.  There not really anything in the widget documentation on using c# and asp.net.

Any help would be great

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this