Esri / cedar

JavaScript Charts for ArcGIS
https://esri.github.io/cedar
257 stars 238 forks source link

Fully implement support for `specification()` / `definition.specification` #396

Open tomwayson opened 6 years ago

tomwayson commented 6 years ago

Currently you can pass a specification, but we don't use it. Also, for parity w/ v0, specification should either be a string (URL) or amCharts JSON. If it's a URL, we should fetch it and return the JSON payload. The problem w/ that is, when to do it? As a side effect when you set the specification? During one of the existing async functions (show(), getData())? Or do we make render async, which sounds horrible, but we may want to start fetching the built in types ('bar', etc) the way we did in v0 instead of bundling them. An alternative to making the render function async would be for cedar-amcharts to expose an async fetchSpec(type) method. Then we can add an async step to show() that either resolves the spec JSON that's passed in, or fetches the spec by URL or type. One of the latter two options would be my preference.

We can open a new issue for handling spec as URL if we don't want to deal w/ ^^^ right now.

In Once we have the spec, during render, it should check if one was passed in and use that instead of getting fetching one by type.