A problem finding bar positions using multiple TBarSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Johan Ingemansson
Newbie
Newbie
Posts: 59
Joined: Fri May 28, 2004 4:00 am
Location: Sweden

A problem finding bar positions using multiple TBarSeries

Post by Johan Ingemansson » Thu Aug 10, 2006 9:19 pm

Hi,

I have the following problem, I have an application where the user can calculate simple(1 TBarSeries) or grouped bar diagram(More then 1 TBarSeries), if simple then 1 TBarSeries is created and values are inserted. I also calculate a XX% Confidence intervall for each bar/value. I display the XX% CI with using a TBoxSeries, I manually set the median/Q1/Q3 to the value in the TBarSeries, to display the upper/lower limit in the CI, the whiskers in the TBoxSeries are used and given appropiate values. When I add the TBoxSeries, I set the TBoxSeries.Position = 0(for first bar/value), = 1 for second bar/value,.... and this works fine when I have 1 TBarSeries in the Chart.

The problem occurs when I have more then 1 TBarSeries, then the position isnt the same as with 1 TBarSeries(i.e first bar has position 0, and so on). So my question is, does anyone know how I can get the "position" for each of the bars displayed in the TChart when I have more then 1 TBarSeries?

I would really appreciate any ideas regarding this problem, Im hoping its really easy, and its just something I missed :P

Best Regards,

Johan Ingemansson

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Aug 11, 2006 10:51 am

Hi Johan,

the BoxPlot Series has not been prepared to be displayed as a "Side" like Bar Series but a trick could be to use the following code to set the position of specific box :

Series4.Position:= XPosition + 2*(Series2.BarWidth / 100);

Johan Ingemansson
Newbie
Newbie
Posts: 59
Joined: Fri May 28, 2004 4:00 am
Location: Sweden

A strange problem....

Post by Johan Ingemansson » Tue Sep 19, 2006 2:30 pm

Hi agin,

Ive used the following to calculate the position of the TBoxSeries

Serie4.Position:=Chart.BottomAxis.CalcPosPoint(Chart.Series[0].CalcXPos(0)+Chart.Series[0] as TBarSeries).BarWidth div 2));

And I thought this worked nicely....but the strangest thing occured, when I have the case with for example 2 BarSeries(grouped) but only 1 value in each serie, then the expression above always returns 0... If anyone has any theory how this problem occurs I would be grateful...

Best Regards,

Johan Ingemansson

Johan Ingemansson
Newbie
Newbie
Posts: 59
Joined: Fri May 28, 2004 4:00 am
Location: Sweden

Post by Johan Ingemansson » Thu Sep 21, 2006 3:35 pm

Hi again,

The problem mentioned above only happens if the TBoxSeries.Position is 0 before I make the calculation, if I change the position to for example 1 then the expression above doesnt return 0 and the boxseries are positioned corretly! But, the bars arent positioned in the center of the chart i.e its skewed...so I guess the trick is to "unskew" the chart, does anyone have any ideas to do this?

Best Regards,

Johan Ingemansson

Johan Ingemansson
Newbie
Newbie
Posts: 59
Joined: Fri May 28, 2004 4:00 am
Location: Sweden

Post by Johan Ingemansson » Tue Sep 26, 2006 12:34 pm

Hi !

Ive studied the function CalcPosPoint, in TeEngine, as I see it the following expression : tmp:=tmp*IRange/IAxisSize, will always return 0 in the case when all grouped TBarSeries.Count = 1, since IRange will be 0(maximum=minimum), so to solve this Ive put Maximum = 0.5 and Minimum = -0.5, then It seems to work correclty. I would just like to confirm this hypothesis with anyone, otherwise this monolog will continue forever :P

Best Regards,

Johan Ingemansson

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

Post by Narcís » Tue Oct 03, 2006 9:47 am

Hi Johan,

You're right about what's wrong but we are not sure this is the best solution. I've added this defect (TV52011795) to our bug list to be reviewed for next 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

Post Reply