ColorBandTool

TeeChart for ActiveX, COM and ASP
Post Reply
Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

ColorBandTool

Post by Vivo » Tue Jun 27, 2006 9:18 pm

Am I correct in that the color band tool can not be used on a custom axis?

Also, can I put only a partial colorband up? or am I going to have to draw it using on after draw?


Adrian

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 Jun 28, 2006 10:05 am

Hi Adrian,
Am I correct in that the color band tool can not be used on a custom axis?
No, color band tools can also be assigned custom axes, i.e.:

Code: Select all

    With TChart1.Tools.Items(0).asColorband
        .Axis = TChart1.Axis.Custom(0)
        .StartValue = 100
        .EndValue = 200
    End With

Also, can I put only a partial colorband up? or am I going to have to draw it using on after draw?
I'm not sure of what are you exactly trying to get, can you please be more specific on what a "partial colorband up" consists? Do you mean a colorband not covering the full axis range?
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Wed Jun 28, 2006 1:39 pm

Do you mean a colorband not covering the full axis range?
Yes. If attached to a vertical axis, have it only show up between x and x'. By default, I think the colour band will span the entire x axis, between y and y'. Is that correct?

Thanks,


Adrian

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 Jun 28, 2006 2:04 pm

Hi Adrian,

This is not possible with a color band. However, you can achieve that using a rectangle tool and doing something like this:

Code: Select all

Dim Go As Boolean

Private Sub Form_Load()
    For i = 0 To 100
        TChart1.Series(0).Add Rnd * 100, "", clTeeColor
    Next
    
    TChart1.Tools.Items(0).asRectangle.Shape.Transparency = 50
    
    Go = True
    TChart1.Environment.InternalRepaint
End Sub

Private Sub TChart1_OnAfterDraw()
    If Go Then
        With TChart1.Tools.Items(0).asRectangle
            .Left = TChart1.Axis.Left.Position
            .Top = TChart1.Series(0).CalcYPosValue(50)
            .Height = TChart1.Series(0).CalcYPosValue(20) - .Top
            .Width = TChart1.Series(0).CalcXPosValue(40) - .Left
        End With
        
        Go = False
    End If
End Sub

Private Sub TChart1_OnRectangleToolDragging()
    TChart1.Tools.Items(0).asRectangle.Left = TChart1.Axis.Left.Position
End Sub

Private Sub TChart1_OnRectangleToolResizing()
    TChart1.Tools.Items(0).asRectangle.Left = TChart1.Axis.Left.Position
End Sub
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Wed Jun 28, 2006 6:24 pm

No, color band tools can also be assigned custom axes, i.e.:

Code: Select all

With TChart1.Tools.Items(0).asColorband
        .Axis = TChart1.Axis.Custom(0)
        .StartValue = 100
        .EndValue = 200
    End With
Uh, how is this done in MFC/C++?

I've tried the following without success:

Code: Select all

		CAxis& axis = tchart.GetAxis().GetCustom(m_AxisIds[index]);
		CToolList & tools = tchart.GetTools();
		CColorBandTool & colourBand = tools.GetItems(m_ColourBand).GetAsColorband();
		COleVariant iDispatch;
		iDispatch.vt = VT_DISPATCH;
		iDispatch.pdispVal = axis.m_lpDispatch;
		colourBand.SetAxis(iDispatch.Detach());
How do I do this correctly?
This is not possible with a color band. However, you can achieve that using a rectangle tool and doing something like this:
There is no rectangle tool. I'm using TChart 7.0.0.3. And due to the tight schedule we have, I am not authorised to upgrade to the new version.

However, for reference, what compatibility issues are there if I were to upgrade to 7.0.0.8, and would I just do the Project->Add To Project->Components and Controls->TeeChart Pro Activex control v7 on the newly installed TChart to update the wrappers? Also, what other issues should I be aware of. What sort of testing regime do you do?

Thanks,


