question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling chart.update with less datasets fails

See original GitHub issue

Expected Behaviour

Dataset is removed

Actual Behaviour

TypeError
Cannot read property 'yPositions' of undefined
AxisChart.eval
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:2718:25
ChartComponent.refresh
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:1540:30
ChartComponent.update
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:1560:10
eval
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:1347:54
AxisChart.render
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:1346:16
AxisChart.update
https://viqud.csb.app/node_modules/frappe-charts/dist/frappe-charts.esm.js:1339:10
evaluate
/src/index.js:60:5

Steps to Reproduce:

  • Create a chart with multiple datasets
  • Call chart.update with the new data object with less datasets

I thought maybe this was related to some animation code but it seems to happen even when animation option is passed in with 0

The use-case here is that we’re showing 4 data sets that the user can toggle on/off to view less or more data but when removing datasets we’re seeing a type error

NOTE: Add a GIF/Screenshot if required.

Frappé Charts version: Codepen / Codesandbox: https://codesandbox.io/s/frappe-charts-demo-forked-edktp

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
olssonmcommented, Mar 29, 2021

No worries, no rush at all. I’ve temporary solved it by redrawing the entire chart:

(function () {
    var data = {chartdata};
    
    drawChart(data);

    document.addEventListener('updated', function(data) {
        drawChart(data);
    });

    function drawChart(data) {
       const chart = new frappe.Chart("#chart", {...});
    }
})();

Not ideal of course, but in the meantime it works =) Thanks for looking into it though; always enjoyed Frappe Charts and I’m sure other have/or will have encounter this issue to.

0reactions
scmmishracommented, Mar 29, 2021

Heya, I spent some time trying to fix this, and I managed to uncover quite a few holes in the data update pipeline. It’ll take some more time for me to fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically update values of a chartjs chart - Stack Overflow
in the test code, I am updating the values with datasets[0].data - is this the right way to do it? The problem with...
Read more >
Troubleshoot refresh scenarios - Power BI - Microsoft Learn
This article provides ways to troubleshoot issues with refreshing data within the Power BI service, for various data sources and conditions.
Read more >
2 ways to reduce your Power BI dataset size and speed up ...
Adam shows you two things to reduce your Power BI dataset size. ... a lot of space and improve refresh times along with...
Read more >
Updating dataset properties | BigQuery - Google Cloud
You can update a dataset's description in the following ways: Using the Google Cloud console. Using the bq command-line tool's bq update command....
Read more >
Visualization: Pie Chart - Google Developers
Slices less than 25% of the pie will be // combined into an "Other" slice. ... The chart accepts further method calls only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found