Page 1 of 1
Horizontal Bar series - a YOrigin for each data value
Posted: Wed Sep 14, 2005 6:12 pm
by 9333098
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
Posted: Thu Sep 15, 2005 8:09 am
by narcis
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.
Posted: Thu Sep 15, 2005 4:00 pm
by 9333098
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
Posted: Fri Sep 16, 2005 7:39 am
by narcis
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.
Posted: Fri Sep 16, 2005 1:43 pm
by 9333098
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 ?
Posted: Fri Sep 16, 2005 2:31 pm
by narcis
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 .