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

Spark line chart appendData logs "dfsfgdgdgdf" and is not updating the chart #43

Closed
robinwassen opened this issue Aug 19, 2018 · 5 comments

Comments

@robinwassen
Copy link

I took the spark1 from the spark line demo and tried to append data by adding the following:

setInterval(function() {
  spark1.appendData({
    data: [ 20 ]
  });
}, 300);

The data is not appended and 'dfsfgdgdgdf' is printed to the console every 300:th ms. Looking in the source code there is a random console log there:

console.log('dfsfgdgdgdf')

@robinwassen robinwassen changed the title Spark line chart appendData logs "dfsfgdgdgdf" and not updating the chart Spark line chart appendData logs "dfsfgdgdgdf" and is not updating the chart Aug 19, 2018
@robinwassen
Copy link
Author

In addition to that appendData() documentation is inconsistent: https://apexcharts.com/docs/methods/#appendData

Name Type Default Description
newData Array [ ] The data array to append the existing series datasets

While the example suggest that you send an object to appendData()

@robinwassen
Copy link
Author

The documentation for https://apexcharts.com/docs/methods/#updateSeries is also wrong

chart.updateSeries([
  data: [32, 44, 31, 41, 22]
])

The argument in the example is an array with a named key which is invalid javascript, it is supposed to be:

chart.updateSeries([{
  data: [32, 44, 31, 41, 22]
}])

updateSeries actually works for the spark lines though.

@junedchhipa
Copy link
Contributor

junedchhipa commented Aug 19, 2018

Thanks for bringing this to attention.

The documentation was indeed wrong for the updateSeries() and appendData() methods, and I updated it on the website.

Also, removed the random console.logs.

I will check the appendData() with sparklines

@junedchhipa
Copy link
Contributor

The appendData() method works correctly with the updated doc. It was missing the array parenthesis.
The correct format would be this as updated in the website docs recently

setInterval(function() {
      spark3.appendData([{
        data: [20]
      }]);
    }, 1000);

Here's the result

sparkline-update

@robinwassen
Copy link
Author

@junedchhipa Thank you for the quick response, this solves my issues! 👍

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