ember-charts | A charting library built with the Ember | Data Visualization library
kandi X-RAY | ember-charts Summary
kandi X-RAY | ember-charts Summary
A charting library built with the Ember.js and d3.js frameworks. It includes time series, bar, pie, and scatter charts which are easy to extend and modify. The out-of-the-box behavior these chart components represents our thoughts on best practices in chart interactivity and presentation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Splits an object by key and value returning an object based on the keys provided
ember-charts Key Features
ember-charts Examples and Code Snippets
Community Discussions
Trending Discussions on ember-charts
QUESTION
I have a model in a route that has data i'd like to chart using a chart plugin (ember-google-charts or ember-charts specifics do not matter to my issue)
in routes/server.js
:
ANSWER
Answered 2017-May-19 at 14:511.You can use forEach
to iterate and return result you created. refer this answer for work with ember model
QUESTION
EDIT: Upon looking further, something is calling toString
on the array being returned from the model hook. Hard-coded, this method works fine, but being returned like I have below, it doesn't.
TL;DR: I'm manipulating one array of data to a different "format" so that I can use the Ember Charts add on. To do this, I'm using Ember.RSVP in the model hook of my route, but I'm getting a TypeError: Cannot convert object to primitive value
and don't know why.
I've been learning Ember (followed their quickstart and then super-rentals tutorial), and I am now trying to build my own project with it.
The issue that I'm having is dealing with async operations within the model hook of my route. This may be a long read, but I'm trying to be very specific. The end problem, however, is that I'm getting a TypeError: Cannot convert object to primitive value
at the end of it all.
I'm using Mirage to fake a backend API, and it returns my data like this:
...ANSWER
Answered 2017-May-04 at 17:24EDIT: the answer still lies with JSON.parse(JSON.stringify(data))
, but I updated with kumkanillam's much simpler approach returning the data.
It turned out the error was coming from Array.toString
being called on the data being returned from the model hook. It worked fine on a hard-coded array of objects, but not when returned via RSVP as I have in my question.
Upon inspecting both, it turned out, when using Ember.RSVP, the objects in the returned array lacked a toString method on them, somehow... I tried solving this via setting the prototype with Object.create(), but didn't work.
Bottom line is, and I'm still not 100% clear, I thought maybe Ember was turning my array into something else (an Ember Object?), not just a plain JS array of objects. So I ended up converting the returned data into a plain JS object again, via this answer.
Route now looks like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ember-charts
View the demos and read the documentation: http://localhost:4200
Run tests: http://localhost:4200/tests
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