Scrolling and X-Axis DateTime values

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Scrolling and X-Axis DateTime values

Post by norman » Thu Dec 04, 2008 11:29 am

Hi,

I'm trying to implement TeeChart scrolling along the lines of whats explained in http://www.teechart.net/support/viewtop ... 2747#32747 but things aren't working. Here's what I've done so far:

I added a TeeChart webcontrol to a new page and set the tempchart property to httphandler. In the codebehind I added the following in the PageLoad event.

Code: Select all

Dim series As New Steema.TeeChart.Styles.Line
series.Pointer.Style = PointerStyles.Circle
series.Pointer.Visible = True
series.XValues.DateTime = True

For i As Integer = 1 To 1000
   series.Add(today.AddDays(-i), i * 10)
Next

WebChart1.Chart.Series.Add(series)

WebChart1.Chart.Axes.Bottom.SetMinMax(today.AddDays(-7), today)

Dim tool As New Steema.TeeChart.Tools.AxisScroll
WebChart1.Chart.Tools.Add(tool)
tool.Axis = WebChart1.Chart.Axes.Bottom
No scroll bars are displayed! What am I missing?!

Also how do I retrieve the the maximum value of the bottom axis and series (in case I should add more than one series) in datetime format?

Code: Select all

WebChart1.Chart.Axes.Bottom.MaxXValue
returns a decimal number. Is

Code: Select all

Dim dt As Date = Date.FromOADate(WebChart1.Chart.Axes.Bottom.MaxXValue)
the correct way to do it - it would make things easier to deal in dates when trying to see what's returned by various properties.

Thanks,

Norman

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 Dec 04, 2008 12:40 pm

Hi Norman,
No scroll bars are displayed! What am I missing?!
Example Christopher Ireland posted is not based in ScrollBars, you should use buttons for that. Notice that buttons code is already available in Christopher's example.
Also how do I retrieve the the maximum value of the bottom axis and series (in case I should add more than one series) in datetime format?
Code:
WebChart1.Chart.Axes.Bottom.MaxXValue
returns a decimal number. Is
Code:
Dim dt As Date = Date.FromOADate(WebChart1.Chart.Axes.Bottom.MaxXValue)
the correct way to do it - it would make things easier to deal in dates when trying to see what's returned by various properties.
Bottom axis max value can be retreived like this:

Code: Select all

			Dim bottomMax As Double = WebChart1.Chart.Axes.Bottom.Maximum
Series' max X value:

Code: Select all

			Dim maxX As Double = series.MaxXValue()
Yes, you should use FromOADate to convert those double values to DateTime values.
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

norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Post by norman » Thu Dec 04, 2008 3:00 pm

Ok sorry about the all the confusion and thanks for the clarification regarding FromOADate.

Regarding scrolling:

I managed to get scroll bars to appear! I had to open the TeeChart Editor, click on the Tools tab and add the scrolltool manually. What are the lines

Code: Select all

Dim tool As New Steema.TeeChart.Tools.AxisScroll
WebChart1.Chart.Tools.Add(tool)
tool.Axis = WebChart1.Chart.Axes.Bottom
I've seen in other examples for? Can you clarify - do I have to add the scrolltool at design time? If so can I dispense with the above code or should I be putting it somewhere else so that it takes effect (it's currently in the Page Load event)?

Following on from that - is there a server side Scroll Event that I can use? For example consider the following possible scenario:

I have 1,000,000 points in my database. I add the scrolltool to the chart, some how configuring it so that its min value is 1 and its max value is 100 (i.e. 1-100 percent). I set the segment view size property to 1? The segment start pos property is left at 1 - indicating that the scroll box is located at the furthest point left when the page first loads. When the page loads the scrollbar value is 1 so I load the first 10,000 points (i.e. points 0-10,000). The user then moves the scrollbar so that the (segment pos?) value is now 2 - which triggers a server side event (via postback or something) that I use to load points 10,001-20,000 etc. Is this kind of thing possible or is the scrollbar really used just to scroll through the data that is currently loaded onto the chart, and therefore I should be looking at implementing paging buttons as well as scrollbars for what I'm trying to do.

Thanks again - I appreciate all the help.

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 Dec 04, 2008 3:26 pm

Hi norman,

I'm afraid what you request is not possible for now in WebForms applications. The only scrolling possible here for now is as in the Interacting with Charts -> Scrolling example in the live ASP.NET demo. Full demo project is also included with TeeChart's installation (C:\Program Files\Steema Software\TeeChart for .NET v3\TeeChartForNET).

You can either create ScrollTool at designtime or at runtime.

The AxisScroll tool code snippet you posted is only available for WinForms applications.
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

norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Post by norman » Thu Dec 04, 2008 3:32 pm

Hi Narcís,
You can either create ScrollTool at designtime or at runtime.

The AxisScroll tool code snippet you posted is only available for WinForms applications.
Could you show the equivalent code for adding the scrolltool at runtime for a WebForms app?

Thanks

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 Dec 04, 2008 3:48 pm

Hi norman,

You'll find an example here.
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

Post Reply