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.
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 asyncfetchSpec(type)
method. Then we can add an async step toshow()
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.