Horizontal Barchart giving high values

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
agholor
Newbie
Newbie
Posts: 7
Joined: Thu Nov 06, 2014 12:00 am

Horizontal Barchart giving high values

Post by agholor » Fri Apr 24, 2015 12:49 pm

Hi

I have come accross a strange issue and not sure how to proceed. When I run the same code for all other charts the data looks ok except for the horizontal chart where the values come out being very high. I have attached two charts the vertical is the correct data that is being passed from the datasource but the horizontal one is coming out with values like 41,527.
This seems to be occuring because I am setting the ChartSeries.XValues.ValueSource := '#SUM#' + FieldName on a Horizontal barchart. However, It seems to work when I set ChartSeries.YValues.ValueSource := '#SUM#' + FieldName for a vertical bar chart. This logic worked on the version 8 TeeChart so I was wondering if there is something I need to do for the new version of the TeeChart
Attachments
Horizontal.jpg
Wrong Data
Horizontal.jpg (37.71 KiB) Viewed 12202 times
Vertical.jpg
Correct Data
Vertical.jpg (25.79 KiB) Viewed 12172 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Horizontal Barchart giving high values

Post by Yeray » Fri Apr 24, 2015 3:46 pm

Hello,

I'm not sure if the problem is in how are you configuring the data for the HorizBar or if there's a problem in the component.
Could you please arrange a simple example project we can run as-is to reproduce the problem here?

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

agholor
Newbie
Newbie
Posts: 7
Joined: Thu Nov 06, 2014 12:00 am

Re: Horizontal Barchart giving high values

Post by agholor » Mon Apr 27, 2015 8:24 am

Hi

It maybe something to do with our implementation but it would not be that easy to create an example because it was all database driven. I spent some time comparing the source code of version 8 and version 2014 and what I found was that in the unit DBChart.pas, the Procedure ProcessRecord(const tmpSeries:TDBChartSeries) had the lines below that were commented in 2014. Uncommenting those lines brought the numbers back to normal for a horizontal chart
else
tmpNotMand:=0;


However, when the data wasn't ordered it didn't look right so in Procedure AddToSeries(const DestSeries:TDBChartSeries) I commented out the ASeries.AddXY(..) i.e

//if (GroupPrefix=dgNone) then
ASeries.Add(tmpMand,tmpXLabel,tmpColor)
// else
// ASeries.AddXY(tmpNotMand,tmpMand,tmpXLabel,tmpColor);


This seems to make the horizontal chart work but I am not sure what the full implications of those changes are.

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Horizontal Barchart giving high values

Post by Yeray » Mon Apr 27, 2015 2:16 pm

Hello,

You can try to set a simple example using "TeeChart Pro Database" shipped with the installation to show us the unexpected result.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

agholor
Newbie
Newbie
Posts: 7
Joined: Thu Nov 06, 2014 12:00 am

Re: Horizontal Barchart giving high values

Post by agholor » Tue Apr 28, 2015 2:59 pm

I have modified the DB project you included in the example to show the error with the horizontal chart. When you change the series to a Barchart, the numbers are correct. The project was modified using Delphi XE6
Attachments
DBChart Aggregates.zip
(6.91 KiB) Downloaded 778 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Horizontal Barchart giving high values

Post by Yeray » Wed Apr 29, 2015 11:31 am

Hello,

I had to change the Database name from "DBDEMOS" to "TeeChart Pro Database", clear and add all the fields on the table and to run the example here.
So I want to check I'm getting the same result than you:
2015-04-29_1319.png
2015-04-29_1319.png (30.74 KiB) Viewed 12064 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

agholor
Newbie
Newbie
Posts: 7
Joined: Thu Nov 06, 2014 12:00 am

Re: Horizontal Barchart giving high values

Post by agholor » Wed Apr 29, 2015 2:26 pm

yes, thats correct. That was what I was getting

Post Reply