score:7
I don't have a solution for Highcharts, but the Polymeric way to do this is to think declaratively. You don't need $.getJSON
. You need an element like <google-chart>
, that declaratively renders a chart from data and <core-ajax>
for fetching the json data.
The whole element definition becomes something like:
<polymer-element name="bar-charts" attributes="source" noscript>
<template>
<core-ajax auto url="{{source}} response="{{items}}" handleAs="json"></core-ajax>
<template repeat="{{item in items}}">
<google-chart type='pie' height='300px' width='400px'
options='{{item.options}}' cols='{{item.cols}}'
rows='{{item.rows}}' data='{{item.data}}'>
</google-chart>
</template>
</template>
</polymer-element>
How wicked is that!? No code :)
The hardest part would be to get the data in the format google-chart expects. See <google-chart>
element for examples.
score:1
I don't know much about Polymer, but from the docs it looks like changing <template>
to <template repeat="{{ yourarray }}">
might be the critical step in making this happen.
score:4
I know it's an old question but here's the updated Polymeric 1.0/2.0 way of doing it, using Highcharts-Chart:
<link rel="import" href="bower_components/highcharts-chart/highcharts-chart.html">
<template is="dom-bind" id="app">
<template is="dom-repeat" items="{{dynamicChartData}}" as="e">
<highcharts-chart index$="[[index]]" type="pie" data="[[zip(e.categories,e.series)]]" title="[[e.title]]" subtitle="[[e.subtitle]]" y-label="[[e.yAxistitle]]"></highcharts-chart>
</template>
<iron-ajax auto url="{{source}}" last-response="{{dynamicChartData}}" handle-as="json"></iron-ajax>
</template>
<script>
var app = document.querySelector("#app")
app.source = "Your URL-------------------"
app.zip = function(a,b) {
return a.map(function (_, i) {return [a[i], b[i]]})
}
</script>
And if you're looking for more examples you can check out http://avdaredevil.github.io/highcharts-chart/.
Source: stackoverflow.com
Related Query
- Polymer Template Repeat Over Multiple Charts
- Manage multiple highchart charts in a single webpage
- HighStock Charts not Working over SSL ie https
- Highcharts - multiple charts
- Multiple series in HighStock charts
- Highcharts: update series on multiple charts with same data
- High Charts - mouse over event on any part of graph
- How to generate multiple high charts in ng-repeat
- HighCharts is slow to load data when building multiple charts
- Multiple highcharts charts dynamically created in angular2 on one page
- Highchart multiple axes - sync axes on multiple charts
- Highcharts column + line combination chart with multiple series. Issue aligning line over the column
- Export multiple charts with one request
- High charts queue chart updates after ajax with multiple charts in firefox
- Highcharts - Multiple Y Axis Stacked Charts
- Synchronized charts or multiple charts like Highcharts in Android
- Highcharts shared tooltip between charts with multiple series and shared tooltip
- Selecting Points over multiple Highcharts treemaps
- Highcharts rangeSelector for multiple charts
- Use of DotNet HighCharts dll to make charts in code behind
- How to show multiple pie charts using highcharts
- How to export multiple charts in HighCharts to one file (png, jpeg, pdf)
- Highcharts synchronized charts with multiple axes datasets
- 3d High Charts Multiple Series inside of Drilldown
- How do I display multiple charts automatically with PHP and MYSQL?
- Highchart multiple bar charts in a single webpage
- Highcharts synchronize tooltip on multiple charts with multiple series
- Highcharts grouped bar charts with multiple axes
- How to make multiple charts using highcharts in a loop?
- Charts using Highcharts with multiple series from JSON
More Query from same tag
- How to create Duplicate DataLabels in highcharts
- highcharts group series click event to get all data in catagory
- dotnet highchart error, not showing data
- Only show integer steps on axis
- Highcharts : display a second series under the X-Axis
- rangeSelector: change date beyond zoomed time range
- Parsing CSV based on Popup Properties
- highcharts pass variable from plotline
- Rounded corners in highcharts
- Remove gap in Highcharts column chart from null value from JSON file in React
- Dynamically adding series, how to get rid of default y-axis?
- How to retrieve parent category when using grouped categories in Highcharts?
- Iterate over a text label in HTML using JQUERY
- Highchart stacked bar yAxis stacked label issue
- Getting all colors from a div with jQuery/JS
- Highcharts polar background color
- Remove space between yAxis and data in highcharts
- Highcharts with angular2 and SystemJS Setup
- Highcharts spline dataLabels overlapping
- Remove SVG rendered path on Legend Item Click
- JavaScript method begins w/ variables assigned?? very confused
- Draw small symmetrical arc line path between two markers on world map in Highmaps
- Scrollbar for y-axis is not showing in highcharts?
- Highcharts redraw previous line still exist
- iOS Highcharts Library - Hiding layout elements & Y Axis precision
- Highcharts :: Pie :: Add icon for specific series
- How to toggle tooltip programmatically in highcharts?
- highcharts animation multiple spline per second
- Why is Highcharts x axis not respecting my categories in stacked area chart
- HighCharts - data from different intervals in one xAxis (hide second xAxis)