Recent

Author Topic: TChartAxis.OnMarkToText should include axis  (Read 1582 times)

piola

  • Full Member
  • ***
  • Posts: 124
  • Lazarus 2.2, 64bit on Windows 8.1 x64
TChartAxis.OnMarkToText should include axis
« on: October 25, 2019, 03:39:18 pm »
I'd like to suggest the following change:

TChartAxisMarkToTextEvent = procedure (Sender: TObject; var AText: String; AMark: Double) of object;

i.e. the axis firing this event should include a self-reference.

Reason: When dealing with multiple charts and/or multiple axes, it is currently required to create an individual handler for each axis because it is not possible to determine the axis for which to create axis marks for. An example would be an automatic adjustment of unit prefixes (milli, kilo, Mega, etc.) which would imply the same code for each axis, but would require to determine the min/max range of the axis. Currently, this ain't possible.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: TChartAxis.OnMarkToText should include axis
« Reply #1 on: October 25, 2019, 03:55:35 pm »
Makes sense...

The problem is that a change in the parameters of a published event breaks existing projects using this event. The correct way to handle this situation is to deprecate the current event, add a new event with the new parameter combination and remove the old event in some future release.

OK, do you have an idea for the the name of the new event? I think the current name is perfect which makes it difficult to find a new name...

piola

  • Full Member
  • ***
  • Posts: 124
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Re: TChartAxis.OnMarkToText should include axis
« Reply #2 on: October 25, 2019, 04:11:14 pm »
How about "OnGetAxisMarkText"?

wp

  • Hero Member
  • *****
  • Posts: 11916

piola

  • Full Member
  • ***
  • Posts: 124
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Re: TChartAxis.OnMarkToText should include axis
« Reply #4 on: October 27, 2019, 01:12:28 am »
Seems to work properly. Thank you very much!

 

TinyPortal © 2005-2018