Recent

Author Topic: TAChart - Logarithmic Scaling - crash  (Read 504 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
TAChart - Logarithmic Scaling - crash
« on: February 21, 2024, 11:23:18 am »
Attached is a Demo of WP, which I recommend to everybody.
It paints piled bars.

Unfortunately I managed to damage it.
I read

Code: Text  [Select][+][-]
  1. [Window Title]
  2. Fehler
  3.  
  4. [Content]
  5. Projekt project1 hat Exception-Klasse »External: FLT OVERFLOW« ausgelöst.
  6.  
  7.  Bei Adresse 10000587C
  8.  
  9. [Ok]

after having done this:

- add a "Chart Axes Transformation"
- set it to "logarithmic" and watch the chart-scaling changing at design-time
- start the app (chart drawing is at runtime in the create-event)
- read the above error-message

Is this my fault or is there another problem?

wp

  • Hero Member
  • *****
  • Posts: 11915
Re: TAChart - Logarithmic Scaling - crash
« Reply #1 on: February 21, 2024, 12:47:14 pm »
Your steps to reproduce are missing one important part:

Set the AxisIndexY property of the series to the index of the y axis (usually 0). This links the series to the transformation and causes calculation of the logs of the (stacked) y values.

Your error message reports a numerical overflow because the chart calculates the expression 10^(datavalue) in order to find good axis labels. But without the linked AxisIndexY the series does not know about the log transform and passes its values directly, e.g. 521 for the first y value of the first data point, and 10^521 cannot be calculated for the double precision data type. But on the other hand, when AxisIndexY is assigned correctly the series can use the transformation to calculate the log and passes these values (2...3 for 100 to 1000) to the axis labeling routine.

Read this, in other words, also in https://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting#Setting_up_a_logarithmic_axis
« Last Edit: February 21, 2024, 12:49:20 pm by wp »

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: TAChart - Logarithmic Scaling - crash
« Reply #2 on: February 21, 2024, 09:01:39 pm »
thank you so much!

 

TinyPortal © 2005-2018