Comments (9)
Thanks - this is a good step to iron out. I'm tempted to suggest we put this forth on the Vega mailing list / repo. It would be valuable to get broader community input as it could be useful to them or give feedback on what to be aware of issues.
I think it's ok to be nesting the vega template in a separate object - though it also feels weird. We are breaking the spec by using the {variable}
so it's not valid until it's merged. We should still support Vega format directly. If someone authors a chart in R they should be able to load it via URL or inline JSON. I believe var cedar = new Cedar({chartDefinition: chartDefintionObjOrUrl})
supports that.
An internal format is fine for whatever works. But for the developer API, one litmus test of usability I like to use is, can I write it by hand without looking at the docs or a JSON formatter?
Nitpicking:
- use
dataset
instead ofdataSource
to align with opendata api discussions - don't duplicate words (e.g.
chart*
within the chart construtor - we already know it's a chart-something) - generally avoid multiWordNames.
{
"inputs":[... array of inputs...],
"template":{ ... template of a vega spec ...}
}
becomes:
{
"dataset": {
"url": "...url to service...",
"query": {... json hash of query params ...}
"data": [...optional array of features...]
},
"specification": {
"inputs":[... array of inputs...],
"template":{ ... template of a vega spec ...}
}
}
from cedar.
Great feedback! As they say - naming things is one of "the hard problems" :)
As for vega spec's authored elsewhere - since they lack the "inputs" hash and the {variable}
templates, all we can do is display the chart. We would likely also need defensive code to block attempts to manipulate the chart - i.e. the query etc.
Finally - in the example code I showed some chaining -after some digging, while we can build some aspects of the api to be chainable (likely setters), getters (by their nature) can't chain. Also - if we use real javascript properties, then we can't chain properties at all because the setters are not functions.
More chaining info from d3 http://alignedleft.com/tutorials/d3/chaining-methods
Anyhow - that's something I'll explore and we can discuss with some consumers of the api... chaining is elegant, but I don't think we want elegance at the cost of confusion.
from cedar.
Indeed standard Vega would not be templates, but hard-coded but still 'embeddable' in a webmap, or alone via Cedar. Perhaps still as a Portal Item
from cedar.
Agreed - I'm starting the refactor to this json now.
from cedar.
just for the record - this is the structure I'm using... I'm putting the mappings into the dataset node as it's tightly bound to the... dataset
{
"dataset": {
"url": "...url to service...",
"query": {... json hash of query params ...}
"data": [...optional array of features...],
"mappings":{...mappings hash..}
},
"specification": {
"inputs":[... array of inputs...],
"template":{ ... template of a vega spec ...}
}
}
``
from cedar.
Sounds good for now, though I could see benefit keeping them separate since the mappings is the join and the data are independent of the chart template. So the data could be reused or defined in operation layers that applies to different chart specifications.
Keep joined for now and we can pull apart if based on future benefit.
from cedar.
Update: have it working, but in the process, made the Cedar super messy - will clean up, get the other examples working and PR over the weekend.
I also picked up a temporary dependency on underscore - for object cloning and augmentation - will likely remove this and cook in a custom build of lodash to have just the helpers we need.
from cedar.
made the Cedar super messy
sappy
picked up a temporary dependency on underscore
I was wondering if this was going to happen. I like moving to the built-in and later removed of lodash when possible.
Looking forward to working with it once you get this JSON in place.
from cedar.
Closing as the main PR for this was merged
from cedar.
Related Issues (20)
- Add to doc - examples of changing data formats HOT 1
- Please show examples using ArcGIS API for JavaScript version 4.x HOT 3
- Capability to Convert Between Units? HOT 2
- deploy v1 docs
- domains are not decoded for datasets that don't query features (i.e. use `data`)
- fetching chart JSON from "CDN" returns 404 for v0.x HOT 8
- give @jgravois the keys to publish arcgis-cedar on npm HOT 1
- definition should provide a way to specify or override default axis labels
- how to set up cedar properly to chart object arrays? HOT 2
- Cedar not working - TypeError: keys.reduce is not a function HOT 4
- add repository.directory to packakge.json
- Sparkline Support
- Chart not rendering data correctly HOT 2
- change color of data series
- Cedar with React HOT 3
- number format issue HOT 5
- export button HOT 1
- add function that converts the chart data/series to a feature set HOT 1
- Allow passing request options to query HOT 1
- UMD bundles include arcgis-rest-js dependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cedar.