Board index » delphi » Plz Help :-( MultiBar X Label problem

Plz Help :-( MultiBar X Label problem

Hello :-)

I've a problem using TeeChart v4.2. I'm not sure if this is a bug or a
problem with my code. I have four Bar series (BigDump, ADump, VeryDump
and ClassicDump).  This is my code snippet looks like:

procedure TForm1.Button1Click(Sender: TObject);
begin

  Chart1.BottomAxis.LabelsAngle := 90;

  with BigDump do
  begin
    Clear;
    Marks.Style := smsValue;
    Add(26879.84,'Contempoarary Landscaping', clTeeColor);
    Add(9875.55,'Starbuck Bert Co', clTeeColor);
    Add(8754.22,'Wel Bilt Custom Carpentry', clTeeColor);
    Add(875.664,'Linc Jobe & Co Inc', clTeeColor);
  end;

  with ADump do
  begin
    Clear;
    MultiBar := mbSide;
    Marks.Style := smsValue;
    Add(19417.154,'Contempoarary Landscaping', clTeeColor);
    Add(0.0,'Starbuck Bert Co', clTeeColor);
    Add(315.486,'Linc Jobe & Co Inc', clTeeColor);
  end;

  with VeryDump do
  begin
    Clear;
    Marks.Style := smsValue;
    Add(9540.21,'Contempoarary Landscaping', clTeeColor);
  end;

  with ClassicDump do
  begin
    Clear;
    Marks.Style := smsValue;
    Add(18584.123,'Contempoarary Landscaping', clTeeColor);
    Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);
  end;

end;

I really don't know why but the output of the chart doesn't correspond
to the code I've written. The statement for series ADump

Add(315.486,'Linc Jobe & Co Inc', clTeeColor)

doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn above
the label 'Wel Bilt Custom Carpentry'.  Also the statement for series
ClassicDump

Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);

doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn above
the label 'Starbuck Bert Co'.

Could someone plz tell me what I'm doing wrong ??
Also, is there any **easy** way to do distribution plots with
TeeChart ??

Plz, I'm really desperate and would greatly appreciate any help.

Thanx in advance,

Husein

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:Plz Help :-( MultiBar X Label problem


In article <8jbb2s$41...@nnrp1.deja.com>,

Quote
  cs962...@my-deja.com wrote:

> procedure TForm1.Button1Click(Sender: TObject);
> begin

>   Chart1.BottomAxis.LabelsAngle := 90;

>   with BigDump do
>   begin
>     Clear;
>     Marks.Style := smsValue;
>     Add(26879.84,'Contempoarary Landscaping', clTeeColor);
>     Add(9875.55,'Starbuck Bert Co', clTeeColor);
>     Add(8754.22,'Wel Bilt Custom Carpentry', clTeeColor);
>     Add(875.664,'Linc Jobe & Co Inc', clTeeColor);
>   end;

>   with ADump do
>   begin
>     Clear;
>     MultiBar := mbSide;
>     Marks.Style := smsValue;
>     Add(19417.154,'Contempoarary Landscaping', clTeeColor);
>     Add(0.0,'Starbuck Bert Co', clTeeColor);
>     Add(315.486,'Linc Jobe & Co Inc', clTeeColor);
>   end;

>   with VeryDump do
>   begin
>     Clear;
>     Marks.Style := smsValue;
>     Add(9540.21,'Contempoarary Landscaping', clTeeColor);
>   end;

>   with ClassicDump do
>   begin
>     Clear;
>     Marks.Style := smsValue;
>     Add(18584.123,'Contempoarary Landscaping', clTeeColor);
>     Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);
>   end;

> end;

> I really don't know why but the output of the chart doesn't correspond
> to the code I've written. The statement for series ADump

> Add(315.486,'Linc Jobe & Co Inc', clTeeColor)

> doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn
above
> the label 'Wel Bilt Custom Carpentry'.  Also the statement for series
> ClassicDump

> Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);

> doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn
above
> the label 'Starbuck Bert Co'.

> Could someone plz tell me what I'm doing wrong ??

