[Solved] question regarding the ChartEditorDemo lazarus / 55-TAChart ---------------------------------------------------------------------- Muso · 2021-07-06 14:02 I use the ChartEditorDemo and latest Lazarus trunk. When I double-click on the x-axis, the dialogs opens to change the axis. There I uncheck the "Maximum" to change the maximum of the axis. However, I see there "0,00". I wanted to change this behavior to show me the current maximum of the axis. In the example this would be the value "10,0". My problem is that I cannot find how to get the info what the current shown maximum value of the axis is. For an x-axis I can get this value because I know the data, but for an y-axis I get sensor data and don't know the y-values. I also have 9 data channels and could scan through all of them to get the maximum of all the channel maximums but maybe there is a simple method to just get the currently displayed maximum value of a chart axis. ---------------------------------------------------------------------- Muso · 2021-07-06 17:17 I have another question: - I click on the left axis and in the axis dialog, I uncheck the minimum and enter there a value of 20, see the attached screenshot result: nothing happens, also not after closing the dialog. The y-axis range is unchanged Also changing the range of the x-axis does not work. ---------- Minor issue, I guess the Maximal value must be larger equal than the minimal. The dialog allows max < min but this is confusing. In the demo nothing happens anyway. ---------------------------------------------------------------------- Muso · 2021-07-06 18:17 Quote from: Muso on July 06, 2021, 07:17:55 pmMinor issue, I guess the Maximal value must be larger equal than the minimal. The dialog allows max < min but this is confusing. In the demo nothing happens anyway. Attached is a fix for this. The attached file also fixes the following issue: - when only setting a maximal value but keeping the minimum at "auto", then the result is strange when the axis has an autoscale axis transformation ---------------------------------------------------------------------- wp · 2021-07-06 19:02 Quote from: Muso on July 06, 2021, 04:02:36 pmMy problem is that I cannot find how to get the info what the current shown maximum value of the axis is. In trunk an already-existing method for this task is public, and returns the correct value when the series is not explicitely assigned to an axis --> new TChart method GetAxisRange(Axis: TChartAxis, out Min, Max: Double). This fixes the request for displaying the real axis limits in the axis parameter dialog. ---------------------------------------------------------------------- Muso · 2021-07-06 19:25 Quote from: wp on July 06, 2021, 09:02:14 pmTChart method GetAxisRange(Axis: TChartAxis, out Min, Max: Double). Thanks. but I have today's trunk and cannot find this method. In what unit can it be found? ---------------------------------------------------------------------- wp · 2021-07-06 19:33 It's a TChart method (unit TAGraph). ---------------------------------------------------------------------- Muso · 2021-07-06 19:35 Quote from: wp on July 06, 2021, 09:33:53 pmIt's a TChart method (unit TAGraph). I have Lazarus 2.3.0 r65379 FPC 3.2.2 x86_64-win64-win32/win64 and there in TAGraph.pas, there is no method GetAxisRange defined. ---------------------------------------------------------------------- Muso · 2021-07-06 19:39 Ah you have implemented it half an hour ago -> I will check this out right now ---------------------------------------------------------------------- wp · 2021-07-06 19:40 65379 is too old. The new code is in r65384 (GetAxisRange) and 65385 (ChartDemo). ---------------------------------------------------------------------- Muso · 2021-07-06 19:43 Quote from: wp on July 06, 2021, 09:40:06 pm65379 is too old. The new code is in r65384 (GetAxisRange) and 65385 (ChartDemo). I think there is a bug in https://github.com/graemeg/lazarus/commit/11bae410d0c609f70e9dd73203b5 30e1f21a00cd Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   GetChart.GetAxisRange(Axis, mn, mx);  if Axis.Range.UseMax then    seMaximum.Value := Axis.Range.Max  else   seMaximum.Value := mx;  if Axis.Range.UseMin then    seMinimum.Value := Axis.Range.Min  else   seMinimum.Value := mn; Because when the Range max is used, this must be displayed then, not the axis max. Or is in this case the range max always also mx? ---------------------------------------------------------------------- Muso · 2021-07-06 20:04 Quote from: Muso on July 06, 2021, 09:39:39 pmAh you have implemented it half an hour ago -> I will check this out right now Many thanks! Works fine.  This issue remains: https://forum.lazarus.freepascal.org/index.php/top ic,55265.msg410910.html#msg410910 -> changing the min/max does nothing, see attached screenshot. I see that it works when max > the max of the line series, but my use case is to purposely set a max that is smaller than the overall max of a series. ---------------------------------------------------------------------- wp · 2021-07-06 21:31 Quote from: Muso on July 06, 2021, 10:04:09 pmmy use case is to purposely set a max that is smaller than the overall max of a series. This is not possible in the demo which is based on Axis.Range. Because the Axis.Range is expanded by the range covered by the series. The only way to make the axis range narrower than the series range is to use the Chart.Extent. But the Chart.Extent is in graph units because when you work with an AutoScaleAxisTransformation there can be several axes at the same place. Therefore Chart.Extent will not affect the individual axes, only the invisible axis with graph coordinates, in this case. It really gets complicated now... ---------------------------------------------------------------------- wp · 2021-07-06 21:53 Quote from: Muso on July 06, 2021, 08:17:26 pmThe attached file also fixes the following issue: - when only setting a maximal value but keeping the minimum at "auto", then the result is strange when the axis has an autoscale axis transformation Sorry to reject this, but I want to be able to check the auto-ranging checkboxes independently. In trunk there is a more general validation which can also be extended to other error cases. Validation is not performed during input or when the erroneous control is exited because in case of dependent controls this can lead to a disastrous "user experience". I prefer to validate input when the form is closed (or in case of the "all-in-one" form, when the visible page changes). ---------------------------------------------------------------------- Muso · 2021-07-06 23:56 Quote from: wp on July 06, 2021, 11:53:09 pmSorry to reject this, but I want to be able to check the auto-ranging checkboxes independently. The problem is that in my real-life program I get totally wrong axis ranges when I only set e.g. maximum and keep minimum at "Auto" (having a right axis, and each left and right axis with autoscale axis transformation). Quote from: wp on July 06, 2021, 11:31:53 pmQuote from: Muso on July 06, 2021, 10:04:09 pmmy use case is to purposely set a max that is smaller than the overall max of a series. This is not possible in the demo which is based on Axis.Range. Because the Axis.Range is expanded by the range covered by the series. OK, no problem. I just thought the demo should demonstrate everything that is possible. ---------------------------------------------------------------------- Muso · 2021-07-07 00:45 There is a bug in the demo: - click on the x-axis - in the appearing dialog invert the scale and close the dialog with OK - click on the x-axis again - do nothing but close the dialog with OK - and once more click on the x-axis result: the inversion information is now lost ---------------------------------------------------------------------- wp · 2021-07-07 08:06 Fixed in r65393 ---------------------------------------------------------------------- Muso · 2021-07-07 12:00 Quote from: wp on July 07, 2021, 10:06:21 amFixed in r65393 Many thanks!