Page 1 of 1
ColorBandTool
Posted: Tue Jun 27, 2006 9:18 pm
by 9525016
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
Posted: Wed Jun 28, 2006 10:05 am
by narcis
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?
Posted: Wed Jun 28, 2006 1:39 pm
by 9525016
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
Posted: Wed Jun 28, 2006 2:04 pm
by narcis
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
Posted: Wed Jun 28, 2006 6:24 pm
by 9525016
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
Posted: Thu Jun 29, 2006 8:26 am
by narcis
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.
Posted: Thu Jun 29, 2006 1:53 pm
by 9525016
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
Posted: Thu Jun 29, 2006 2:14 pm
by narcis
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.
Posted: Thu Jun 29, 2006 2:16 pm
by 9525016
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.
)
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
Posted: Thu Jun 29, 2006 2:21 pm
by narcis
Hi Adrian,
Have you tried using the classes I've just sent you?
Posted: Thu Jun 29, 2006 2:25 pm
by 9525016
Hi Narcís,
Sorry, I just edited my previous post. See there.
Adrian
Posted: Thu Jun 29, 2006 2:28 pm
by narcis
Hi Adrian,
Ok, I've forwarded my previous e-mail to the corrected address. Can you please test if they work at your end?
Posted: Thu Jun 29, 2006 2:30 pm
by 9525016
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
Posted: Mon Jul 10, 2006 11:47 am
by narcis
Hi Adrian,
Could you finally solve this issue using the files I sent?
Posted: Tue Jul 11, 2006 5:59 pm
by 9525016
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