Allow use of a `dataSourceUrl` (via ChartWrapper)
As seen here: https://google-developers.appspot.com/chart/interactive/docs/reference#chartwrapperobject
Maybe its not expected to, but the assumption was, it mentions URL support for the Chart API and that was a URL for the chart API.
It would be nice if it could be supported though.
I don't understand what you are referring to. Would you please please explain a little more or give an example?
Straight from the above link referenced in the title
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Visualization API Sample</title>
<!--
One script tag loads all the required libraries! Do not specify any chart types in the
autoload statement.
-->
<script type="text/javascript"
src='https://www.google.com/jsapi?autoload={
"modules":[{
"name":"visualization",
"version":"1"
}]
}'></script>
<script type="text/javascript">
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
var wrap = new google.visualization.ChartWrapper({
'chartType':'LineChart',
'dataSourceUrl':'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1',
'containerId':'visualization',
'query':'SELECT A,D WHERE D > 100 ORDER BY D',
'options': {'title':'Population Density (people/km^2)', 'legend':'none'}
});
wrap.draw();
}
</script>
</head>
<body>
<div id="visualization" style="height: 400px; width: 400px;"></div>
</body>
</html>
'dataSourceUrl':'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1',
this URL type is the one I am referring to.
OK, thanks for the clarification. That's what I thought you meant, but I wasn't sure. Correct. The element does not currently support dataSourceUrls. I would like to switch to ChartWrapper (and already have a couple changes to make this happen) but there are some issues with the current version of the loader which create issues when switching. As soon as they are resolved, I'll drop in my changes to use the ChartWrapper and allow you to use this feature. Sorry for the current inconvenience.
I should mention that you are currently able to use a Sheets DataSource through a Query object.
See here for more information.
No problem, thanks for the info! -- Honestly I would much prefer to see full chart type suite supported over this feature... This was just a surprise when I was trying to setup a demo for some co-workers.
As for the QueryObject, I saw that, but was not sure how (or if it could be) to integrate it with the Web Component usage, granted for my purpose, I did not devote a lot of time to it due to the nature of my immediate need.
Yeah, for sure the DataSourceUrl should be supported. It's usage is extremely similar to the data URL in the component know but has huge fundamental differences. I'm definitely interested in twisting this element around to look almost exactly like the API for a ChartWrapper soon.
I've created a PR that adds a Query element. This way, you could do:
<google-chart-query url="..." data="{{data}}">
<google-chart data="[[data]]">