Recent

Author Topic: [implemented] [patch] for LiveView  (Read 4714 times)

Muso

  • Sr. Member
  • ****
  • Posts: 356
[implemented] [patch] for LiveView
« on: July 22, 2021, 03:14:55 am »
While working in the LiveView, I encountered a missing functionality.

@wp, could you please add this procedure as public to TAChartLiveView.pas?:

Code: Pascal  [Select][+][-]
  1. procedure TChartLiveView.StoreSingleAxisRange(const axis: TChartAxis);
  2. { procedure to store properties of a single axis }
  3. var
  4.   axisNumber: integer = -1;
  5.   i: integer;
  6. begin
  7.   for i := 0 to FChart.AxisList.Count-1 do
  8.     if FChart.AxisList[i] = axis then
  9.       axisNumber := i;
  10.   if axisNumber = -1 then
  11.     exit;
  12.   FAxisRanges[axisNumber].Max := axis.Range.Max;
  13.   FAxisRanges[axisNumber].Min := axis.Range.Min;
  14.   FAxisRanges[axisNumber].UseMax := axis.Range.UseMax;
  15.   FAxisRanges[axisNumber].UseMin := axis.Range.UseMin;
  16. end;

This procedure is necessary in the following case:
- chart has 2 y-axes
- user started LiveView with both axes range at AUTO (no UseMin/Max for both axes)
- now he decides to set a custom range for the right axis
- LiveView must now be informed about this and the existing procedure TChartLiveView.StoreAxisRanges cannot be used, because while LiveView is running it changed the range of the left axis. The user only set a custom range for the right axis, the left one must be kept as is. So we need a procedure to update a single axis.
« Last Edit: July 23, 2021, 12:52:47 am by Muso »

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: [patch] for LiveView
« Reply #1 on: July 22, 2021, 09:51:00 am »
I only showed you the basic steps how to achieve inversion of individual axes in a multi-axis chart. Adaption into the rest of the charteditor demo is still open, and I would like to leave this to you as an exercise to learn how the building blocks cooperate. Simly search for FAxis.Inverted - this is not valid any more, you replace it by the new transformation code.
« Last Edit: July 22, 2021, 11:30:35 pm by wp »

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [patch] for LiveView
« Reply #2 on: July 22, 2021, 11:10:34 am »
I only showed you the basic steps how to achieve inversion of individual axes in a multi-axis chart.

This patch has nothing to do with the inversion. It is in necessary to be able to use LiveView with the ExtentY setting Auto as I described.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: [patch] for LiveView
« Reply #3 on: July 22, 2021, 11:18:31 am »
Sorry I posted in the wrong thread...

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: [patch] for LiveView
« Reply #4 on: July 22, 2021, 11:48:26 pm »
Added methods StoreAxisRange(Axis) and RestoreAxisRange(Axis). Not sure if they are really needed, but it is not harmful to have them since they can be called in the loops of StoreAxisRanges and RestoreAxisRanges (plural)

Muso

  • Sr. Member
  • ****
  • Posts: 356
Re: [patch] for LiveView
« Reply #5 on: July 23, 2021, 12:52:27 am »
Added methods StoreAxisRange(Axis) and RestoreAxisRange(Axis). Not sure if they are really needed, but it is not harmful to have them since they can be called in the loops of StoreAxisRanges and RestoreAxisRanges (plural)

many thanks!

What do you mean with not sure if needed. In my initial post I described the use case. How can I achieve the same without the new procedures, meaning update the status of a single axis only?

I hope the new procedures make it into Laz 2.2.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: [implemented] [patch] for LiveView
« Reply #6 on: July 23, 2021, 11:18:37 am »
What do you mean with not sure if needed.
Nothing specific. Just from experience: some things can be achieved more easily when not the first path is taken.

I hope the new procedures make it into Laz 2.2.
I am hesitant to request back-ports since the move to git is about to happen at any time. But since there is another request in the list I added my commits of yesterday, too, so that I cannot forget about them. (https://wiki.freepascal.org/Lazarus_2.2_fixes_branch#Submitted_by_developer_.2F_committer.2C_tested.2C_waiting_to_be_merged).
« Last Edit: July 23, 2021, 11:22:48 am by wp »

 

TinyPortal © 2005-2018