Page 1 of 1

A problem finding bar positions using multiple TBarSeries

Posted: Thu Aug 10, 2006 9:19 pm
by 9232649
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

Posted: Fri Aug 11, 2006 10:51 am
by Pep
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);

A strange problem....

Posted: Tue Sep 19, 2006 2:30 pm
by 9232649
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

Posted: Thu Sep 21, 2006 3:35 pm
by 9232649
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

Posted: Tue Sep 26, 2006 12:34 pm
by 9232649
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

Posted: Tue Oct 03, 2006 9:47 am
by narcis
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.