sushma_rkd Report post Posted August 11, 2011 Hi, I am adding this text pls look thru and help me out.. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="liveStockPrice.aspx.cs" Inherits="liveStockPrice" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Live Chart</title> <script src="Scripts/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="Scripts/jquery.xml2json.js" type="text/javascript"></script> <script src="FusionScripts/FusionCharts.js" type="text/javascript"></script> <script src="FusionScripts/highcharts.js" type="text/javascript"></script> <script type="text/javascript"> $.ajax({ type: "POST", url: "liveStockPrice.aspx/BindlineChart", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, success: function(msg) { var json = $.xml2json(msg.d); var RevenuejsonString = { chart: { "caption": "Concurrent Users", "borderColor": "899FB6", "subcaption": "(Updates every 10 minutes)", "canvasborderColor": "DAE1E8", "canvasBgColor": "FFFFFF", "bgColor": "EEF2FB", "numDivLines": "6", "divLineColor": "DAE1E8", "divLineAlpha": "75", "alternateHGridAlpha": "30", "decimals": "0", "baseFontColor": "899FB6", "outCnvBaseFontColor": "444C60", "toolTipBorderColor": "DAE1E8", "toolTipBgColor": "FFFFFF", "toolTipSepChar": " ", "showAlternateHGridColor": "1", "alternateHGridColor": "DAE1E8", "dataStreamURL": "http://localhost:50060/Realtime/liveStockPrice.aspx", "refreshInterval":"10", "updateInterval": "1", "numDisplaySets": "15", "showLegend": "1", "showLabels": "1", "showRealTimeValue": "0", "showShadow": "1", "showPlotBorder": "0", "plotBordercolor": "FFFFFF", "plotGradientColor": "", "labelDisplay": "rotate", "canvasLeftMargin": "50", "realTimeValuePadding": "50", "showSum": "1" }, categories: [{ category: [] }], dataset: [] }; var datasetNonDedicate = { "seriesname": "Dedicated", data: [] }; datasetNonDedicate.data = new Array(); if (json.Table.length > 0) { for (i = 0; i < json.Table.length; i++) { var categoryLabel = {}; var dataSeriesNonDedicated = {}; categoryLabel.label = json.Table.Property; RevenuejsonString.categories[0].category.push(categoryLabel); var item = parseFloat(json.Table.PendingAmount); dataSeriesNonDedicated.value = item; datasetNonDedicate.data.push(dataSeriesNonDedicated); } } RevenuejsonString.dataset.push(datasetNonDedicate); // RevenuejsonString.dataset.push(datasetDedicate); //StackedColumn2D.swf //MSColumnLine3D var barContainer = new FusionCharts("FusionCharts/RealTimeStackedColumn.swf", "barDrillDownID", "600", "400", "0", "1"); barContainer.setJSONData(RevenuejsonString); barContainer.render("StackedColumn3DContainer"); }, error: function(xmlhttprequest, textstatus, errorThrown) { alert(xmlhttprequest.responseText); } }); </script> </head> <body> <form id="form1" runat="server"> <div id="StackedColumn3DContainer"> </div> <div id="chartContainer"> </div> <script type="text/javascript"> var myChart = new FusionCharts("FusionCharts/RealTimeStackedColumn.swf", "myChartId", "400", "300", "0", "1"); myChart.setXMLUrl("Data.xml"); myChart.render("chartContainer"); </script> </form> </body> </html> using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.IO; using System.Text; using System.Web.Services; using Testing.BusinessLogicLayer; using Testing.DataAccessLayer; public partial class liveStockPrice : System.Web.UI.Page { static string connstring = ConfigurationManager.AppSettings.Get("SQLCONNECTION"); protected void Page_Load(object sender, EventArgs e) { } [WebMethod] public static String BindlineChart() { DateTime dn = DateTime.Now; DateTime AsOnDate = dn.Date; SampleAdapter ta = new SampleAdapter(); DataTable dt = new DataTable(); dt = ta.ReportsOutStandingBillsWithCriteria(connstring, "", 1, AsOnDate); return ConvertDataTableToXML(dt); } private static string ConvertDataTableToXML(DataTable dtBuildSQL) { DataSet dsBuildSQL = new DataSet(); StringBuilder sbSQL; StringWriter swSQL; string XMLformat; sbSQL = new StringBuilder(); swSQL = new StringWriter(sbSQL); dsBuildSQL.Merge(dtBuildSQL, true, MissingSchemaAction.AddWithKey); dsBuildSQL.Tables[0].TableName = "Table"; foreach (DataColumn col in dsBuildSQL.Tables[0].Columns) { col.ColumnMapping = MappingType.Attribute; } dsBuildSQL.WriteXml(swSQL, XmlWriteMode.WriteSchema); XMLformat = sbSQL.ToString(); return XMLformat; } } Share this post Link to post Share on other sites
Guest Angshu Report post Posted August 11, 2011 Hi, Thanks for your post. To create any real-time chart, you'll need to assimilate the following things: Chart SWF file and FusionCharts JavaScript class XML file that initializes the chart and tells it where to pull the real time data from Real time data provider page that provides updated data to chart in real-time data format. The real-time data is provided by the URL specified as dataStreamURL attribute in the XML data document. This data should essentially be in text format WITHOUT containing any HTML tags or carriage returns. For more details, please refer to the forum link: http://forum.fusionc...9585#entry39585 Hope this helps. Share this post Link to post Share on other sites