ASP.NET zooming with Financial Volume Graph

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

ASP.NET zooming with Financial Volume Graph

Post by richheim » Tue Apr 01, 2008 7:59 pm

Hi,

I'm working on a ASP.NET app in VS 2005 which uses a Volume Graph.
The graph gets data from a database which is stored in a C# DataSet then series are addeed based on the contents of the dataset. The graph is rendered correctly, however when I attempt using the ZOOM tool, with post back, I get an empty graph - the axis labels look correct but there is NO data.

Any ideas?

thanks,
Rich

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 02, 2008 8:37 am

Hi Rich,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here? You may use random data or a dataset as in the example Christopher Ireland posted here

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

poseted files

Post by richheim » Wed Apr 02, 2008 5:43 pm

I have a Database object that supplies data - as you';ll see in the code...you can change those db.... calls to random data I suppose - but it's probably important that the data is then staored in dataseets.

thanks,
Rich

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 03, 2008 7:21 am

Hi Rich,

Thanks for the code. However I'm not able to run and debug it here as it uses a number of controls we don't have here.

At first glance I see that you call CheckZoom method twice, in the ChartSession method and in Page_Load. I recommend you to try removing the call at ChartSession.

Also notice that for using zoom you should set chart's AutoPostback to false.

If this doesn't help please send us a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

GetChart?

Post by richheim » Thu Apr 03, 2008 1:38 pm

Hi,
Thanks for your quick response! I'll see if I can put together someting simple to send...in the meantime I have a question. If I'm using "httpHandler" for TempChart, do I still need a GetChart.aspx file?

Also, since the data I'm filling the chart with data stored in a Session variable of type DataSet, Will this variable need to be retrieved and again tied to the Chart during the checkZoom postback?

thanks,
Rich Heim

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

Another question

Post by richheim » Thu Apr 03, 2008 1:40 pm

Sorry - one more question:

Has the TeeChart ASP.NET library been tested with Microsoft's ASP.NET AJAX extensions?

thanks again,
Rich

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

More Files

Post by richheim » Thu Apr 03, 2008 2:27 pm

I sent a simple example today w/o ajax.

Files are Default.aspx, Default.aspx.cs, config.xml, and DataBaseExample.cs


thanks,
Rich

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

Web.config

Post by richheim » Thu Apr 03, 2008 2:29 pm

Opps!

Make that web.config NOT config.xml

thanks again
Rich

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 03, 2008 3:00 pm

Hi Rich,
Thanks for your quick response! I'll see if I can put together someting simple to send...in the meantime I have a question. If I'm using "httpHandler" for TempChart, do I still need a GetChart.aspx file?
No, in that case it's not necessary, you just need to modify web.config as described in Tutorial 9 - TeeChart and WebChart and ASP.NET. Tutorials can be found at TeeChart's program group.
Also, since the data I'm filling the chart with data stored in a Session variable of type DataSet, Will this variable need to be retrieved and again tied to the Chart during the checkZoom postback?
It is not strictly necessary as when exporting/importing the chart to the MemoryStream it already includes its data.

I also strongly recommend you to read this thread about similar issue.
Has the TeeChart ASP.NET library been tested with Microsoft's ASP.NET AJAX extensions?
TeeChart for .NET v3 supports AJAX and can be used in an UpdatePanel to limit any repaints to that page zone alone. TeeChart also offers some specific optimisations using AJAX clientside code to permit scrolling without a return trip to the server and to capture Chart zoom requests.
There are some live examples of that included with the live ASP.NET demo, like the scrolling example, if you'd like a closer look.
I sent a simple example today w/o ajax.

Files are Default.aspx, Default.aspx.cs, config.xml, and DataBaseExample.cs
Great, thanks! I'll check it out ASAP.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 04, 2008 9:04 am

Hi Rich,
I sent a simple example today w/o ajax.

Files are Default.aspx, Default.aspx.cs, config.xml, and DataBaseExample.cs
I've checked your example but I'm not able to build it here. The problem is in this line:

Code: Select all

	private Database db = Database();
Visual Studio give me this error message:

The type or namespace name 'Database' could not be found (are you missing a using directive or an assembly reference?)

I thought Database may be referring to Microsoft.AnalysisServices.Database but it isn't as using this type produces several other errors of non-existing methods in the type.

Could you please let us know how can we build your project successfully or send us a simple example project we can run "as-is" here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

new file

Post by richheim » Mon Apr 07, 2008 1:10 pm

Hi,

I've uploaded a zip file called testforSteema.zip which should compile for you. Of course the database object, which is my own object responsible for communicating with an Oracle database, won't connect for you. However, you can change modify this to work with random data.

NOTE: The graph displays about 12,000 data points.

thanks,
Rich

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 07, 2008 2:57 pm

Hi Rich,

Thanks for the example project. I've modified it using random data and worked fine for me here:

