Horizontal Bar series - a YOrigin for each data value

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Horizontal Bar series - a YOrigin for each data value

Post by SteveP » Wed Sep 14, 2005 6:12 pm

Is it possible to have a different YOrigin for each data value of a Horizontal Bar series ? If not, could this feature be added to the Wish List ?

Thanks,
Steve

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Sep 15, 2005 8:09 am

Hi Steve,

I'm afraid this is not possible but you can easily do that creating one bar series for each value so that you can set each value YOrigin as done here:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  for i:=0 to 10 do
  begin
    Chart1.AddSeries(TBarSeries.Create(self));

    With (Chart1[i] as TBarSeries) do
    begin
      AddBar(i,'',clRed);
      UseYOrigin:=true;
      YOrigin:=-i;
      MultiBar:=mbSideAll;
      if (i > 0) then ShowInLegend:=False;
    end;
  end;
end;
I'll also add your request to our wish-list to be considered for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Thu Sep 15, 2005 4:00 pm

Narcis,

I'm afraid that for this applcition, it would be more like
"for i := 0 to 5000" and that would be done 20 times. i.e. there are many data points. I also need a cursor linked to each set of 5000 points for tracking data within each series.

Steve

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 16, 2005 7:39 am

Hi Steve,

Then you could try with Bar3D series which allow you adding an offset to each value. With that and YValue you'll be able to determine each bar origin and height.

You could also consider using High-Low series or custom drawing rectangles on TChart's canvas.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Fri Sep 16, 2005 1:43 pm

I need a rectangle that I can set the vertical axis data value. The rectangle automatically then expands itself symetrically above and below that value half-way to the next and previous data value, analogous to Join Bars. Horizontal bar with BarWidthPercent = 100 accomplished this. As I actually only need two different YOrigin values within each series, perhaps I'll just try using two HorizBar series instead.

High-Low appears to not be for horizontal bars but instead fills its pattern to the next larger data value, instead of filling symetrically around its datavalue. I did not see the pattern for Low doing anything in the chart design editor ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 16, 2005 2:31 pm

Hi Steve,
I need a rectangle that I can set the vertical axis data value. The rectangle automatically then expands itself symetrically above and below that value half-way to the next and previous data value, analogous to Join Bars. Horizontal bar with BarWidthPercent = 100 accomplished this. As I actually only need two different YOrigin values within each series, perhaps I'll just try using two HorizBar series instead.
If I understand correctly what you are trying to achieve, why don't you do something like the snippet below with a TBar3DSeries?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var Index: Integer;
begin
  Chart1.AddSeries(TBar3DSeries.Create(self));
  Index:=0;

  AddBar(1,0,6,Index);
  AddBar(2,5,4,Index);
  AddBar(3,2,2,Index);
  AddBar(4,6,2,Index);
  AddBar(5,8,10,Index);

  Chart1[Index].Marks.Visible:=false;
end;

procedure TForm1.AddBar(X,YOrigin,YValue: Double; SeriesIndex: Integer);
begin
  (Chart1[SeriesIndex] as TBar3DSeries).AddBar(X,YOrigin-(YValue/2),YOrigin+(YValue/2));
end;
High-Low appears to not be for horizontal bars but instead fills its pattern to the next larger data value, instead of filling symetrically around its datavalue. I did not see the pattern for Low doing anything in the chart design editor ?
Besides setting Low values when using AddHighLow method you can only set its format at Series\Format\Low button .
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply