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

Charts Refresh not working on primeng 2.0.2 #2239

Closed
agusdutra opened this issue Mar 8, 2017 · 1 comment
Closed

Charts Refresh not working on primeng 2.0.2 #2239

agusdutra opened this issue Mar 8, 2017 · 1 comment

Comments

@agusdutra
Copy link

I'm submitting a ...
[ X] bug report

Current behavior
I have some p-charts on a template and I'm updating it's data from the component on the OnInit inside a subscribe function.
I managed it to update the data following the steps explained on this bug report: #568

I was using primeng 2.0.0 and it was working OK as expected. I've updated it to the latest version 2.0.2 and it stoped working.

I downgraded back to 2.0.0 and worked again. The only change that I've made was the version change of primeng.

The code that I'm using to load and update the chart:

  @ViewChild("findings") chart: UIChart;
  ngOnInit() {

this.service.getDashboard().subscribe((dataSub) => {
        this.data = {
          labels: dataSub.keys,
          datasets: [{
            label: ' ',
            backgroundColor: this.colors,
            borderColor: this.colors,
            data: dataSub.values
          }]
        };
        this.chart.data = this.data;
        this.chart.refresh();

      }
    );
}

On the html template:

 <p-chart #chart type="bar" [height]="200" [width]="340" [data]="data"
                     [options]="options"></p-chart>

Minimal reproduction of the problem with instructions
-Use a p-chart that needs to be refreshed to show the data with primeng 2.0.0
-Update primeng to 2.0.2.

Please tell us about your environment
-WebStorm
-agular-cli 1.0.0-beta.26

Angular version: 2.4.4
PrimeNG version: 2.0.2
Language: Typescipt
Node: 6.10

@Mrtcndkn
Copy link
Contributor

Mrtcndkn commented Mar 8, 2017

Hi,

If you are changing your data not your array just data inside of it then you should use refresh manually. But if you are changing your array then after 4.0.RC1 changeDetection will work automatically without any function call.

@Mrtcndkn Mrtcndkn closed this as completed Mar 8, 2017
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