[Implemented] How to auto-scale an axis depending on the shown extent lazarus / 55-TAChart ---------------------------------------------------------------------- Muso · 2021-07-06 14:08 I have a program that displays sensor data. At the beginning the sensor needs some time until it is in full operation. Therefore the sensor data starts at zero and then raises to e.g. 10. Then real measurements can start. The range of the interesting data is therefore in the range 10 - e.g. 20. Therefore i implemented chart scrolling by setting a logical extent to the e.g. last 5 minutes. The y-axis has and also should have the whole time the feature to auto-scale the range. At the moment when showing the full chart, this means the y-range us automatically 0 - 20, but since only the last 5 min are shown, the range should be 10 - 20 or whatever the y-data in this x-range is. I could scan all data line series to find the min/max in the last 5 min and then set the axis min/max accordingly. But maybe there is a better solution? ---------------------------------------------------------------------- wp · 2021-07-07 08:21 Quote from: Muso on July 06, 2021, 04:08:54 pmI could scan all data line series to find the min/max in the last 5 min and then set the axis min/max accordingly. But maybe there is a better solution? The series has a method FindYRange for this purpose: 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 procedure TChartSeries.FindYRange(AXMin, AXMax: Double;  var AYMin, AYMax: Double); ---------------------------------------------------------------------- Muso · 2021-07-07 14:55 Quote from: wp on July 07, 2021, 10:21:42 amQuote from: Muso on July 06, 2021, 04:08:54 pmI could scan all data line series to find the min/max in the last 5 min and then set the axis min/max accordingly. But maybe there is a better solution? The series has a method FindYRange for this purpose: 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 procedure TChartSeries.FindYRange(AXMin, AXMax: Double;  var AYMin, AYMax: Double); Yes, this is what I meant with scan all series. I thought that there is maybe a method for the chart itself that one can adjust to take e.g. only the data of the current extent to set the axis range when the axis range setting is "Auto". If there is no such method, I will go on and implement the series scan solution. ---------------------------------------------------------------------- wp · 2021-07-07 16:20 When I answered your very first question to this overall topic, I was not aware that you are using trunk, and pushed you on the track with the extents. However, not so long ago there was a similar request, and it ended that I added a TChartLiveView component to trunk which does most of the scrolling automatically, controlled by a few properties (https://wiki.lazarus.freepascal.org/TAChart_documentation#Live_View). I am not sure if it is sufficient for your overall, more complex, needs, but you should have a look a the liveview demo in the TAChart demo folder. ---------------------------------------------------------------------- Muso · 2021-07-07 17:39 Quote from: wp on July 07, 2021, 06:20:01 pmthat I added a TChartLiveView component to trunk This is amazing and exactly what I need. I will try if and how I can use it for ma real-life program because it is almost ready. Concerning the liveview demo, I think there is an issue: - start program - go to live mode - add at least 6 data points (so that you get the scrolling effect) - leave the live mode - add more data points result: you don't see any change. I thought when leaving the live mode one sees the full x-range ---------------------------------------------------------------------- Muso · 2021-07-07 19:39 I implemented the Live view feature and it works so far, except of one thing that seems to be a bug: - see attached a screenshot without the live view. You can see that the data jumped from zero to around 7 - I turn now the Live view on and display only the last minute. But then the y-axis range is wrong, see attached. I have as extent "lveAuto". My expectation that then the y-axis range is the min/max of the currently displayed data. But my max overall data is 10 while the y-axis range max is in Live view 200. I have for the left axis an auto scale axis transformation. The data series is connected in y to the y-axis and in x to the x-axis. ---------------------------------------------------------------------- wp · 2021-07-07 20:28 Can you post a project so that I can see exactly what is happening? ---------------------------------------------------------------------- Muso · 2021-07-07 21:40 Quote from: wp on July 07, 2021, 10:28:01 pmCan you post a project so that I can see exactly what is happening? - use the attached project - start it and do nothing but wait 15 seconds - then switch to live mode result: the y-axis range is now -1500 to 1500 8at least on my PC. ---------------------------------------------------------------------- wp · 2021-07-08 16:01 You also have a right axis in the chart, and it does not have an AxisTransformations component. When I add another TChartAxisTransformations with AutoScaleTransfrom and assign it to the right axis, the chart behaves correctly. ---------------------------------------------------------------------- Muso · 2021-07-08 22:22 Quote from: wp on July 08, 2021, 06:01:42 pmYou also have a right axis in the chart, and it does not have an AxisTransformations component. When I add another TChartAxisTransformations with AutoScaleTransfrom and assign it to the right axis, the chart behaves correctly. Does not work for me. Attached is an example program showing this. I attached now also a screencast of what I see. (using Lazarus 2.3.0 r65422 FPC 3.2.2 x86_64-win64-win32/win64) But also without the additional axis transformation - the right axis is not connected to any data series, so it cannot be the reason that the LeftAxis is totally wrong. ---------------------------------------------------------------------- wp · 2021-07-08 23:20 In mode ExtentY=lveAuto the axis transformation was not applied to the determined y extent. Should be fixed in r65423 ---------------------------------------------------------------------- Muso · 2021-07-09 00:15 Quote from: wp on July 09, 2021, 01:20:29 amIn mode ExtentY=lveAuto the axis transformation was not applied to the determined y extent. Should be fixed in r65423 Many thanks! I can confirm this bug is fixed. However my initial problem remains: - take the example project from my previous post - enable Live mode - wait at least 16 seconds result: all 3 ExtentY settings show you an y-axis range 0 - 9 expected: when the ExtentY setting is "Auto" I get an y-axis range of e.g. 8.1 - 9.9 (-/+10% of the minimal/maximal value within the viewport time) ---------------------------------------------------------------------- wp · 2021-07-09 09:25 Fixed in r65429. ---------------------------------------------------------------------- Muso · 2021-07-09 11:59 Quote from: wp on July 09, 2021, 11:25:23 amFixed in r65429. Many thanks. However, the bug is not fixed for me because I have in my program a second LineSeries connected to the right axis and then the y-axis range is completely wrong even for the left axis. Attached is a small example program showing the issue: - start the program, switch to Live mode - wait 16 seconds p.s. could you please have a quick look at: https://forum.lazarus.freepascal.org/index.php/topic,55292.0.html ---------------------------------------------------------------------- wp · 2021-07-09 19:20 I am afraid, the TChartLiveView was not designed for multiple axes because for this the auto extenty mode should modify the Range of each vertical axis, but it modifies the logical extent instead - this is the visible part of the entire chart I think the component can be rewritten to do this but it requires a clear mind... The problem I see is: what happens if the user intentionally modifies the axis.Range himself - but when the ChartLiveview becomes active this setting will be lost. ---------------------------------------------------------------------- Muso · 2021-07-09 19:35 Quote from: wp on July 09, 2021, 09:20:26 pmThe problem I see is: what happens if the user intentionally modifies the axis.Range himself - but when the ChartLiveview becomes active this setting will be lost. Thanks for having a look. I think there should be a new option to the LiveView feature. So something like this: - when the user enables the new LiveView option (called e.g. "useViewPortExtent") - take the LiveView 's ViewPort setting - check all currently active series connected to the left axis - take the Min/Max of these series within the ViewPort's x-range - a new axis property (e.g. called "useLiveViewRange") is checked. - If true take the determined Min/Max value as UseMin/UseMax for the axis - do the same for the right axis When the user now changes at runtime the axis range, he sees the currently set Min/Max from the LiveView. He can overwrite these values with custom ones by setting useLiveViewRange to false since then he blocks the LiveView range setting. ---------------------------------------------------------------------- wp · 2021-07-13 08:29 Please try the new revision. In ExtentY=lveAuto mode, now multiple axes are supported. And there is a new mode, lveMultiAxisRange which respects the range preset for an axis. So, if your second y axis, for example, displays data ranging between 99.1 and 100.95, and you want stable axis labels you can set Range.Min := 99 and Range.Max := 101 for this axis, and the liveview will zoom into this interval (but note the limitation of the range that it will be expanded when data values are outside). When ExtentY=lveAuto in this case, this axis will adjust according to the current data max and min by setting the axis.Range accordingly (any previously set Axis.range is stored when the LiveView becomes active and restored when it becomes inactive). ---------------------------------------------------------------------- Muso · 2021-07-14 00:21 Quote from: wp on July 13, 2021, 10:29:39 amPlease try the new revision. Excellent! Quote from: wp on July 13, 2021, 10:29:39 amlveMultiAxisRange which respects the range preset for an axis. So, if your second y axis, for example, displays data ranging between 99.1 and 100.95, and you want stable axis labels you can set Range.Min := 99 and Range.Max := 101 for this axis, and the liveview will zoom into this interval I tried it and in the attached demo program I set the right axis to range 19 - 30. However, also when I set the extent to the new "lveMultiAxisRange", I don't get this range but the range 22 - 30. Do I have to use the "UseMin" option or must I not use this? --------------- I hope you don't beat me for this: I wanted to understand how you implemented the new extent and realized that the source code has no single comment line: https://github.com/graemeg/lazarus/blob/b980b69a582a062c401b89ba48f18e f68e4c689b/components/tachart/tachartliveview.pas I can only speak for myself, after e.g. a year i forgot why I implemented something the way i did it and to help myself and of course others, there should be some comment line explaining they Why in the code. ---------------------------------------------------------------------- wp · 2021-07-14 14:38 Quote from: Muso on July 14, 2021, 02:21:23 amI tried it and in the attached demo program I set the right axis to range 19 - 30. However, also when I set the extent to the new "lveMultiAxisRange", I don't get this range but the range 22 - 30. Do I have to use the "UseMin" option or must I not use this? Where do you set the range to start at 19? I only see the value 23 in the object inspector. BTW, there are two AutoScaleTransformations in ChartAxisTransformR - you only need one. The reason why in the MultiAxisRange mode the axis has the first label at 22 rather than 23 is that your series2 is constantly 24.3. The liveview component selects in this case of seriesmax = seriesmin the series maxiumum to be 10% higher, and the series miniumum to be 10% smaller than the common value. 90% of 24.3 is 21,87. Since in TAChart the series range overrides the axis range the right axis is set up to start at 21.87; due to the chart's margin there are some pixels between the axis and the first label, therefore, the first axis label at the right is 22. If you add some noise to the y data of series2 ( Chart1Lineseries2.AddXY(x, 24.3 + 0.1*(random-0.5)) ), or if you set the right axis Range.Min to 19 as you wrote in the post, you will see that the live view works as expected. Quote from: Muso on July 14, 2021, 02:21:23 amI hope you don't beat me for this: I wanted to understand how you implemented the new extent and realized that the source code has no single comment line: https://github.com/graemeg/lazarus/blob/b980b69a582a062c401b89ba48f18e f68e4c689b/components/tachart/tachartliveview.pas I can only speak for myself, after e.g. a year i forgot why I implemented something the way i did it and to help myself and of course others, there should be some comment line explaining they Why in the code. I will not participate in a discussion about commenting of source code here. The TAChart coding style guidelines (https://wiki.lazarus.freepascal.org/TAChart_documentation#Comments, not written by myself) say: "Comments should only include information not evident from the source. In particular, choose meaningful procedure and argument names in preference to adding comments describing their usage." The condition "not evident from the source", of course, is relative... ---------------------------------------------------------------------- Muso · 2021-07-14 15:58 Quote from: wp on July 14, 2021, 04:38:11 pmWhere do you set the range to start at 19? I only see the value 23 in the object inspector. BTW, there are two AutoScaleTransformations in ChartAxisTransformR - you only need one. Oops, that was the problem. But also with the fixed version I attached, it is not working as expected. Attached is the screencast of what I see - sometimes the number 19, sometimes the number 30 in the right axis suddenly disappears (when the y-axis reaches 83 s, the 30 disappears, when it reaches 86s, the 19 disappears) for a second. I expected that the right axis stays stable when I set a range. Can you please add in the docs: https://wiki.freepascal.org/TAChart_documentation#Live_View the info that one can set the range via lvMultiAxis and that one must use the booleans UseMin/UseMax in order to get the range setting for lvMultiAxis ? Quote from: wp on July 14, 2021, 04:38:11 pmThe reason why in the MultiAxisRange mode the axis has the first label at 22 rather than 23 is... I will not participate in a discussion about commenting of source code here.... But that is my point: You made a new implementation of a feature. You also have good reasons why you implemented the things as they are and there are forum posts about these design decisions and discussions. But looking in the code as a stranger, I am lost. I miss the info what the idea was, what were the design decisions, where in the forums were the debates?, etc. When  look e.g. a year later in the code , it is not clear to me why there is a lvMultiAxis, what are the differences to lvAuto and so on. therefore one has to spend a lot of time to google around and hopefully find this forum thread. So why not adding a comment with a link to this forum thread? ---------------------------------------------------------------------- wp · 2021-07-14 16:48 The main problem is that the axis range is not "absolute". When the data in the series attached to that axis have a greater range, then the axis range is extended to display all series data - you already noticed that in the ChartEditorDemo. The only way to truncate series data is to set the Chart.Extent, but this is in graph units, i.e. in the common invisible coordinate system in which the AutoScaleAxistransforms operate, and thus it is not possible to restrict the Extent to individual series (which was the reason why the initial approach did not work). I tried to modify the behaviour of the axis range for the ChartEditor demo but ran into numerous side-effects, so I will not touch this any more. I will update the chart documentation when things have settled down here. Worse than "no documentation" is "false documentation". OK, it makes sense to add a link to the forum discussion. But I will not explain every step in the sources; a stranger who does not know anything about TAChart will not understand these comments as little as he understands the code itself. ---------------------------------------------------------------------- Muso · 2021-07-14 17:24 Quote from: wp on July 14, 2021, 06:48:17 pmThe main problem is that the axis range is not "absolute". When the data in the series attached to that axis have a greater range, then the axis range is extended to display all series data - you already noticed that in the ChartEditorDemo. The only way to truncate series data is to set the Chart.Extent I understand. I played around with this as well and also got a lot of problems. However, as it is. lvMultiAxis is almost what I need. the small jumps in the right axis are negligible for most users I hope. QuoteI will update the chart documentation when things have settled down here. Worse than "no documentation" is "false documentation". OK, it makes sense to add a link to the forum discussion. But I will not explain every step in the sources; a stranger who does not know anything about TAChart will not understand these comments as little as he understands the code itself. Many thanks. ---------------------------------------------------------------------- Muso · 2021-07-14 17:57 One further question: Since I use the cool new Live View feature for a real-life program, I would like to see it in Lazarus 2.2.0 I had a look and in https://wiki.lazarus.freepascal.org/Lazarus_2.2.0_release_notes#TAChar t I don't see LiveView. Also in the recent merges to the 2.2 branch I don't see your recent commits: https://wiki.freepascal.org/Lazarus_2.2_fixes_branch What state of the LiveView feature would be in Lazarus 2.2.0? ---------------------------------------------------------------------- Muso · 2021-07-14 18:18 Quote from: Muso on July 14, 2021, 07:24:24 pmHowever, as it is. lvMultiAxis is almost what I need. Seems I was too rash.  Attached is my demo program in which I set the right axis to range 19-33 and left axis to 500 - 1400. When I run it and set lvMultiAxis then the left axis gets a range of about 720 to 1350. Do I have a wrong setting somewhere? ---------------------------------------------------------------------- wp · 2021-07-15 16:21 Oh man, this is a brain-twister... Played with it once more and found that we do not need lveMultiAxisRange at all. After a small modification in the recent code this case becomes a subset of lveAuto: When you define a range for an axis (by setting axis.Range.Min/axis.Range.UseMin and/or axis.Range.Max/axis.Range.UseMax) then this range is respected as axis range (as long as this range is larger than the y data range in the viewport - this is the old ChartEditor demo story...). Your program is working with the ranges set after the transition at 10 sec. Before the transition the minimum is extended down to 0. I do not yet fully understand why the other axis is affected also before the transition. But I think I will keep it as such. Maybe sometime I see the perfect solution, until then you'll have to live with the 90%-perfect solution. ---------------------------------------------------------------------- Muso · 2021-07-15 18:44 Quote from: wp on July 15, 2021, 06:21:27 pmAfter a small modification in the recent code this case becomes a subset of lveAuto: When you define a range for an axis (by setting axis.Range.Min/axis.Range.UseMin and/or axis.Range.Max/axis.Range.UseMax) then this range is respected as axis range (as long as this range is larger than the y data range in the viewport - this is the old ChartEditor demo story...). Hmm, I mean the user is the boss, when he wants to see only the y-range for e.g. 500-1400, it is his decision. What was possible wit the lvMultiAxis method is no longer possible, see my attached example program: No matter if within the viewport are only data in the range 500-1400, the y-range setting is ignored. To reproduce - start my program and switch to Live mode - wait 16 seconds - check the option to hide the right axis result: the y-range is now approx. -1100 to + 1500 It is not clear to me why the visibility of the right axis affects the y-range of the left axis. ---------------------------------------------------------------------- wp · 2021-07-15 20:30 As I told you the live view is 90% perfect. There are other activities for me than to aim for 100% perfection of this component and will stop this now, but I'll be glad to accept your patch for the remaining 10%. ---------------------------------------------------------------------- Muso · 2021-07-16 00:24 Quote from: wp on July 15, 2021, 10:30:31 pmAs I told you the live view is 90% perfect. There are other activities for me than to aim for 100% perfection of this component and will stop this now, but I'll be glad to accept your patch for the remaining 10%. You know that I am amazed on how much you helped me and your work on TAChart is outstanding. When the feature stays as it is, OK. I see that your today's commit r65456 was not merged to the 2.2 stable branch yet. Your other commits are in. Whatever the final state in 2.2.0 would be, can you please add a note about the known issues? Concerning a patch, I already looked into the code and it was not cleat to me why the active state of the LineSeries connected to the right axis, makes the difference. Now I think the issue is that the series are not distinguished between being connected to the axis which should be currently scaled. I will have a deeper look the next days. ---------------------------------------------------------------------- Muso · 2021-07-16 03:35 Quote from: wp on July 15, 2021, 10:30:31 pmI'll be glad to accept your patch Attached is the tachartliveview.pas that fixes the issue for me. It turned out that one must separate the different y-axes and that GetTransform.AxisToGraph must not be performed when the user set its own range for the axis. I remodeled the file a bit just to understand it better, this is no offense nor a request to take it as it is. Most changes and comments are only in to help myself understanding. ---------------------------------------------------------------------- Muso · 2021-07-16 11:40 Quote from: Muso on July 16, 2021, 05:35:07 amAttached is the tachartliveview.pas that fixes the issue for me. I forgot to mention that I there purposely made the procedure "StoreAxisRanges" public becase for the TAChart AxisClickTool, one need to run this procedure because the user might this way changed the axis range. (The LiveView must take the current axis state not the one it once stored when it was first activated.) ---------------------------------------------------------------------- wp · 2021-07-16 15:27 Thanks. What a silly mistake to not handle the axes separately! I moved both StoreAxisRange and RestoreAxisRange to public, knowing that poorly-thought calls may disrupt operation of the live view component. ---------------------------------------------------------------------- Muso · 2021-07-16 16:49 Quote from: wp on July 16, 2021, 05:27:09 pmThanks. What a silly mistake to not handle the axes separately! I moved both StoreAxisRange and RestoreAxisRange to public, knowing that poorly-thought calls may disrupt operation of the live view component. Note that I am just a beginner, trying to fix expert issues  . Therefore I would like to get feedback what areas is my version sensible and where not. What is about the GetTransform.AxisToGraph change I made? While debugging, this turned out to the the cause that the left y-axis in my demo program was wrong then the right-axis was not shown. I am asking because I found now a way that works but did not yet fully understand why GetTransform.AxisToGraph performed at the left axis leads to another result when the right axis has an active series or not. ---------------------------------------------------------------------- wp · 2021-07-16 19:08 I think the reason is somewhere else. You are setting the axis.Range.Min/.Max only in the case where the corresponding .UseMin/.UseMax is NOT set, and then you apply the axis.GetTransform to the found ymin or ymax value - which are the correct values in this case. I had set the axis.Range in all cases, and to take care of the user- frozen range I set ymin/ymax to the saved FStoredFranges.Min/.Max. In principle this should work, too, but my mistake was that I applied the axis transformation again to ymin/ymax - but I should have applied it to the FStoredRanges.Min/Max in this case (or, simpler, axis.Range.Min/.Max which is valid in both cases). When I revert my svn version to my commit of yesterday and change the transformation argument this way, the liveview is correct. I do think, though, that setting lext.a.y := axis.GetTransform.AxisToGraph(yminAx) is dangerous because lext (the logical extent, the range in the invisible "graph" coordinate system behind the chart) depends on all axes. Therefore, lext.a.y should be the minimum of the current lext.a.y and the result of the transformation, likewise for lext.b.y: 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 lext.a.y := Min(lext.a.y, axis.GetTransform.AxisToGraph(yminAxis));...lext.b.y := Max(lext.b.y, axis.GetTransform.AxisToGraph(ymaxAxis)); Since your solution is working I did not change this and want to keep it for the moment. Maybe we can find an example where your code (without Min() and Max()) leads to an incorrect display. A simplification is probably to avoid the double usage of an axis and series ymax/ymin. The series method FindYRange() has ymin and ymax as var parameters and does not initialize them. So they are to be considered as the cumulative value of a list of series, like in the example. Therefore, it should be sufficient to initialize a ymin/ymax outside the series loop and have the total min and max at the end of the loop. For the moment I kept your code, but put the series max/min initialization inside the loop (and renamed these variables to yminser/ymaxser because they represent the range of the series, in contrast to yminax/ymaxax which are the total range of all series in this axis). Maybe I'll change both items tomorrow. I am attaching a "preview" for you to test. I added a if csDesigning in ComponentState then exit at the top because I found that an empty chart in design mode attached to an active liveview always activated an axis range of -1 to +1 - default, however, is an open range (Min/Max = 0 and UseMin/Max = false) ---------------------------------------------------------------------- Muso · 2021-07-17 15:49 Quote from: wp on July 16, 2021, 09:08:15 pmI had set the axis.Range in all cases, and to take care of the user-frozen range I set ymin/ymax to the saved FStoredFranges.Min/.Max. In principle this should work, too, but my mistake was that I applied the axis transformation again to ymin/ymax Thanks, now I got it. I tried now your latest version from today and I think we eventually have it!  Since I need the LiveView in combinaition with the axisClickTool I needed to adapt the ChartEditor demo program (which I use for the AxisClickTool in my program) in CeAxisFrame.pas: 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 procedure TChartAxisFrame.seMaximumChange(Sender: TObject);begin  FAxis.Range.Max := seMaximum.Value;  cbAutoMax.Checked := false;  // wee need to set explicitly that UseMax is not used  // because TAChart's the LiveView feature need this info  FAxis.Range.UseMax := true;end; procedure TChartAxisFrame.seMinimumChange(Sender: TObject);begin  FAxis.Range.Min := seMinimum.Value;  cbAutoMin.Checked := false;  // wee need to set explicitly that UseMin is not used  // because TAChart's the LiveView feature need this info  FAxis.Range.UseMin := true;end; So when the user changes the axis range, we need to explicitely set the UseMin/UseMax to false so that LiveView knows that the user set its own range. The second change is to call the StoreAxisRanges procedure of LiveView. In case for the demo it would be this in ceMain.pas: 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 procedure TMainForm.EditAxis(AAxis: TChartAxis; APage: TChartAxisEditorPage);var  F: TChartAxisEditor;begin  if cbUseAllInOneDialog.Checked then    EditChartAxis(AAxis, APage)  else  begin    F := TChartAxisEditor.Create(nil);    try      F.Prepare(AAxis, 'Edit chart axis "%s"');      F.Page := APage;      F.ShowModal;      // update the axis settings for the LiveView      ChartLiveView1.StoreAxisRanges;    finally      F.Free;    end;  end; ---------------------------------------------------------------------- Muso · 2021-07-17 15:55 While thinking about it,  typical application like mine that displays sensor data needs in most cases also the tools from the ChartEditor demo. The dialogs of the ChartEditor demo should therefore become part of TAChart itself in Lazarus 2.4. My program is almost ready and I gave it to my engineer colleagues to test. And what was the first thing the did? - changing the axis range, changing the background color of the chart, changing the axis tick separation etc. So obviously users like to play with the layout a lot and a program that does not offer this, won't be accepted. Speaking for myself, all my future programs will provide the ChartEditor demo functionality, no matter how simple the chart application might be. I felt the "pressure" from the colleagues in another project too that everything should be changeable. The main argument was "Excel charts can do this, so why does your program not offer at least basic Excel features?". ---------------------------------------------------------------------- wp · 2021-07-17 16:39 This is a good example why the chart editor demo should NOT be part of TAChart. What if somebody does not need the LiveView? With your modification he will be forced to have it in his project. Or what if somebody wants to arrange the controls in a different way, for example in a "side-bar" interface like in the combobox demo instead of the dialog interface of the charteditor demo? Integrating the chart editor into TAChart would mean: - add support for any series type supported and for any custom series written by a user - add support for multiple axes, multiple transformations, rotated axes, date/time axes - add support for i18n - ... This would be a project of its own, probably as complex as TAChart itself. The current solution offers greatest flexibility for the extremely modular TAChart library. Just copy the demo files into your project, and then you can change whatever you want. ---------------------------------------------------------------------- Muso · 2021-07-17 22:52 Quote from: wp on July 17, 2021, 06:39:07 pmThis is a good example why the chart editor demo should NOT be part of TAChart. What if somebody does not need the LiveView? With your modification he will be forced to have it in his project. Then you misunderstood me. My aim that users don't have to reinvent the wheel. Like when I need a dialog to open a file, I can use a predefined component. Of course I can use my own dialog, but I have something to start with. The dialog can be changed or adapted by the programmer as he likes it. And having a dialog offered with i18n would be very helpful cool too. So what I want is that when the user adds the click tools, they can (but of course not must) use a predefined dialog allowing the program users to change all chart properties live. See also below how simple this could in my opinion be done. And of course I don't want the dialogs to work only with LiveView. I only posted the changes here for other users who will find this thread by googling because they might have the same task. Quote- add support for any series type supported and for any custom series written by a user No, only for the official supported series types. And the main features like tilte/footer click, axes click etc. are independent of the series. Quote- add support for multiple axes, multiple transformations, rotated axes, date/time axes This what is already there. in my program, I have 3 different exes, 13 series in total (line series and just lines), two different axis transformations and my x-axis is a time axis. QuoteThis would be a project of its own, probably as complex as TAChart itself. I made the proposal because I think 90% is already there. QuoteThe current solution offers greatest flexibility for the extremely modular TAChart library. Just copy the demo files into your project, and then you can change whatever you want. Exactly. So basically what I want is - to find this feature so that one doesn't need to reinvent the wheel, googling around or asking in forums. Without your help I would not knew that such a demo exists and that it is part of the Lazarus installation and where. So the "integration" could in the first step just to add the ChartEditor demo dialog via the Lazarus form editor. A button there would do all the stuff I currently have to do manually - knowing that is exists and where - copying it t my project - adapt my project to use the demo's dialog