Project

General

Profile

WCartesianChart grid looks bad depending on Pen

Added by Ulf Johnsson over 3 years ago

Hi.

It seems there is some issue in how WCartesianChart renders the grid.
This is especially noticible when using a pen that is not solid, for example DashDot.

When zooming around in the chart the looks of the grid changes, sometimes it almost looks like a solid line,
sometimes it just looks blurry, and sometimes it looks right.

Implementing my own grid (that does not have this problem) I have found that the problem is in WCartesianChart::renderGrid().
Mor specificly it seems to be some issue when mapping the painterpath that contains all the horizontal lines (or vertical) with this code:

painter.strokePath(zoomRangeTransform(axis.yAxisId()).map(gridPath).crisp(), pen);

If you instead map one line at a time and stroke it (instead of all at once) it works nicely.
I do not know why this makes a difference , but it certainly does.

Using Wt 4.4

BR, Ulf