Labels for MultiBar=mbSideAll on all Series

TeeChart for ActiveX, COM and ASP
Post Reply
Graham
Newbie
Newbie
Posts: 4
Joined: Mon Aug 17, 2015 12:00 am

Labels for MultiBar=mbSideAll on all Series

Post by Graham » Wed Sep 30, 2015 1:16 am

I saw a reference to this wish list entry in the VCL forum: TV52014973 under a 2009 post with subject: "Side All, Labels on Axis X".

It relates to putting X-Axis labels on all columns of a bar chart when MultiBar= 4 i.e. mbSideAll in cases where you have more then one series. Some code was proposed, seebelow, but I cannot get it to work.

Code: Select all

  tmpPos:=0;
  DBChart.Axes.Bottom.Items.Clear;
  for i:=0 to DBChart.SeriesCount-1 do
  begin
    for j:=0 to DBChart[i].Count-1 do
    begin
      DBChart.Axes.Bottom.Items.Add(tmpPos,DBChart[i].Labels.Labels[j]);
      Inc(tmpPos);
    end;
  end;
I am using TeeChart AX 15.0.0.2, on Win8.1(64) with dBase, so I have to convert the code, but even then certain methods do not exist.

Regards,
Graham

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Labels for MultiBar=mbSideAll on all Series

Post by Yeray » Fri Oct 02, 2015 11:28 am

Hello,
Graham wrote:I saw a reference to this wish list entry in the VCL forum: TV52014973 under a 2009 post with subject: "Side All, Labels on Axis X".
Yes, here it is.
Graham wrote:It relates to putting X-Axis labels on all columns of a bar chart when MultiBar= 4 i.e. mbSideAll in cases where you have more then one series. Some code was proposed, seebelow, but I cannot get it to work.
That was an example in Delphi for TeeChart VCL/FMX; in ActiveX some properties/functions may be a bit different.
This works fine for me in VB6:

Code: Select all

Private Sub Form_Load() 
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scBar
  TChart1.AddSeries scBar
  TChart1.AddSeries scBar
  
  Dim i, j As Integer
  For i = 0 To TChart1.SeriesCount - 1
    TChart1.Series(i).FillSampleValues 4
    For j = 0 To TChart1.Series(i).Count - 1
      TChart1.Series(i).PointLabel(j) = "Series " + Str$(i) + ", Point " + Str$(j)
    Next j
  Next i
  
  TChart1.Series(0).asBar.MultiBar = mbSideAll
  TChart1.Axis.Bottom.Labels.Angle = 90
  
  Dim tmpPos As Integer
  tmpPos = 0
  TChart1.Axis.Bottom.Labels.Clear
  For i = 0 To TChart1.SeriesCount - 1
    For j = 0 To TChart1.Series(i).Count - 1
      TChart1.Axis.Bottom.Labels.Add tmpPos, TChart1.Series(i).PointLabel(j)
      tmpPos = tmpPos + 1
    Next j
  Next i
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Graham
Newbie
Newbie
Posts: 4
Joined: Mon Aug 17, 2015 12:00 am

Re: Labels for MultiBar=mbSideAll on all Series

Post by Graham » Sun Oct 04, 2015 8:30 pm

Many thanks, that is a great help.

Graham

Post Reply