Google图表+ Google表格:指定范围无法正确识别数据 [英] Google Charts + Google Sheets: Specified range does not identify data correctly

查看:177
本文介绍了Google图表+ Google表格:指定范围无法正确识别数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定使用Google Charts从Google Analytics帐户中提取自动更新的Google表格中的数据(分析API未运行)。



<我已经做了大量的阅读,但我发现查询语言参考是一个痛苦。



我选择使用ChartWrapper。

https://jsfiddle.net/7xzv59kj/2/

  //访问
var wrap = new google.visualization.ChartWrapper();
wrap.setChartType('ColumnChart');
wrap.setDataSourceUrl('https://docs.google.com/spreadsheets/d/1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE/gviz/tq?sheet=Sheet2&range=Keywords-All_Time!B11:C12&headers=1&tq=' );
wrap.setContainerId('visits-all-time');
wrap.draw();

$ / code>

我希望图表显示H-轴,然后是V轴上的值。相反,数据变得混乱和混乱。我不知道要指定什么参数以及如何正确标记它们。



电子表格位于此处。



https://docs.google.com / spreadsheets / d / 1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE



我想从标题为 Keywords-All_Time from range B11:C12

解决方案

我的脑袋 - 我休息一下,然后回到昨天发现了一些问题:

  wrap.setDataSourceUrl('https ?://docs.google.com/spreadsheets/d/1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE/gviz/tq片= Sheet2的&安培;范围=关键词ALL_TIME B11:C12&安培;头= 1&安培; TQ ='); 




  1. 我的网址指定了两次表单。我记得有人告诉我用表单格式化范围,但是我想我从来没有擦掉其他参数。

  2. 我的表格的坐标轴是错误的。我倒过来看,发现一切正常。


我放弃了图表包装并决定继续当我真的需要它时。以下是我现在正在使用的代码的当前jsfiddle: https://jsfiddle.net/c11c9a0w/19/



这对于任何人无法从Google Sheet中构建动态信息中心非常有帮助,Google桌面可在单个页面上显示多个图表,因此您可以随意使用关闭这个。



-Joel


I settled on using Google Charts to draw the data from an auto-updating Google Sheet that draws from my Analytics account (the analytic API wasn't working out).

I've done quite a lot of reading, but I'm finding the query language reference to be a pain.

I've chosen to use the ChartWrapper.

https://jsfiddle.net/7xzv59kj/2/

     // Visits
      var wrap = new google.visualization.ChartWrapper();
      wrap.setChartType('ColumnChart');
           wrap.setDataSourceUrl('https://docs.google.com/spreadsheets/d/1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE/gviz/tq?sheet=Sheet2&range=Keywords-All_Time!B11:C12&headers=1&tq=');
      wrap.setContainerId('visits-all-time');
      wrap.draw();
  }

I want the chart to display the labels for Users and Sessions on the H-Axis, and then the values on the V-Axis. Instead, the data gets all jumbled and confused. I don't know what parameters to specify and how to label them properly.

Spreadsheet located here.

https://docs.google.com/spreadsheets/d/1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE

I would like to draw the data from the sheet titled Keywords-All_Time from range B11:C12

解决方案

The issue here was just my foggy brain - I took a break and came back to it yesterday to discover a couple issues:

  wrap.setDataSourceUrl('https://docs.google.com/spreadsheets/d/1jICOBDvZzRxEThcWqnpFmNLUqjVP81Zd9RTwpbG29cE/gviz/tq?sheet=Sheet2&range=Keywords-All_Time!B11:C12&headers=1&tq=');

  1. My URL specifies the sheet twice. I recall someone telling me to format the range with the sheet, but I suppose I never erased the other parameter.

  2. My table had the axes the wrong way around. I reversed them and found everything worked well from there.

I abandoned the chart wrapper and decided to move on to that when I actually have a need for it. Here's the current jsfiddle with the code I'm working on now: https://jsfiddle.net/c11c9a0w/19/

This will be extremely helpful for anyone having trouble building a dynamic dashboard from a Google Sheet that has multiple graphs on a single page, so feel free to work off of this.

-Joel

这篇关于Google图表+ Google表格:指定范围无法正确识别数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