jankae / LibreVNA

100kHz to 6GHz 2 port USB based VNA
GNU General Public License v3.0
1.13k stars 210 forks source link

Using large fonts in graphs on High DPI screens clips labels #151

Closed korken89 closed 1 year ago

korken89 commented 2 years ago

LibreVNA Version

LibreVNA Version (64 bit): 1.4.0-7f6b78992 OS: Arch Linux CPU Arch: x86_64

Steps to reproduce

Use a computer with 4k screen, set the font size for axises to 30.

image

Expected behavior

That the labels do not clip.

Extra information & Setup and Calibration files

N/A

Confirming that you haven´t forgot to include configuration files (if applicable)

jankae commented 2 years ago

I do not have a 4k screen and using a font size of 30 with my monitor only allows me to partially reproduce the problem: image The X axis tick values are still clipped on the sides, but no values are clipped on the bottom. The clipping on the sides is due to a fixed maximum width for each label. I have replaced the fixed size with an adjustable one that depends on the font size, this fixed the clipping on the sides.

As I am unable to reproduce clipping on the bottom, this is probably still present in your setup. I checked the code for plotting the Y-axis label and it already scales the maximum box height according to the selected font size. Not sure what is going wrong with the high DPI monitor...

korken89 commented 2 years ago

Thanks for checking!

If you could point me to where in the code the scaling is, I could experiment a bit and maybe solve the remaining issue. :)

jankae commented 2 years ago

Sure, you need to look in Software/PC_Application/LibreVNA-GUI/Traces/tracexyplot.cpp

Line 424 and 426 for the Y-axis tick labels, line 630-631 for the X-axis tick labels. This all assumes you are using the latest commit on master.

YuryW commented 2 years ago

LibreVNA Version (64 bit): 1.4.0-7f6b78992 OS: Windows 7 Version 6.1 (Build 7601: SP 1) CPU Arch: x86_64 4K UHD 3840x2160 Set font size for axes to 50. font size for axises to 50 By the way, for fun, open all three pictures from this discussion in Paint, and compare the resolution of the pictures below... 1 2

YuryW commented 2 years ago

LibreVNA Version (64 bit): 1.5.0-alpha.1-c7a99af82 OS: Windows 7 Version 6.1 (Build 7601: SP 1) CPU Arch: x86_64 Good evening! A little information on the recent version and on this issue. Monitor screen resolution 3840x2160. The maximum font sizes for axes are 44 with markers and 54 without markers. Everything is normal, only there are frequency verticals, under which there are no frequency marks. This, with large fonts, introduces the user into difficulty a little. Perhaps the frequency verticals with inscriptions can be made a little longer at the bottom. Graphs_font_axes_44_marker Graphs_font_axes_54_no_marker

jankae commented 2 years ago

Everything is normal, only there are frequency verticals, under which there are no frequency marks.

Tick labels on the X axis are skipped if they would not fit (when ticks are too close to each other for the selected font size).

Perhaps the frequency verticals with inscriptions can be made a little longer at the bottom.

Good idea :) Maybe the axis ticks outside of the plot area should scale with the label font size? At the moment they are fixed and only using two pixels. Looks good on my screen but in your screenshot with the higher resolution they are barely visible.

YuryW commented 2 years ago

Maybe the axis ticks outside of the plot area should scale with the label font size?

Yes, that would probably be the best solution. And further. Is it possible to reduce the distance between Magnitude and Phase and the graph? So that there is more space for the graph due to the voids between Magnitude and graph on the left and Phase and graph on the right?

jankae commented 2 years ago

Is it possible to reduce the distance between Magnitude and Phase and the graph?

You can reduce the font size, it also influences the size reserved for the Y axis tick labels. I don't really want to make it any closer, it would result in collisions betweeen "Magnitude/Phase" in certain cases (depending on the actual values and unit of the Y axis). But maybe an option could be added in the preferences to manually set it to your liking...

YuryW commented 2 years ago

But maybe an option could be added in the preferences to manually set it to your liking...

No, don't. Perhaps, when the most important thing in LibreVNA is implemented in accordance with your ideas, then it will be possible to return to such trifles...))