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 not using full width #2684

Closed
bauerj opened this issue Jun 1, 2016 · 7 comments · Fixed by #4556
Closed

Line-chart not using full width #2684

bauerj opened this issue Jun 1, 2016 · 7 comments · Fixed by #4556

Comments

@bauerj
Copy link

bauerj commented Jun 1, 2016

I'm using Chart.js to display this chart:
jsfiddle ☁️

This is what it looks like in my browser (Chrome 50.0.2661.102 m):

Why is there so much space on the left and right side (illustrated with arrows) of the chart?

I suspect the issue is related to using a time axis as it seems to be better when I switch to a different type.

Is there anything I can do to remove that margin?

@etimberg
Copy link
Member

etimberg commented Jun 1, 2016

What I would do is set an explicit min point on the graph.

@bauerj
Copy link
Author

bauerj commented Jun 2, 2016

Like this?

It doesn't really look better:

o

You didn't categorize this as a bug. Is this expected behaviour?

@etimberg
Copy link
Member

etimberg commented Jun 2, 2016

Based on your fiddle, I don't know why there is a large space at the right edge of the graph. That needs to be investigated and fixed

The overlapping labels are unfortunately due to the minimum being set on the graph. There is already an existing issue to track this.

The padding on the left edge is caused by the length of the label. There is an open issue to track this as well.

@jlujan
Copy link

jlujan commented Jun 3, 2016

From my understanding, not setting round or not setting a min or max value causes the the first tick and last tick to be rounded down/up a tick unit which changes the overall scale length. In your case, specifying the unit unit: 'day' should get you there. See https://jsfiddle.net/7n9pwr6v/1/

@bauerj
Copy link
Author

bauerj commented Jun 5, 2016

Thanks, that really looks much better now.

Are there any downsides in setting the unit manually?

@ktunador
Copy link

ktunador commented Jun 26, 2016

Causes of the problem are tick label display format(day) and rotation

Use the following xAxes configuration to fix them
see: https://jsfiddle.net/ezy1s1bo/5/

xAxes: [{
  type: "time",
  time: {
    tooltipFormat: "MMMM Do YYYY, HH:mm:ss",
    unit: 'minute',
    unitStepSize: '720',
    displayFormats: {
      minute: 'YYYY-MM-DD, HH:mm'
    }
  },
  ticks: {
    minRotation: 90
  }
}]

@etimberg
Copy link
Member

Left side spacing fixed in #3508

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

Successfully merging a pull request may close this issue.

4 participants