bug in percentage statistics

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Tarnz
Newbie
Newbie
Posts: 2
Joined: Fri Mar 19, 2004 5:00 am
Location: Los Angeles, CA
Contact:

bug in percentage statistics

Post by Tarnz » Wed Mar 31, 2004 9:41 am

Hi,

I am using TeeChart v7 to produce bar charts from live data with percent style marks. I noticed right away that my percentage values were off. On close examination, the first item value was erroneously being counted twice (instead of only once). If the first item value was the only non-zero value in the series, then the chart displayed 50% (wrong) instead of the 100% (correct).

Since I have the source code and needed the routines to work right away, I went in and located the bug and fixed it. In TeEngine's TChartValueList.RecalcStats procedure (around line 4994), the two lines:
  • FTotal:=tmpValue;
    FTotalABS:=Abs(tmpValue);
I replaced with:
  • FTotal:=0;
    FTotalABS:=0;
and then the pecentage statistics became accurate. Alternately, one could fix the bug by changing the starting index of the "for t" loop from "StartIndex" to "StartIndex+1", but the above approach reads better as source code.

For those users without source, one workaround would be to avoid using the first series value, leaving it at 0.

Please double-check my conclusion, and if this post represents a new bug fix, please incorporate it into future releases.

Thank you,
Harry (HT)

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Mar 31, 2004 7:12 pm

Hi, Harry.

Thanks for the report. I already discovered (and added a fix) a week ago in onother thread. I''ve also logged this to our bug list so that we won't forget to include the fix in next maintenance release.
Marjan Slatinek,
http://www.steema.com

Scot
Newbie
Newbie
Posts: 2
Joined: Wed Mar 10, 2004 5:00 am

Post by Scot » Fri Apr 02, 2004 9:23 pm

I would like to get this fix ASAP. As I don't have the source what are my options?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Apr 05, 2004 9:05 am

Hi, Scott.

If you don't have source code then you'll have to use series OnGetMarkText event to:
a) calculate totals (simple for i := 0 to Series.Count -1 loop)
b) calculate percentage for each point
c) transform calculated value to string and pass it to MarkText parameter in the OnGetMarkText event.
Marjan Slatinek,
http://www.steema.com

Post Reply