Page 1 of 1

Horizontal Bar does not show values

Posted: Thu Jun 17, 2010 5:19 pm
by 9335207
I have read posts about having to swap the X axis and the Y axis when adding data to the Horizontal Bar chart. But everything that I have tried has not worked. When I try to swap the values I get a "Type Mismatch" error.

Is there some type of setting that I need to initiate in order to allow a numeric value to be added to the vertical axis and a text string to be added to the horizontal axis? I have tried both .Add and .AddXY. Any specific examples would be great!

Thanks,

Vince King

Re: Horizontal Bar does not show values

Posted: Fri Jun 18, 2010 3:26 pm
by yeray
Hi Vince King,

The difference is that, as horizontal bars are horizontal, the *length* of the bars are stored in the XValues array, while in the standard Bar series, these are stored in the YValues array.
But when you add your values with the Add method, it woks in the same way in both series. So this works fine:

Code: Select all

Private Sub Form_Load() 
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scHorizBar
  
  Dim i As Integer
  For i = 0 To 4
    TChart1.Series(0).Add Rnd * 100, "value nÂș " + Str$(i), clTeeColor
  Next i
End Sub