Adrian
Last edited by Vivo on Wed Jun 28, 2006 6:51 pm, edited 1 time in total.

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 Jun 29, 2006 8:26 am

Hi Adrian,

Yes, you are right, rectangle tool wasn't defined. However we have recently fixed this as you can read in this message. Here you'll find the instructions to solve this and some code on how to use TeeChart tools in VC++ applications.
However, for reference, what compatibility issues are there if I were to upgrade to 7.0.0.8, and would I just do the Project->Add To Project->Components and Controls->TeeChart Pro Activex control v7 on the newly installed TChart to update the wrappers? Also, what other issues should I be aware of. What sort of testing regime do you do?


There won't be any compatibilty issues as we are specially concerned on keeping TeeChart being backward's compatible. To upgrade to v7.0.0.8, at least, you should unregister existing TeeChart7.ocx and register the new one. The easiest way is uninstalling existing one using the binary installer and install latest version. Also, you'll find v7 ActiveX version release notes here, so that you can check what is being changed in each release.
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Thu Jun 29, 2006 1:53 pm

Yes, you are right, rectangle tool wasn't defined. However we have recently fixed this as you can read in this message. Here you'll find the instructions to solve this and some code on how to use TeeChart tools in VC++ applications.
Yeah, I saw that one, but I cannot easily use a CRectangle if that wrapper class does not exist. Would you be able to pass me the missing wrapper classes to me?

Thanks,


Adrian

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 Jun 29, 2006 2:14 pm

Hi Adrian,

As told in the message I pointed, the classes are available at our attachments newsgroups. However, I've already sent them to your forums contact e-mail address.
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Thu Jun 29, 2006 2:16 pm

Hi Narcís,

Additionally, if I use tchart.GetTools().Add(tcRectangle) a First-chance exception is thrown (0xe06d7363). So I do not think this is going to work anyway.

Oh, and I have discovered that my email address is not correct. I've corrected it now. (Had an extra letter in there. :oops:)

I've also tried to use

Code: Select all

	CTChart& tchart = GetTChart();
	CToolList & tools = tchart.GetTools();
		CAxis & axis = tchart.GetAxis().GetCustom(m_AxisIds[index]);
		m_ColourBand = tools.Add(tcColorband);
		CColorBandTool & colourBand = tools.GetItems(m_ColourBand).GetAsColorband();
		VARIANT iAxis;
		iAxis.vt = VT_DISPATCH;
		iAxis.pdispVal = axis;
		colourBand.SetAxis(iAxis);
as described in that other post but although it shows up, it does not move when I move that axis around.

Thanks,


Adrian
Last edited by Vivo on Thu Jun 29, 2006 2:24 pm, edited 1 time in total.

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 Jun 29, 2006 2:21 pm

Hi Adrian,

Have you tried using the classes I've just sent you?
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Thu Jun 29, 2006 2:25 pm

Hi Narcís,

Sorry, I just edited my previous post. See there.


Adrian

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 Jun 29, 2006 2:28 pm

Hi Adrian,

Ok, I've forwarded my previous e-mail to the corrected address. Can you please test if they work at your end?
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Thu Jun 29, 2006 2:30 pm

I didn't get any further than what I said in the prevous post:
Additionally, if I use tchart.GetTools().Add(tcRectangle) a First-chance exception is thrown (0xe06d7363). So I do not think this is going to work anyway.
Any ideas?

Thanks,


Adrian

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 Jul 10, 2006 11:47 am

Hi Adrian,

Could you finally solve this issue using the files I sent?
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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Tue Jul 11, 2006 5:59 pm

Could you finally solve this issue using the files I sent?
No, as I said before:
Additionally, if I use tchart.GetTools().Add(tcRectangle) a First-chance exception is thrown (0xe06d7363). So I do not think this is going to work anyway.
However, I was able to get the handle to the Device Context and was able to implement my own semi-transparent rectangle.

Thanks,


Adrian

Post Reply