question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chartist labels are getting cropped.

See original GitHub issue

Here’s an example from my site:

screenshot 2015-01-22 05 46 11

This also happens on chartists documentation site (http://gionkunz.github.io/chartist-js/getting-started.html):

screenshot 2015-01-22 05 45 55

Is this expected behavior? The only way I can fix it is by manually adjusting the <foreignobject> but then the label overlays the graph, or set overflow: visible on <svg>.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7

github_iconTop GitHub Comments

9reactions
gionkunzcommented, Jan 22, 2015

Hey there. As the multiline labels are done with foreignObjects in SVG there is no way how we could assume a required width. For this purpose we switched to a configurable offset of the chart per axis. In the configuration just use the offset configuration if you need to expand the space used for the labels:

axisX: {
  offset: 100
},
axisY: {
  offset: 100
}

Check this example: http://jsbin.com/fesavu/1/edit?html,css,js,output

0reactions
oscarAGcommented, Aug 5, 2019

This is what worked for me.

svg.ct-chart-bar, svg.ct-chart-line{
	overflow: visible;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Space for long labels in Chartist - Stack Overflow
The idea with chartist, is that there is a separation of presentation and data, so all the chart elements are accessible through Css....
Read more >
Axis labels get cropped / trimmed · Issue #715 · chartjs/Chart.js
Hi,. The labels on the X-axis get cropped when they are "too long": cropped_lables. I can provide a code example if necessary. I...
Read more >
Chartist - Getting started - GitHub Pages
The easiest way to get started with Chartist.js is by using bower: ... var data = { // A labels array that can...
Read more >
gionkunz/chartist-js - Gitter
I am trying to set the x-axis labels which is a list of of the last 7 dates. The issue I am encountering...
Read more >
Chartist.js Options - CodePen
Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found