Code: Select all

public partial class _Default : System.Web.UI.Page 
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FillChart();
						getDetailedData();
        }

        ChartSession();
        CheckZoom(WebChart1);
    }

    protected void FillChart()
    {
        Steema.TeeChart.Chart chart1 = WebChart1.Chart;
        Steema.TeeChart.Styles.Volume series1 = (Steema.TeeChart.Styles.Volume)chart1.Series[0];
        chart1.Tools.Add(new Steema.TeeChart.Tools.ZoomTool());
        ((Steema.TeeChart.Tools.ZoomTool)chart1.Tools[0]).ZoomPenColor = Color.OliveDrab;

        series1.XValues.DateTime = true;
        chart1.Axes.Bottom.Labels.DateTimeFormat = "MM/yyyy";
        chart1.Axes.Bottom.Labels.MultiLine = true;
        chart1.Panel.MarginBottom = 10;

        // Legend
        Steema.TeeChart.Legend legend = chart1.Legend;
        legend.ImageMode = Steema.TeeChart.Drawing.ImageMode.Stretch;

				series1.Clear();
				series1.DataSource = getSummaryData();				
				series1.XValues.DataMember = "ARRDATE";
				series1.YValues.DataMember = "ARRTIME";
				series1.LabelMember = "LABELS";

				series1.CheckDataSource(); 				
    }

    private DataTable getSummaryData()
    {
        DataTable myData = new DataTable ();

				DataColumn ARRDATE = new DataColumn("ARRDATE", Type.GetType("System.DateTime"));
				DataColumn ARRTIME = new DataColumn("ARRTIME", Type.GetType("System.Double"));
				DataColumn LABELS = new DataColumn("LABELS", Type.GetType("System.String"));

				myData.Columns.Add(ARRDATE);
				myData.Columns.Add(ARRTIME);
				myData.Columns.Add(LABELS);

				DataRow dataRow;
				DateTime myTime = DateTime.Now;

				for (int i = 0; i < 12000; i++)
				{
					dataRow = myData.NewRow();
					dataRow[ARRDATE] = myTime.AddDays(i);
					TimeSpan elapsedTime  = new TimeSpan(DateTime.Now.Ticks - myTime.Ticks);
					dataRow[ARRTIME] = elapsedTime.Ticks;
					dataRow[LABELS] = "Point number" + (i + 1).ToString();

					myData.Rows.Add(dataRow); 	
				}

				return myData;
    }


		private DataTable getDetailedData()
    {
			return getSummaryData();
    }


    protected void ChartSession()
    {
        Steema.TeeChart.Chart ch1 = WebChart1.Chart;
        MemoryStream tmpChart = new MemoryStream();
        if (Session["WebChart1"] == null)
        {
            //export Chart to a MemoryStream template
            ch1.Export.Template.Save(tmpChart);
            //save template to a Session variable
            Session.Add("WebChart1", tmpChart);
        }
        else
        {
            //retrieve the session stored Chart
            tmpChart = (MemoryStream)Session["WebChart1"];
            //set the Stream position to 0 as the last read/write
            //will have moved the position to the end of the stream
            tmpChart.Position = 0;
            //import saved Chart
            WebChart1.Chart.Import.Template.Load(tmpChart);


        }
    }

    private void CheckZoom(WebChart wChart)
    {
        ArrayList zoomedState = (ArrayList)Session[wChart.ID + "Zoomed"];
        if (wChart.Chart.Tools.Count > 0)
        {
            zoomedState = ((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request,
                zoomedState);
            if (zoomedState == null)
                Session.Remove(wChart.ID + "Zoomed");
            else
                Session.Add(wChart.ID + "Zoomed", zoomedState);
        }
    }
}
Does it work fine at your end? Could you please modify it so that we can reproduce the problem here?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

Nope

Post by richheim » Mon Apr 07, 2008 5:41 pm

Thanks for looking at it - but it doesn't work here. After a zoom I get no data back.

Could it be file or directory permissions on the workstation I'm using (I do NOT have administrative access on this machine)?
Are you using httphandler?

I'm running it it within the Visual Studio 2005 environment...I don't have priveledges to modify IIS ... could this be a problem? How is the data/graph cached when using httpHandler?

thanks,
Rich

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Apr 08, 2008 9:45 am

Hi Rich,

Yes, I'm using Httphandler. In your prjoect I just modified the sources I posted. Which exact TeeChart for .NET v3 release are you using? Could you please try using the version posted last Friday?

Setting TempChartStyle.Httphandler, the chart is passed as an image in Context.Cache.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

richheim
Newbie
Newbie
Posts: 58
Joined: Tue Sep 18, 2007 12:00 am

Thanks

Post by richheim » Tue Apr 08, 2008 12:53 pm

I'll try the latest release


Rich

Post Reply