Text not displaying in bar chart
See original GitHub issueHello,
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'
)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
Fixed