The problem is that your first series (BigDump) has 4 X values, while
each of the other series has fewer than this.  TeeChart doesn't use the
label text in the Add( ) statement to determine where the bar should be
drawn, instead it is simply based on the number of items added to the
series.

So the first item in all series will be drawn at position one, the
second at position 2 etc.  TeeChart takes the label from the first
series to display at each point on the axis.  To line all items up in
the proper place, you will have to add null values in each series at
the points where there is no value.

So for ClassicDump which only has values that should be displayed at
positions 1 and 4 you would need to do

   with ClassicDump do
   begin
     Clear;
     Marks.Style := smsValue;
     Add(18584.123,'Contempoarary Landscaping', clTeeColor);
     AddNull;
     AddNull;
     Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);
   end;

Hope this is clear!

Regards,
Mark.

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:Plz Help :-( MultiBar X Label problem


Thanx a million MARK :-)

Cheers,
Husein

In article <8jcgk0$u5...@nnrp1.deja.com>,
  Mark Graham <m...@sci-clone.co.uk> wrote:

Quote
> In article <8jbb2s$41...@nnrp1.deja.com>,
>   cs962...@my-deja.com wrote:

> > procedure TForm1.Button1Click(Sender: TObject);
> > begin

> >   Chart1.BottomAxis.LabelsAngle := 90;

> >   with BigDump do
> >   begin
> >     Clear;
> >     Marks.Style := smsValue;
> >     Add(26879.84,'Contempoarary Landscaping', clTeeColor);
> >     Add(9875.55,'Starbuck Bert Co', clTeeColor);
> >     Add(8754.22,'Wel Bilt Custom Carpentry', clTeeColor);
> >     Add(875.664,'Linc Jobe & Co Inc', clTeeColor);
> >   end;

> >   with ADump do
> >   begin
> >     Clear;
> >     MultiBar := mbSide;
> >     Marks.Style := smsValue;
> >     Add(19417.154,'Contempoarary Landscaping', clTeeColor);
> >     Add(0.0,'Starbuck Bert Co', clTeeColor);
> >     Add(315.486,'Linc Jobe & Co Inc', clTeeColor);
> >   end;

> >   with VeryDump do
> >   begin
> >     Clear;
> >     Marks.Style := smsValue;
> >     Add(9540.21,'Contempoarary Landscaping', clTeeColor);
> >   end;

> >   with ClassicDump do
> >   begin
> >     Clear;
> >     Marks.Style := smsValue;
> >     Add(18584.123,'Contempoarary Landscaping', clTeeColor);
> >     Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);
> >   end;

> > end;

> > I really don't know why but the output of the chart doesn't
correspond
> > to the code I've written. The statement for series ADump

> > Add(315.486,'Linc Jobe & Co Inc', clTeeColor)

> > doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn
> above
> > the label 'Wel Bilt Custom Carpentry'.  Also the statement for
series
> > ClassicDump

> > Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);

> > doesn't draw a bar at the label 'Linc Jobe & Co Inc'.  It's drawn
> above
> > the label 'Starbuck Bert Co'.

> > Could someone plz tell me what I'm doing wrong ??

> The problem is that your first series (BigDump) has 4 X values, while
> each of the other series has fewer than this.  TeeChart doesn't use
the
> label text in the Add( ) statement to determine where the bar should
be
> drawn, instead it is simply based on the number of items added to the
> series.

> So the first item in all series will be drawn at position one, the
> second at position 2 etc.  TeeChart takes the label from the first
> series to display at each point on the axis.  To line all items up in
> the proper place, you will have to add null values in each series at
> the points where there is no value.

> So for ClassicDump which only has values that should be displayed at
> positions 1 and 4 you would need to do

>    with ClassicDump do
>    begin
>      Clear;
>      Marks.Style := smsValue;
>      Add(18584.123,'Contempoarary Landscaping', clTeeColor);
>      AddNull;
>      AddNull;
>      Add(19741.108,'Linc Jobe & Co Inc', clTeeColor);
>    end;

> Hope this is clear!

> Regards,
> Mark.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.

Other Threads