Recent

Author Topic: [fixed] problem with ChartToolsetAxisClickTool on independent axes  (Read 373 times)

Muso

  • Jr. Member
  • **
  • Posts: 90
Attached is a small program in the zip  that uses current Laz 2.1 trunk and from there the chartEditor demo files.

- run the program
- double-click in the left axis and set in the appearing dialog the axis limits maximum to 2.0

this works fine, but now
- close the dialog with OK
- double-click again on the left axis and this time set the axis limits maximum to 1.0

result: the right axis is suddenly scaled by a factor of 2, see the attached screenshot.

Is there a workaround?
« Last Edit: April 20, 2021, 07:50:17 pm by Muso »

wp

  • Hero Member
  • *****
  • Posts: 8395
Re: problem with ChartToolsetAxisClickTool on independent axes
« Reply #1 on: April 20, 2021, 05:12:14 pm »
This was caused by the simplification I had made to restore axis settings when ESC is pressed. Seems that it interferes with the way axis transformations work because it adds a new invisible axis to the chart. Now I completely rewrote this part, and it seems to work, also in your demo. But please check yourself. And there is some chance that some overlooked typos prevent correct operation here and there...

BTW: I renamed all identifiers with a "Chart" prefix ("TPenFrame" --> "TChartPenFrame). Not sure yet, but maybe I put these functions into their own package (TAChartEditor, or so) for more general use.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: problem with ChartToolsetAxisClickTool on independent axes
« Reply #2 on: April 20, 2021, 07:50:04 pm »
Now I completely rewrote this part, and it seems to work, also in your demo. But please check yourself.

Many thanks again!

In my real-life project it fixes also a crash.

I project will be published under the GPL, so I took your forms and code. In general I think many users will benefit from your ready-to-work dialogs to format e.g. the chart axis. So you should consider offering this as official TAChart component and not only as demo. The idea is that the user can drag from the Chart menu in Lazarus a component "TChartAxisEditor" and connect it to the axis click tool.

I am proposing this because users should not reinvent the wheel. You invested much work in the forms and that's why I just use it. I only need to modify some forms here and there and then I am done and have a really cool chart application.

wp

  • Hero Member
  • *****
  • Posts: 8395
Re: [fixed] problem with ChartToolsetAxisClickTool on independent axes
« Reply #3 on: April 20, 2021, 08:00:50 pm »
One thing which is annoying in the present demo is that I normally edit things by groups, say I change the font of the x axis title, and the next thing i want to do is to change the font of the y axis. Now I must (double)click on the x axis title, change the font, close the dialog, click on the y axis title and change the font again. It would be much more convenient if all dialog were contained in a single form  with a navigation tree at the left so that the y axis can be reached immediately from the x axis.

The most important thing which makes me hesitate to create a package of all the forms it that they are still too simplistic. There are many more properties which are not covered. Most of the series types are not supported. Etc, etc. But putting all this together will result in a scary super form, where nobody finds nothing, just like in the one of Delphi's TeeChart.

So maybe it is better to just demonstrate how such dialogs could be created within the TAChart framework and to leave the final tuning to the specific requirements of a program to the user code.

Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Muso

  • Jr. Member
  • **
  • Posts: 90
Re: [fixed] problem with ChartToolsetAxisClickTool on independent axes
« Reply #4 on: April 20, 2021, 08:22:22 pm »
One thing which is annoying in the present demo is that I normally edit things by groups, say I change the font of the x axis title, and the next thing i want to do is to change the font of the y axis.

Without exaggerating, I can say that what you already have is a huge boost in using TAChart. When I compare Laz 2.0 and now Laz 2.1 + your demo files, it is like upgrading from a bicycle to a motorbike. There is now an existing engine and you don't have to do everything on your own.
In the past I got a lot of criticism because the charts were not as handy as e.g. programs codes with .Net or Qt. Today I presented my first version of the program to two colleagues and they said, that is exactly what we need. I was even surprized to get this positive feedback.

And also the existing visualization programs we use, use the same method as you do in the demo - click on the axis you need to change. Only in rare cases users really need to change all axes. And for these cases, one can handle this at runtime. I e.g. have a button in my app with which the users can change the style of all line series in the chart because this was requested by users.

As you wrote with your reference to TeeChart, you cannot please every potential use case or you end up in a huge and unhandy tool.

So in fact your demo code is exactly what average coders needs - the basics are covered and one can fine-tune it, add or remove features. And having your existing code saves many hours of coding and testing! So please consider providing the existing demo code as package for TAChart. I bet that I am not the only one who would love it.
« Last Edit: April 20, 2021, 08:36:54 pm by Muso »

 

TinyPortal © 2005-2018