HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
688 stars 129 forks source link

Showing Windrose #152

Open WolfgangFahl opened 6 years ago

WolfgangFahl commented 6 years ago

I'd like to get a Windrose-like display: see https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Brosen_windrose.svg/600px-Brosen_windrose.svg.png

For a start it would be helpful to modify the way the Helper function works by making the counter display in Helper drawRadialTickMarks configurable e.g. separating the String.format ... function in

   Helper.rotateContextForText(CTX, START_ANGLE, angle, tickLabelOrientation);

                    CTX.setFont(isNotZero ? tickMarkFont : tickMarkZeroFont);
                            CTX.setTextAlign(TextAlignment.CENTER);
                            CTX.setTextBaseline(VPos.CENTER);
                            CTX.fillText(getTextForCounter(locale, tickLabelFormatString, counter), 0, 0);
                            CTX.restore();

to:

public String getTextForCounter(Locale locale, String tickLabelFormatString, Double counter) { String result=String.format(locale,tickLabelFormatString,counter); return result; }

If the helper would now be non-static by initializing it with new Helper() and calling drawRadialTickMarks it would be possible to exchange the Helper at runtime.

grafik