Project

General

Profile

How to move x-axis title of CartesianChart

Added by Norbert Mösbauer almost 9 years ago

Hello,

I've tried to display some values using WCartesianChart (see attached image).

For each value a label should be displayed at the x-axis.

Due to the length of the labels and to avoid overlapping, I gave the labels an angle

using axis(Wt::Chart::XAxis).setLabelAngle(--20.0);

To avoid overlapping with the title of the x-axis also, I've tried to move the title down

using axis(Wt::Chart::XAxis).setTitleOffset with different positive or negative values

Unfortunately this shows no effect in my implementation

What am I doing wrong? Is there a possibility of displaying the x-axis title on the right side of the axis?

Thanks in advance,

Norbert

Notes:

  • OS: Windows 7 Professional (SP1)
  • Wt version: 3.3.6

Replies (6)

RE: How to move x-axis title of CartesianChart - Added by Koen Deforche almost 9 years ago

Hey Norbert,

Do you use setAutoLayoutEnabled()?

No currently it is not possible to right-align the axis title.

Regards,

Koen

RE: How to move x-axis title of CartesianChart - Added by Roel Standaert almost 9 years ago

Hello Norbert,

It seems to me that your build of Wt does not include libharu, so server side font metrics are not working.

I've noticed that the title offset is not used at all when autolayout is disabled or server side font metrics are not available. That's a bug. I'll fix that.

Regards,

Roel

RE: How to move x-axis title of CartesianChart - Added by Roel Standaert almost 9 years ago

Note: if you don't have font metrics support (when Wt is built without libharu), the log should show an error like this:

[2017-Mar-08 15:45:37.492774] 7659 [/ uOLv5cdX9ipwPYxO] [error] "WCartesianChart: setAutoLayout(): device does not have font metrics (not even server-side font metrics)."

The binary release of Wt on Windows should include libharu, so if used that and still encounter this problem, there is something wrong with our build.

Regards,

Roel

RE: How to move x-axis title of CartesianChart - Added by Norbert Mösbauer almost 9 years ago

Hello Roel,

you're absolutely right - the error message "WCartesianChart: setAutoLayout(): device does not have font metrics (not even server-side font metrics)" is logged.

  • We will check/enhance our build of Wt

If I understood you right:

  • Only enhancing Wt build: moving x-axis title will only work if setAutoLayout() is disabled
  • With your fix: moving x-axis title will work in any case

Additionally:

Do you have any clue when the fix will be probably done?

  • we could also test it as soon as a patch is available

Regards,

Norbert

RE: How to move x-axis title of CartesianChart - Added by Roel Standaert almost 9 years ago

I'm not sure yet when (or if) we could make setTitleOffset work with WCartesianChart. It's not entirely straightforward. It's currently only applicable to WCartesian3DChart.

In any case, it should work correctly if you build Wt with haru and enable auto layout.

Regards,

Roel

RE: How to move x-axis title of CartesianChart - Added by Norbert Mösbauer almost 9 years ago

Hello Roel,

in our next release we will include haru and I'll come back with the results.

Regards,

Norbert

    (1-6/6)