superset icon indicating copy to clipboard operation
superset copied to clipboard

Data Labels overlaps with the Legends

Open shyam2794 opened this issue 9 years ago • 7 comments

Make sure these boxes are checked before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if any
  • [x] I have reproduced the issue with at least the latest released version of superset
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar

Hi, the bar values in the stacked bar charts of time series bar chart overlaps with the legends . I know i can fix this by providing the y-axis bounds , but the issue is that the data for the dashboards are loaded and viewed on a daily basis where , if i provide the time bound to be 1 Million and if the end user sees the previous day data which is 10k , then the stacked bar is hardly visible as the y-axis scale is fixed to 1 million .

It would be helpfull if there is a default spacing between the legends and bar values

Superset version

20.4

Expected results

I need the bar values to be visible clearly and should not overlap with the legends . something like this , here the bar size is small so it is visible clearly .

screenshot from 2017-10-13 22-54-41

Actual results

The Values in the stacked bar overlaps with the legends .

screenshot from 2017-11-05 23-51-32

Steps to reproduce

create a stacked bar chart in the visualization time series - bar chart with bar values and legends options in the chart option being checked .

shyam2794 avatar Nov 05 '17 18:11 shyam2794

@mistercrunch , @xrmx Is there anyway to fix this ?

shyam2794 avatar Nov 07 '17 07:11 shyam2794

There's always a way. Somehow the Values feature (which is a community-contributed hack on top of nvd3) should call for more top margin.

mistercrunch avatar Nov 08 '17 06:11 mistercrunch

@mistercrunch we can have the legends to have a bottom margin , g.nv-legendWrap.nvd3-svg this is the class provided in legend but unable to do the styling .

shyam2794 avatar Nov 08 '17 09:11 shyam2794

Added the below code in nvd3_vis.js , this fixed the issue .

if ('showLegend' in chart && typeof fd.show_legend !== 'undefined') { if (width < BREAKPOINTS.small && vizType !== 'pie') { chart.showLegend(false); } else { chart.showLegend(fd.show_legend); chart.legend.margin({top: 5, right:30, left:80, bottom: 30}); } }

shyam2794 avatar Nov 08 '17 18:11 shyam2794

@shyam2794 the issues closes when it's fixed in master, not on your fork... please send a PR

mistercrunch avatar Nov 09 '17 04:11 mistercrunch

Fixed by #6145

kristw avatar Dec 24 '18 16:12 kristw

https://github.com/apache/superset/issues/8480#issuecomment-783968579

Neel-rishabhsoft avatar Feb 23 '21 07:02 Neel-rishabhsoft