LibreVNA icon indicating copy to clipboard operation
LibreVNA copied to clipboard

widgets/charts: implement polar diagram

Open sophiekovalevsky opened this issue 3 years ago • 3 comments

The following implementation represent Sii parameters in a polar chart.

I would like to receive your initial feedback on this. During development I came up with the following thoughts:

  • It's desirable to apply this chart to parameters not equal to Sii?

  • It seems that some behavior of TraceSmithChart can be shared with TracePolarChart but I wasn't sure to actually make a base class right away without having your opinion first. The main drawback that I see in inherit Smith and Polar charts from this base class is adding a extra layer of parent class. Having a third layer in this case would be maintainable in the future?

  • There is a new funcionality in this chart that can be used on SmithChart as well and it's moving horizontal axis. The expected behavior follows:

    • When horizontal axis is moved some distance, the phasor representation is always constrained by the edgeReflection circle.
    • Trace points when are out of visible area may have some empty spaces near edgeReflection circle because there is no interpolation between the sample point and the next one. This can be exacerbated if zoom factor is higher. image

sophiekovalevsky avatar Aug 06 '22 22:08 sophiekovalevsky

Wow, thank you so much for this addition. I haven't looked at it in detail yet but my initial thought is to go with a common base class for smith and polar charts as there are only a couple difference between them (mainly the grid lines and pixel<->coordinate conversions.

jankae avatar Aug 08 '22 13:08 jankae

@jankae ready for review.

  • Smith Chart class inherits from Polar class
  • Offset in real axis on Smith Chart have been added

sophiekovalevsky avatar Aug 10 '22 22:08 sophiekovalevsky

Thank you very much :) I am unavailable for a few days and will review/merge this in about a week.

jankae avatar Aug 11 '22 06:08 jankae

Merged, and thanks again for this significant contribution :)

I made slight changes:

It's desirable to apply this chart to parameters not equal to Sii?

I think so and am allowing Sij traces to be added to polar charts now

Trace points when are out of visible area may have some empty spaces near edgeReflection circle because there is no interpolation between the sample point and the next one. This can be exacerbated if zoom factor is higher.

Improved handling of line drawing in smith and polar charts. The line is now drawn all the way to the circle in case one point is outside of it.

jankae avatar Aug 21 '22 11:08 jankae

@jankae you're welcome.

Improved handling of line drawing in smith and polar charts. The line is now drawn all the way to the circle in case one point is outside of it.

I haven't look thoroughly the changes but while making some tests, I discovered the following:

image

Is this an expected result?

sophiekovalevsky avatar Aug 21 '22 17:08 sophiekovalevsky

Hm, looks like I forgot to check this "improvement" when an x-axis offset is used... Will soon be fixed

jankae avatar Aug 21 '22 19:08 jankae

Should be fixed now, I forgot to handle a special case in constrainLineToCircle

jankae avatar Aug 21 '22 20:08 jankae

@jankae it works sooo great. Thanks.

sophiekovalevsky avatar Aug 21 '22 21:08 sophiekovalevsky