Hi,
I have tested it all the ways you recommended, but with no luck. Here is the way I'm doing it at the moment. Please note that the start and end time for the processing is only where I add the data to the series and not the page load time.
Create a "Temp" directory in the web application project for the *.tee file.
Note: I use the endRequest method to load my tee file after a asynchronous postback from my button.
Default.aspx
Code: Select all
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TeeChartSample._Default" %>
<!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>TeeChart Sample</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Generate" />
<br />
<br />
<asp:Label ID="lblTime" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<div>
<object id="TChart1" classid="clsid:BDEB0088-66F9-4A55-ABD2-0BF8DEEC1196" codebase="http://localhost/teechart8.cab#Version=8,0,0,5"
style="z-index: 100; width: 980px; height: 600px">
<param name="Base64" value="VFBGMAtUQ2hhcnRDaGFydAAETGVmdAIAA1RvcAIABVdpZHRoA14CBkhlaWdodAORARJUaXRsZS5U ZXh0LlN0cmluZ3MBBghUZWVDaGFydAAAAAAAAAACAAAAAP////8=">
</object>
<script type="text/javascript" language="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler()
{
document.getElementById("TChart1").ClearChart();
var shref = location.href;
var sURLRev = shref.substring(0,shref.lastIndexOf('/') + 1);
document.getElementById("TChart1").Import.LoadFromURL(sURLRev+"Temp/TeeData_Sample.txt");
}
</script>
</div>
</form>
</body>
</html>
Default.aspx.cs
Code: Select all
protected void Button1_Click(object sender, EventArgs e)
{
TeeChart.TChart MyChart = new TeeChart.TChart();
MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
MyChart.AddSeries(TeeChart.ESeriesClass.scLine);
MyChart.Series(0).XValues.DateTime = true;
int intCounter = 1;
DateTime Mydatetime = DateTime.Now;
while(intCounter < 1441)
{
Mydatetime =Mydatetime.AddMinutes(30);
double dStartDate = Convert.ToDouble(Convert.ToDateTime(Convert.ToDateTime(Mydatetime).ToString("yyyy-MM-dd HH:mm")).ToOADate());
MyChart.Series(0).AddXY(dStartDate,intCounter,"",(uint)TeeChart.EConstants.clTeeColor);
MyChart.Series(1).AddXY(dStartDate,intCounter/2,"",(uint)TeeChart.EConstants.clTeeColor);
MyChart.Series(2).AddXY(dStartDate,intCounter/3,"",(uint)TeeChart.EConstants.clTeeColor);
intCounter++;
}
lblTime.Text ="Start Time: "+Mydatetime.ToString("yyyy-MM-dd HH:mm:ss")+" End Time: "+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//MyChart.Series(0).FillSampleValues(30000);
string ServerPath;
ServerPath = Server.MapPath("~/");
//****Delete all files in Dir
foreach(string sFile in System.IO.Directory.GetFiles(ServerPath+"Temp\\", "*.txt"))
{
if(System.IO.Path.GetFileName(sFile)!= "TeeData_Sample.txt")
{
System.IO.File.Delete(sFile);
}
}
//***********Export Chart to tee file in Temp Dir
MyChart.Export.asNative.SaveToFile(ServerPath+"Temp\\TeeData_Sample.txt",true);
}