eclipse / swtchart

Eclipse Public License 2.0
44 stars 41 forks source link

Y-Axis both on left AND right? #283

Closed harmanea closed 2 years ago

harmanea commented 2 years ago

Is there a way to display the y-axis for a line chart synchronously both on the left and the right sides?

If not, would it be possible to add this option, e.g. something like Position.BOTH?

eselmeister commented 2 years ago

Setting the Position.BOTH is not possible. But you can simply add a secondary axis with a pass through value converter. Have a look here: SecondaryAxisChart.java

harmanea commented 2 years ago

Thanks for the quick reply!

What do you mean by pass through value converter. I don't see it applied anywhere in the example.

eselmeister commented 2 years ago

In case of the example, a byte to kibibyte converter is used as the basic Y axis is given as byte:

ISecondaryAxisSettings secondaryAxisSettingsY = new SecondaryAxisSettings("KiB (kibibyte)", new ByteToKibibyteConverter());

If you'd like to mirror the axis, just define a converter that returns the original value, so no multiplication/division is needed here.