Incubator-superset: Remove and Re-align the Bar values on clicking the legend

Created on 22 Mar 2018  路  5Comments  路  Source: apache/incubator-superset

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

Superset version

23.3

Actual Results

Hi Team , when trying to uncheck the legend in the time series bar chart , The bar values does not clean up . This appear for both grouped and stacked chart .

Before unchecking the legend

screenshot from 2018-03-22 21-10-19

After unchecking the legend , i have unchecked (IPD) in the legend , But still the bar values appear .

screenshot from 2018-03-22 21-11-13

Expected Results

When the legend(s) is/are unchecked the bar values for that legend(s) should not be visible and the bar values for the remaining bars should be re-aligned .

Steps to Reproduce

  1. create a chart with time series bar as visualisation type
  2. choose a metric and choose a column under group by
  3. check the legends and bar values check box
  4. Now in the chart click on the legend to uncheck it .
inactive

Most helpful comment

I also met this bug. I fix it by adding following code to NVD3VIs.js file:

find

case 'dist_bar':
        chart = nv.models.multiBarChart()
          .showControls(showControls)
          .reduceXTicks(reduceXTicks)
          .groupSpacing(0.1); // Distance between each group of bars.

add the following code:

chart.legend.dispatch.on('legendClick',function (evt) {
              svg.selectAll('.bar-chart-label').remove();
              setTimeout(function () {
                  if(!fd.show_bar_value){
                      svg.selectAll('.bar-chart-label').remove();
                  }
                  addTotalBarValues(svg, chart, data, stacked, fd.y_axis_format);

              }, animationTime + 1);


          })

And the label are there~

wechatimg482

All 5 comments

Hi Team ,
Any update on this ..

We are also having a similar issue in our use case of showing markers in line charts, where unchecking/rechecking a legend renders the new line without markers.

Steps to reproduce:

  1. Create a line chart with a metric and multiple groups
  2. Check the "Show Markers" option in Style
  3. Uncheck and recheck a group via the legend

Before uncheck/recheck:
screen shot 2018-06-07 at 10 08 16 am

After uncheck/recheck:
screen shot 2018-06-07 at 10 08 33 am

EDIT: My bad, seems to already be described here https://github.com/apache/incubator-superset/issues/3614. If the line chart issue is unrelated to the bar chart issue, I can move the conversation to the other ticket.

I also met this bug. I fix it by adding following code to NVD3VIs.js file:

find

case 'dist_bar':
        chart = nv.models.multiBarChart()
          .showControls(showControls)
          .reduceXTicks(reduceXTicks)
          .groupSpacing(0.1); // Distance between each group of bars.

add the following code:

chart.legend.dispatch.on('legendClick',function (evt) {
              svg.selectAll('.bar-chart-label').remove();
              setTimeout(function () {
                  if(!fd.show_bar_value){
                      svg.selectAll('.bar-chart-label').remove();
                  }
                  addTotalBarValues(svg, chart, data, stacked, fd.y_axis_format);

              }, animationTime + 1);


          })

And the label are there~

wechatimg482

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This seems like a valid thing to add, no?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sashank picture sashank  路  3Comments

josephtyler picture josephtyler  路  3Comments

eliab picture eliab  路  3Comments

john-bodley picture john-bodley  路  3Comments

tmccartan picture tmccartan  路  3Comments