Google-chart polymer demo and web API are Okay, but ...
See original GitHub issueIt would be really nice to have a “true” Polymer example of the google-chart
element.
Specific examples of how to structure data
, row
, column
, options
using data-binding
would be nice.
How to make it so that charts will size
and resize
appropriately depending on the container and with different viewports and devices, would also be nice.
For example,
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/google-chart/google-chart.html">
<link rel="import" href="shared-styles.html">
<dom-module id="my-gauge">
<template>
<style include="shared-styles">
:host {
display: block;
}
</style>
<div class="wrapper">
<google-chart
id="gauge"
type="gauge"
data='{{data}}'
options='{{options}}'
on-google-chart-ready='chartLoaded'>
</google-chart>
</div>
</template>
<script>
Polymer({
is: 'my-gauge',
properties: {
data: {
type: Array,
notify: true
},
options: {
type: Object,
notify: true
}
},
behaviors: [
Polymer.AppNetworkStatusBehavior,
Polymer.IronResizableBehavior,
],
listeners: {
'iron-resize': '_onIronResize'
},
ready: function() {
console.log('my-gauge is ready')
},
attached: function() {
this.async(this.notifyResize, 1);
},
_onIronResize: function() {
},
chartLoaded: function() {
console.log('google gauge chart is loaded')
}
});
</script>
</dom-module>
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Addy Osmani on Twitter: "<google-chart>: Google Charts ...
I was chatting with someone at EmpireJS about doing charts as web components. glad someone had the time to do them!
Read more >Google Visualization API Reference | Charts
This page lists the objects exposed by the Google Visualization API, ... cells is safe, and changes are immediately propagated to the DataView...
Read more >How to render <google-chart> web component in Polymer
I can't get a <google-chart> element to render on my page. I used Yeoman's Polymer generator to scaffold a Polymer project.
Read more >Lit
Every Lit component is a native web component, with the superpower of interoperability. Web components work anywhere you use HTML, with any framework...
Read more >What Polymer and Angular tell us about the future success of ...
Polymer provides a “low enough” level API that gives web ... but Yehuda does a great job covering the details at a high...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To get resizing of google-chart object to work from inside a Polymer template, I set the css of my chart div to 100% and used the IronResizeableBehavior to trigger on resize actions. One main issue was the use of “redraw” on the google-chart vs other incorrect examples online. The charts now smoothly resize to fit their responsive containers.
@wesalvaro it looks like you are making some big changes, some of which look very interesting.
You mention in the draft that loading will be done through iron-ajax for example. I think providing one complete example of that would be nice and very useful for people that aren’t very familiar with web development.