npm-stats | Show GitHub matrix
kandi X-RAY | npm-stats Summary
kandi X-RAY | npm-stats Summary
Show GitHub matrix (stars, issues, forks, watches) of your project dependencies
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of npm-stats
npm-stats Key Features
npm-stats Examples and Code Snippets
Community Discussions
Trending Discussions on npm-stats
QUESTION
I'm using the following tutorial (pull download stats for NPM packages) to build a basis for my charted webapp :
- https://hackernoon.com/lets-build-a-web-app-with-vue-chart-js-and-an-api-544eb81c4b44
- https://github.com/apertureless/npm-stats
I have extracted the below code from the tutorial and modified it so it does the pure basics. Get data and present data. Specifically from these:
- https://github.com/apertureless/npm-stats/blob/develop/src/pages/Start.vue
- https://github.com/apertureless/npm-stats/blob/develop/src/components/LineChart.vue
Please note: The code executes the API call and retrieves data no problem. However it will only render that data in the chart if I make a code change. For example changing the color of a line to something else. It seems to only work on the next 'cycle' if that makes sense. Once the data has rendered, if I refresh that page it is once again blank. I suspect it has something to do with the pages timing. However not sure where to begin or what I'm looking for.
App.Vue
...ANSWER
Answered 2020-Mar-12 at 13:15You need to notify the child component to re-render itself.
add a watcher
is one way, watch the data change and update it.
Another easier way is, add a key
prop to it.
in your App.vue
, do like this:
QUESTION
I'm trying to use a similar approach to this project where labels
and datasets
are defined in a child component with binds to props in the parent component but I'm not getting any results.
"Vue.js devtools" add-on shows that props contain data passed in the parent component however the initial console log show empty arrays:
...ANSWER
Answered 2018-Jul-31 at 09:33Well the
reactivePropMixin
will not work in your example. Because it will only work if you pass the whole chart.js data object as a prop. Not only the data array for one dataset. It is quite limited. However you can simply add an own watcher and then callthis.$data._chart.update()
The main problem with API requests is that they are async. So you component gets mounted, request the data and your chart gets rendered with no data, because your api call is maybe not finished at the time. Then it finishes, mutate your data and your chart will break. To prevent this it is a common practice to add a condition. In your promise or async call you need to define something like
isLoaded
and if you finished the api call you can set it to true. And then add a condition to your chartv-if="isLoaded"
so your chart gets initially only rendered if you have your data from the API.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install npm-stats
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page