|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 1/25/2010 7:13:26 AM
Posts: 5,
Visits: 9
|
|
Hi All,
I have a webpage where I am using ChartFusion which has two charts. First chart is from master data with the links and the other one is from detail table.
The data is huge like more then 10 million records from Oracle. So need to know how I can give message like "Loading data please wait..." then "Rendering charts...." and so on. I am using Visual Studio 2008 and using ASP.NET (C#)
here is the code I want to share so u know what I am doing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using Microsoft.Practices.EnterpriseLibrary.Data.Oracle;
using System.Data;
using System.Globalization;
using System.Web.Security;
using System.Data.Common;
using System.Text;
using InfoSoftGlobal;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string GetScript()
{
//Here, we generate the JavaScript array code for the factory data.
//String to store JavaScript variables
StringBuilder jsVarString = new StringBuilder();
//Generate SQL querystring to get all months
string monthsQuery = "select distinct months, replace(to_char(to_date('01'||months||'2010','DD-MON-YYYY'),'MM'),0,null) from vw_pre_probe_summary";
//Sets JavaScript Array Index
int indexCount = 0;
//Establish Database Connection
Database db = DatabaseFactory.CreateDatabase();
//Create Command object
DbCommand cmd = db.GetSqlStringCommand(monthsQuery);
//Execute command and read data in a DataSet
IDataReader idr = db.ExecuteReader(cmd);
while (idr.Read())
{
//Iterate through each record
indexCount++;
//Build JavaScript : Create a new JavaScript Array
jsVarString.AppendFormat("\t\t data[{0}] = new Array();", idr[1]);
jsVarString.Append(Environment.NewLine);
//Create an SQL Query for the current month
string detailsql = "select a.years, a.ldi_cd, a.months, b.operator_name, round(sum(a.cer_dur)/60) from vw_pre_probe_summary a, ldioperators b where a.months = " + "'" + idr[0] + "'" + " and a.ldi_cd = b.ldi_cd group by a.years, a.months, a.ldi_cd, b.operator_name";
//Create Command object
DbCommand cmdDetail = db.GetSqlStringCommand(detailsql);
//Execute command and read data in a DataSet
IDataReader idrDetail = db.ExecuteReader(cmdDetail);
//Iterate Through records
while (idrDetail.Read())
{
//Build JavaScript : Push Operators Data into JavaScript Array
jsVarString.AppendFormat("\t\t data[{0}].push(new Array('{1}',{2}));", idr[1], idrDetail[3], idrDetail[4]);
jsVarString.Append(Environment.NewLine);
}
}
//Returns JavaScript variables
return jsVarString.ToString();
}
public string GetFactorySummayChartHtml()
{
//Initialize the Bar chart with sum of Total Time for each of the months
//xmlData will be used to store the entire XML document generated
StringBuilder xmlData = new StringBuilder();
//Generate the chart element
xmlData.Append("");
//create recordset to get details for month wise operators data
string monthwiseSql = "select replace(to_char(to_date('01'||months||'2010','DD-MON-YYYY'),'MM'),0,null), months, sum(cer_dur)/60 from vw_pre_probe_summary group by months ";
//Establish Database Connection
Database db = DatabaseFactory.CreateDatabase();
//Create Command object
DbCommand cmd = db.GetSqlStringCommand(monthwiseSql);
//Execute command and read data in a DataSet
IDataReader idrMonthwise = db.ExecuteReader(cmd);
//Iterate through each record
while (idrMonthwise.Read())
{
//Generate
//The link causes drill-down by calling (here) a JavaScript function
//The function is passed the Factory id
//The function updates the second chart
xmlData.AppendFormat("", idrMonthwise[0], idrMonthwise[1], idrMonthwise[2]);
}
//Close chart element
xmlData.Append("");
//Create the chart - Pie 3D Chart with data from xmlData
return FusionCharts.RenderChart("FusionCharts/Column3D.swf?PBarLoadingText=Loading......", "summarychart", xmlData.ToString(), "FactorySum", "500", "250", false, true);
}
public string GetFactoryDetailedChartHtml()
{
//Column 2D Chart with changed "No data to display" message
//We initialize the chart with
return FusionCharts.RenderChart("FusionCharts/Column3D.swf?ChartNoDataText=Please select month from chart above to view detailed data.", "", "", "FactoryDetailed", "900", "250", false, true);
}
}
and here is the HTML code
<%@ Page Language="C#" AutoEventWireup="false" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Reconcilation Charts
Well I want to display those messages on every chart ditto like you did on your website and your demo application.
regards,
josh
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: 4/23/2010 11:38:57 AM
Posts: 1,434,
Visits: 1,631
|
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 1/25/2010 7:13:26 AM
Posts: 5,
Visits: 9
|
|
| well I did before ur post but dont know where to put as my method is different..any help according to my code??
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: 4/23/2010 11:38:57 AM
Posts: 1,434,
Visits: 1,631
|
|
Hello,
You have employed the correct method in your code for changing the chart messages.
return FusionCharts.RenderChart("FusionCharts/Column3D.swf?PBarLoadingText=Loading......"
This is exactly how one should do it.
Did you test if this is working?
Looking forward to your reply.
Regards, Madhumita Chakraborty
Follow us on Twitter
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 1/25/2010 7:13:26 AM
Posts: 5,
Visits: 9
|
|
| yeah its working perfectly but the data is huge so its taking so much time for loading...therefore wanted to show users a message that its loading....can you please suggest where to put my code to achieve this..please help. thanks
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: 4/23/2010 11:38:57 AM
Posts: 1,434,
Visits: 1,631
|
|
Hello,
You have put the code in the right place.
Is the Loading... message not showing?
Regards, Madhumita Chakraborty
Follow us on Twitter
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 1/25/2010 7:13:26 AM
Posts: 5,
Visits: 9
|
|
| yeah its not showing the loading message...plus i want to show message while its loading the data "Loading data please wait..." ...and when its in the processing of render the chart it should say "Rendering chart please wait...."...stuff like that..
|
|
|
|
|
Supreme Being
      
Group: Moderators
Last Login: 4/23/2010 11:38:57 AM
Posts: 1,434,
Visits: 1,631
|
|
Hello,
You can change the chart messages that have been provided in the link I referred to.
Now, for example, if you want to customize 'Loading Chart. Please Wait' and 'Retrieving Data. Please Wait' messages you need to paas the corresponding attributes with the corresponding string as a query string with the chart SWF path.
e.g. return FusionCharts.RenderChart("FusionCharts/Column3D.swf?PBarLoadingText=Loading......&XMLLoadingText=Loading the XML"....);
Now, if you are testing with a small amount of data, you will not be able to see these texts as they will only be present for a millisecond or even less. You test with a large amount of data and see if this is working or not.
Awaiting your reply.
Regards, Madhumita Chakraborty
Follow us on Twitter
|
|
|
|