Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of a dataSourceUrl (via ChartWrapper) #121

Open
ktiedt opened this issue Jun 29, 2016 · 7 comments
Open

Allow use of a dataSourceUrl (via ChartWrapper) #121

ktiedt opened this issue Jun 29, 2016 · 7 comments

Comments

@ktiedt
Copy link

ktiedt commented Jun 29, 2016

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.

@wesalvaro
Copy link
Member

I don't understand what you are referring to. Would you please please explain a little more or give an example?

@ktiedt
Copy link
Author

ktiedt commented Jul 10, 2016

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.

@wesalvaro
Copy link
Member

wesalvaro commented Jul 11, 2016

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.

@wesalvaro wesalvaro changed the title data URL option does not work in lieu of dataSourceUrl from ChartsAPI Allow use of a dataSourceUrl (via ChartWrapper) Jul 11, 2016
@wesalvaro
Copy link
Member

I should mention that you are currently able to use a Sheets DataSource through a Query object.

See here for more information.

@ktiedt
Copy link
Author

ktiedt commented Jul 11, 2016

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.

@wesalvaro
Copy link
Member

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.

@wesalvaro
Copy link
Member

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]]">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants