Line chart is cut off when lineWidth is greater than 1

14 views
Skip to first unread message

Phúc Nguyễn

unread,
Mar 2, 2023, 11:26:00 AM3/2/23
to Google Chart API
Hi all, I have an issue with Google Line Chart. When I try to configure the lineWidth property of the line chart, I notice that a part of the line is cut off. This issue does not occur when lineWidth = 1. Is there any way to make the line fully displayed without changing the max and the min property of the viewWindow. 
Thanks a lot.

Daniel LaLiberte

unread,
Mar 2, 2023, 11:52:45 AM3/2/23
to Google Chart API
That's an interesting puzzle.  The problem is not specifically that the lineWidth is greater than 1, though that does expose the problem.  The underlying problem is that your chart area cuts off the bottom half of the line because the horizontal line at a value of 0 is exactly on the bottom edge of the chart.  There is no way to display chart components outside the chart area at this time, though it would seem to be a reasonable option to enable in some situations.   So you'll have to resort to expanding the viewWindow enough to avoid the cut-off.

This problem should be considered a bug, though it normally rarely occurs, and is easy to work around. It is difficult to fix "properly" since the overlapping graphics can be arbitrarily large and interfere with other things like axis labels and legends, and it ultimately bumps up against the edge of the container element.  So we would have to instead inset the overlapping area so it is within the chart area, thus shrinking everything to fit, which then has complications for drawing other things in a predictable way.
Reply all
Reply to author
Forward
0 new messages