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.

Text not displaying in bar chart

See original GitHub issue

Hello,

I’m working with the following dataframe and I’m having an issue with the bars in orange are not displaying the text as if they are not finding a value to display even though the data is there.

my code and data here. this code is only for the left side, the right side is working fine.

l = alt.Chart(mlt).mark_bar().encode(
    y = alt.Y('Top_City', sort=alt.EncodingSortField(field="FARS_PerCapita",order='ascending', op='max'), axis=None),
    x = alt.X('FARS_PerCapita',sort='descending',
             axis=alt.Axis(title=None)),
    color = alt.Color('Type',
                      scale=alt.Scale(domain=['non_fatal', 'fatal'],
                                      range=['blue', 'orange']),
                     legend=alt.Legend(orient='bottom', labelLimit = 200))  
)

text = l.mark_text(
    align='right',
    baseline='middle',
    dx=-15 
).encode(
    text='FARS_PerCapita'
)

image

image

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Dave-Hdzcommented, Jan 27, 2021

That makes total sense. I didn’t realize that the bars were stacked (of course they were, I’m doing a stack bar). I thought that they were overlaid on top of each other because of the same name of the encoding.

I was able to fix it with your suggestion of using max in the X encoding in the bar chart.

Thank you so much!

image

0reactions
Dave-Hdzcommented, Jan 29, 2021

Fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Barchart Text inside the bar is not showing. - Highcharts
Re: Barchart Text inside the bar is not showing. ... Yes its true that the label doesnt overlap with the X-Axis. But why...
Read more >
How to display Text values on Bar chart?
The bar graph itself cannot display text. The reason why I suggest you change your judgment condition to -1 is to keep the...
Read more >
Text instead of numbers on X axis in bar chart
I am making a graph (bar) out of this data below. I would like the X axis to show text like "Unsatisfactory", "Needs...
Read more >
D3 bar chart bar text labels not visible properly - Stack Overflow
I have a stacked bar chart in d3.js For every stacked bar i have corresponding text value showing near stack itself. problem is,...
Read more >
Help. Text information not showing to all bars in Gant Chart
I don't know why when creating the dashboard and asking to show the as entire view Tableau does not display all the values...
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