Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend does not reload when chart is updated. #31

Closed
henriquecf opened this issue Aug 3, 2015 · 1 comment
Closed

Legend does not reload when chart is updated. #31

henriquecf opened this issue Aug 3, 2015 · 1 comment

Comments

@henriquecf
Copy link
Contributor

Hello. I noticed that the legend does not update when chart changes. Not sure if this is intended but I solved this with a simple addition to updateChart:

updateChart: function(){
    var chart = this.get('chart');
    var data = this.get('data');
    var redraw = ChartDataUpdater.create({
      data: data,
      chart: chart
    }).updateByType();

    if (redraw) {
      this.willDestroyElement();
      this.didInsertElement();
    } else {
      chart.update();
    }

    if (this.get('legend')) {
      this.$().parent().children('[class$=legend]').remove();
      var legend = chart.generateLegend();
      this.$().parent().append(legend);
    }
  }

If you agree I can make a test and send a pull request.

@aomran
Copy link
Collaborator

aomran commented Aug 8, 2015

@henriquecf this looks good.

@aomran aomran closed this as completed in 9806658 Aug 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants