jkriege2 / JKQtPlotter

an extensive Qt5 & Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
http://jkriege2.github.io/JKQtPlotter/index.html
GNU Lesser General Public License v2.1
889 stars 190 forks source link

Clipped Text and Large Key #99

Closed allenbarnett5 closed 1 year ago

allenbarnett5 commented 1 year ago

Hi Jan: I'm really impressed by JKQtPlotter. It's a lot of work! I have a couple of small problems perhaps you could help me with. This is a window using QGridLayout to place the plots.

image

I'm using a self-compiled version of Qt 6.5.0 on Pop!_OS. I tried to build my program with the default Qt on Pop, Qt 6.2, but I guess I'm using Qt 6.5 specific classes. If it's helpful, I can reduce my code to a simpler test.

And a question: My plots use JKQTPXFunctionLineGraph for equations which don't really have bounds; I just pick an initial range which is meaningful (just for example: say 1 cycle of cos). "Zoom All" doesn't seem to work to restore the plot to its original size. Is there a function to limit the Zoom range to a fixed size?

Thanks, Allen

jkriege2 commented 1 year ago

Hi!

Nice to hear that you like the library!

About the tick label clipping: I will have to think about how to fix that (either shift label or allow for more space on the right). Until then you can maybe use JKQTBasePlotter::setPlotBorderRight() to add more free space in the right (https://jkriege2.github.io/JKQtPlotter/class_j_k_q_t_base_plotter.html#af57d78391045d758bb2c725731cfc837).

The keys/legends is one of the areas, the lib is still lacking and that are up for a rework soon ... I think there is not much you can do now, unless you want to look into the layout code in JKQTBasePlotter ...

I deactivated the autozoom of JKQTPXFunctionLineGraph recently, as that didn't really work (hen and egg problem) ... although I might have to look into this further.

You can use JKQTBasePlotter::setAbsoluteXY() and its cousins to limit the max plot range.

Hope that helps!

Best, Jan

jkriege2 commented 1 year ago

Hi!

I commmited a fix that should help at least with the label clipping for horizontal axes

Best, JAN

allenbarnett5 commented 1 year ago

That looks great. Thanks!

I looked over the code to draw the key. I was wondering if using QTextDocument to do the layout would reduce the need for all the explicit dimension calculations? (I was reflecting on my own code to do something similar and found QTextDocument did most of the work.)

Allen

On Tue, Aug 22, 2023, 11:36 AM Jan W. Krieger @.***> wrote:

Hi!

I commmited a fix that should help at least with the label clipping for horizontal axes

Best, JAN

— Reply to this email directly, view it on GitHub https://github.com/jkriege2/JKQtPlotter/issues/99#issuecomment-1688450315, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOLFXMZEWUO5RA2IJ73POTXWTGWNANCNFSM6AAAAAA3WUVWQA . You are receiving this because you authored the thread.Message ID: @.***>

jkriege2 commented 1 year ago

About the key drawing: the problem is, that QTextDocument is not really compatible with the Latex-renderer used to layout all the text elements ...

allenbarnett5 commented 1 year ago

Ok, no problem.

On Wed, Aug 23, 2023 at 8:17 AM Jan W. Krieger @.***> wrote:

About the key drawing: the problem is, that QTextDocument is not really compatible with the Latex-renderer used to layout all the text elements ...

— Reply to this email directly, view it on GitHub https://github.com/jkriege2/JKQtPlotter/issues/99#issuecomment-1689857926, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOLFXKW2CGXJ6TCKB45ADDXWXYDXANCNFSM6AAAAAA3WUVWQA . You are receiving this because you authored the thread.Message ID: @.***>

jkriege2 commented 1 year ago

OK, the large key issue should be solved via https://github.com/jkriege2/JKQtPlotter/commit/134739c5a5b072f648064ceb9f9f30f6b68ff750

Can you confirm? Then I'll close this PR!

allenbarnett5 commented 1 year ago

All my tests look great! Thanks so much!

I wanted to thank you again for JKQtPlotter. For a change, I've spent more time thinking about how the plots can best make my point and less about how to construct them.

Allen

On Thu, Aug 24, 2023 at 4:13 PM Jan W. Krieger @.***> wrote:

OK, the large key issue should be solved via 134739c https://github.com/jkriege2/JKQtPlotter/commit/134739c5a5b072f648064ceb9f9f30f6b68ff750

Can you confirm? Then I'll close this PR!

— Reply to this email directly, view it on GitHub https://github.com/jkriege2/JKQtPlotter/issues/99#issuecomment-1692345420, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOLFXJ2S3DUDZ5YDKNYKOLXW6YXNANCNFSM6AAAAAA3WUVWQA . You are receiving this because you authored the thread.Message ID: @.***>

jkriege2 commented 1 year ago

You are very welcome!

... and thanks fpr the praise :-)))