Page 1 of 1

How to use the ColorBand?

Posted: Thu Nov 08, 2012 2:23 pm
by 16663930
Dear Steema support,

I want to add a colorband to my chart,my code as followed:

int m_nCurrentBand=GetTools().Add(tcColorband);
COleVariant colorBandAxis;
colorBandAxis.vt = VT_DISPATCH;
colorBandAxis.pdispVal = GetAxis().GetLeft().m_lpDispatch;
GetTools().GetItems(m_nCurrentBand).GetAsColorband().SetAxis(colorBandAxis);

but the error which says that an Invalid Axis type!



Any help will be appreciated!

Jerry

Re: How to use the ColorBand?

Posted: Fri Nov 09, 2012 3:51 pm
by yeray
Hi Jerry,

I've just tried the following code with TeeChart ActiveX v2012.0.0.9 in VB6 and it works without problems.

Code: Select all

  TChart1.Aspect.View3D = False
  TChart1.AddSeries scFastLine
  TChart1.Series(0).FillSampleValues
  TChart1.Tools.Add tcColorband
  With TChart1.Series(0).YValues
    TChart1.Tools.Items(0).asColorband.Axis = TChart1.Axis.Left
    TChart1.Tools.Items(0).asColorband.StartValue = .Minimum + (.Maximum - .Minimum) / 4
    TChart1.Tools.Items(0).asColorband.EndValue = .Minimum + (.Maximum - .Minimum) / 2
  End With
Are you using the latest TeeChart ActiveX version?
If you still have problems with it, could you please arrange a simple example project we can run as-is to reproduce the problem here?