Recent

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

piola

  • New Member
  • *
  • Posts: 46
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: 7383
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...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

piola

  • New Member
  • *
  • Posts: 46
Re: TChartAxis.OnMarkToText should include axis
« Reply #2 on: October 25, 2019, 04:11:14 pm »
How about "OnGetAxisMarkText"?

wp

  • Hero Member
  • *****
  • Posts: 7383
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

piola

  • New Member
  • *
  • Posts: 46
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