Add Google Charts support
Graphs are a great visual tool to display data. Enabling Google Charts support for AMP Stories can give a great boost towards displaying data in the slides, for use cases like annual reports, data driven application, statistics based news and much more.
I don't think we would want this to be stories-specific in any way; if we were to implement this, I would imagine it would just be an AMP component that is usable either in standard AMP documents or in stories.
/to @aghassemi
Actually, I was confused what Google Charts is 😄
Turns out, you can just get the chart as an image URL and use it with <amp-img>. Here's an example of doing that in an <amp-story>: http://jsfiddle.net/adnc8p7h/
@psdtomanythings feel free to reopen if you feel this does not adequately address your issue.
Okay, I now see that the image chart API is deprecated 😑
Back to my original answer! If you want something in the meantime, it does look like there are various image-based chart APIs available.
The big issue with visualization components is that they would require a declarative API to work in AMP (since no JS) and the API surface is huge making it very hard to design an API for.
The closest thing to this is amp-vega-viz which is experimental and uses Vega's declarative JSON based API. We are considering launching it but its dependencies on 3D.js makes this a bug JS payload which is not good for performance.
server-side rendering and later amp-script is really the right solution for this where libraries like Google Charts can be used.
/cc @ericlindley-g
The problem with server-side rendering is that the output is a static SVG - sans animation.
viz-vega provides many of the features available in d3.js.
we have successfully ported several d3.js implementations to viz-vega with 1:1 functionality.
many of the Google Charts also can be implemented in viz-vega with 1:1 functionality.
IOHO, an effective solution is an updated amp-viz-vega that supports key functions (previously reported as missing).
For what it's worth: I run the QuickChart project, a static chart renderer that generates images from Chart.js configs. This allows you to embed static Chart.js charts in AMP.
It also includes a partial reimplementation of the deprecated Google Image Charts API as well as a server-side Google Charts rendering endpoint. You can use these tools to create non-interactive chart images using your preferred charting library in AMP.
@typpo - Great. But we need it in AMP Stories. So, even if QuickChart is supported in AMP, the stories working group needs to enable support for web stories.
@newmuis - Is this possible ?
If I'm understanding correctly, the output here is just an image, so yes, it could be embedded in a story the same way as any other image.
Can we run an amp-iframe in amp-story?
No, amp-iframe is not allowed in amp-story, and, with all likelihood, will never be allowed within the page itself, given that it's impossible to control or understand the user experience within the iframe.
What would you want to use it for?
Run D3.JS instances. We run those in an iFrame now on an amp-page. It's the only realistic way of running non-amp services, of which chart.js and similar are examples, on an amp-page. We have tried and failed several times to adapt our d3.js instances in amp-script. So if we have interesting data animated using libs such as d3.js, we can't run those in amp-story. Our work around: show a PNG and then link to the page that runs the d3.js.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.