Page 1 of 1

Horizontal Barchart giving high values

Posted: Fri Apr 24, 2015 12:49 pm
by 16570625
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

Re: Horizontal Barchart giving high values

Posted: Fri Apr 24, 2015 3:46 pm
by yeray
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.

Re: Horizontal Barchart giving high values

Posted: Mon Apr 27, 2015 8:24 am
by 16570625
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.

Re: Horizontal Barchart giving high values

Posted: Mon Apr 27, 2015 2:16 pm
by yeray
Hello,

You can try to set a simple example using "TeeChart Pro Database" shipped with the installation to show us the unexpected result.

Re: Horizontal Barchart giving high values

Posted: Tue Apr 28, 2015 2:59 pm
by 16570625
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

Re: Horizontal Barchart giving high values

Posted: Wed Apr 29, 2015 11:31 am
by yeray
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 11725 times

Re: Horizontal Barchart giving high values

Posted: Wed Apr 29, 2015 2:26 pm
by 16570625
yes, thats correct. That was what I was getting