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.

Description

For a line-chart I’d like to be able to set Y-axis tick text inline on narrow screens: The tick text would show inside the line-chart as described in this article: “Inset y-axis labels on small viewports”

image

On narrow screens this would free up some horizontal space in the left margin of the chart. I cannot find any config setting for this.

I could set something like:

chart.config( `axis.y.tick.text.position.x`, 20); // 20 is arbitrary :(

… but the value (20) depends on the width of the value, and this could be anything…

Q: Is there a way to set the Y-axis text ‘inline’?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
netilcommented, Mar 11, 2019

@davidhund, I fixed axis inner style to be updated via .config() (checkout the screenshot from #802)

1reaction
davidhundcommented, Mar 8, 2019

@netil - I’ve added a codepen: https://codepen.io/davidhund/pen/jJmLjJ

The issue is with dynamically setting the inner with chart.config

If you look at the JS pane, line 29 I can set inner to true directly and it works

// ..
axis: {
  y: {
    inner: true // THIS WORKS
  }
}
// ..

However: I am using chart.config after initializing the Chart (see line 68):

if(window.matchMedia(`(max-width: 55em)`).matches) {
  // ...
  chart.config(`axis.y.inner`, true); // THIS DOES NOT WORK
}

Maybe that is because I found I needed to re-draw the Chart with chart.show() after creation to have the config changes be picked up. See lines 73 - 75

// Config changes
// .. chart.config(xyz);

// RE-render (!?)
// https://github.com/naver/billboard.js/issues/500#issuecomment-406487456
chart.show();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Grid Axis - MDN Web Docs Glossary: Definitions of ... - Mozilla
The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows...
Read more >
d3.js - inline style stroke-width for axis makes bold tick labels
I am expecting {'stroke-width': '3px'} to make thick axis lines. But it makes bold axis labels. I expected the text to be controlled...
Read more >
Change axis labels in a chart - Microsoft Support
Change the text and format of category axis labels and the number format of value axis labels in your chart (graph).
Read more >
CSS Inline Layout Module Level 3 - W3C
A baseline is a line along the inline axis of a line box along which individual glyphs of text are aligned. Baselines guide...
Read more >
Y - Axis labels in Line Chart - Microsoft Power BI Community
Y - Axis labels in Line Chart. ‎01-25-2019 09:22 AM. Help me please,. We use this kind of chart a lot where I...
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