Can't get multiline property to work

TeeChart for ActiveX, COM and ASP
Post Reply
Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Can't get multiline property to work

Post by Chints » Sat Dec 13, 2008 1:20 pm

We are using a Line Chart, on an Access 2007 form, to plot floating-point instrument values against a common datetime bottom axis. However the bottom axis labels are not being wrapped over two lines even though the multiline property for the axis is checked.

The data is being fetched from an Access query which returns a recordset with columns as shown below:

datetime value1 value2 value3 etc

The datetime is f the format 'dd/mm/yyyy hh:mm:ss'.

Any idea why the multiline setting isnt working please ?

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 Dec 15, 2008 8:27 am

Hi Chints,

Are you doing as in the example at C:\Program Files\Steema Software\TeeChart Pro v8 ActiveX Control\Examples\Visual Basic\Visual Basic 5 & 6\Multiline Axis Labels? Is this example working fine at your end? Which TeeChart version are you using?

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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Mon Dec 15, 2008 10:06 am

Yes, the example works fine on the same machine. The main differences between my project and the example are:

- My chart has multiple series sharing a common bottom axis
- The series data is from a query recordset

Just a thought - The bottom axis labels are releated to the column in the query caled 'DateTime'. There isn't any issue with reserved keywords here is there ?

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 Dec 15, 2008 10:16 am

Hi Chints,
Yes, the example works fine on the same machine. The main differences between my project and the example are:

- My chart has multiple series sharing a common bottom axis
- The series data is from a query recordset
Could you please send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Just a thought - The bottom axis labels are releated to the column in the query caled 'DateTime'. There isn't any issue with reserved keywords here is there ?
Not that I know of but there is VB/VBA reserved keyword called "DateTime" so you could try renaming this field.

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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Mon Dec 15, 2008 10:54 am

It's difficult to produce a cut down example because the query won't work without the back end SQL Server database.

However, am I right in thinking there are two ways of producing the bottom axis labels, ie:

1) Currently I am using the following VB code to associate each point in the series with a datetime label.

me.Tchart0.Series(0).LabelsSource = "DateTime"


2) I have tried to copy the Steema example you mentioned above, ie dont use the .LabelsSource property, but instead use the following:

me.Tchart0.Axis.bottom.Increment = TChart0.GetDateTimeStep (dtOneSecond)

The mulitiline property works fine with this, but how do I set the axis labels to start at the correct time? (it currently defaults to year 1900)

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 Dec 15, 2008 2:07 pm

Hi Chints,
The mulitiline property works fine with this, but how do I set the axis labels to start at the correct time? (it currently defaults to year 1900)
This is most likely because of what's described here:

http://msdn.microsoft.com/en-us/library ... adate.aspx
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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Mon Dec 15, 2008 2:16 pm

Fair enough, but is there a property of the bottom axis I can write to to set the start datetime label value of the axis ?

The vb example you referred to starts from the current datetime but I'm not sure how.

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 Dec 15, 2008 2:59 pm

Hi Chints,

You can use SetMinMax method as shown here:

http://www.teechart.net/support/viewtopic.php?t=5657

Hope this helps!
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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Mon Dec 15, 2008 4:33 pm

OK I seem to have solved the initial multiline problem:

- I removed the following for each series -
.Labelsource = "Datetime" lines

- and added the following for each series
.XValues.Valuesource = "DateTime"

- and used the setminmax method as you suggested

However, this is now causing problems with my cursor tool:

Before the above change, the 'OnCursorToolChange' event was returning the Series array index position in the 'XVal' parameter. (eg a number 1-2000 if there are 2000 points)

Now the 'OnCursorToolChange' returns a datetime value in 'XVal'.

I was using the following line to get the Y value of a series at the cursor position:

me.txtbox.value = Tchart0.Series(0).Yvalues.Value(XVal)

This no longer works because Xval is a datetime value - any ideas please ?

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 Dec 15, 2008 4:40 pm

Hi Chints,
OK I seem to have solved the initial multiline problem:
I'm glad to hear that.
Before the above change, the 'OnCursorToolChange' event was returning the Series array index position in the 'XVal' parameter. (eg a number 1-2000 if there are 2000 points)

Now the 'OnCursorToolChange' returns a datetime value in 'XVal'.

I was using the following line to get the Y value of a series at the cursor position:

me.txtbox.value = Tchart0.Series(0).Yvalues.Value(XVal)

This no longer works because Xval is a datetime value - any ideas please ?
Here you are mixing series x values with series value indexes and that doesn't always coincide. You should do this:

Code: Select all

    Index = Tchart0.Series(0).XValues.Locate(XVal)
    
    If Index <> -1 Then
        Tchart0.Series(0).YValues.Value (Index)
    End If
Or something like in the interpolating 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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Mon Dec 15, 2008 5:02 pm

Thanks for the support - the 'Locate' method looks like the answer, but it just returns -1 for all cursor positions on the chart.

Does the input parameter for the Locate method need to be in a specific format ?

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 Dec 16, 2008 8:23 am

Hi Chints,

No, the problem here is that XVal need to have exactly the same X value points have in the series otherwise Locate method doesn't find them and returns -1. In that case you'd better try using the interpolating example I pointed you in earlier posts.

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

Chints
Newbie
Newbie
Posts: 7
Joined: Thu Nov 27, 2008 12:00 am

Post by Chints » Tue Dec 16, 2008 10:09 am

I've used the 'snap' setting for the cursor and the Locate function now works fine.

Thanks for your 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 » Tue Dec 16, 2008 10:14 am

Hi Chints,

I'm glad to hear you could solve the problem. This is because Snap moves the cursor to exact series points.
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