Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line chart line thickness when zero #6552

Closed
jasonlynx opened this issue Oct 4, 2019 · 14 comments
Closed

Line chart line thickness when zero #6552

jasonlynx opened this issue Oct 4, 2019 · 14 comments

Comments

@jasonlynx
Copy link

jasonlynx commented Oct 4, 2019

Somewhat picky but on a line chart a line that reaches zero should be the same thickness the entire way across the chart regardless of the value. The line once it reaches the bottom/zero looks somewhat hidden or cut off until it goes above zero. See below:

Screen Shot 2019-10-04 at 4 07 00 PM

@kurkle
Copy link
Member

kurkle commented Oct 31, 2019

What version are you using?

@jasonlynx
Copy link
Author

2.7.2

@kurkle
Copy link
Member

kurkle commented Oct 31, 2019

This was fixed in #5321 (2 years ago) and included in 2.7.3

@kurkle kurkle closed this as completed Oct 31, 2019
@mbont
Copy link

mbont commented Nov 1, 2019

Still having this issue in the latest version when hiding the x-y axis and legend (bottom and top line are cut off).

See the following example:
https://jsfiddle.net/drc4z9wj/1/

Any fix for this?

@kurkle
Copy link
Member

kurkle commented Nov 1, 2019

@mbont your fiddle uses Chart.js 2.3.0.

@mbont
Copy link

mbont commented Nov 1, 2019

@kurkle Updated fiddle with latest Chart.js 2.9.1 version (not available on cdnjs yet)

@kurkle
Copy link
Member

kurkle commented Nov 1, 2019

@mbont ok, in that case the canvas edge is limiting the drawing. You need to add some padding to allow chartArea overflow:

options: {
      layout: {
      	padding: 1
      }
}

@mbont
Copy link

mbont commented Nov 1, 2019

@kurkle Thanks, that works!

@nishantprajapti
Copy link

nishantprajapti commented Nov 29, 2019

@kurkle Please see this https://jsfiddle.net/nishantprajapati/7hn2vcju/1/ I am able to re-produce this issue in latest release 2.9.3. Can you help us out with a solution ? Or Let us know if it will be a part of next release.

image

The image attached is a real use case where 2 different chart use the same chart JS (2.9.3 version)
code still while all the value are at the highest mark of the chart, thickness of the line changes which looks inconsistent.

Thank you,
Nishant Prajapati

@kurkle
Copy link
Member

kurkle commented Nov 29, 2019

@nishantprajapti in that fiddle, the canvas edge is limiting, so padding fixes it.

It does not seem like that is the case with your real use case though.
Did you configure clip or is it using default? Does clip: false (per dataset) change the behavior?
Are you using any plugins?

@nishantprajapti
Copy link

nishantprajapti commented Nov 29, 2019

Does clip: false (per dataset) change the behavior?

Thank you so much for the help @kurkle . It work for me but curious to know something. When i set the value to false. It work but when i gave it properties like clip: {left:2,top:0} and so on I did not notice any change. How does it property actually work ?

@kurkle
Copy link
Member

kurkle commented Nov 30, 2019

It looks like there is a bug, you have to define all edges for it to work: https://jsfiddle.net/zchb3L4w/

@nishantprajapti
Copy link

@kurkle in that what should we keep the default values for {top, left ,bottom,right} so that no new bug is encoutered and also the above issue mentioned by me is also solved.

@kurkle
Copy link
Member

kurkle commented Dec 5, 2019

@nishantprajapti I can't answer that based on the information provided. clip: false could work, if you are not zooming the chart.
Also I'm guessing you are using scriptable or indexable borderWidth, and that's why the default of "allow half of the border to overflow" is not working. But it could be something else.

Anyway, lets stop wasting time: if its not working how its documented, please file a new bug with a fiddle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants