Charts 获取谷歌趋势图

Charts 获取谷歌趋势图,charts,google-trends,responsiveness,Charts,Google Trends,Responsiveness,我想知道是否有可能通过当前给定的代码(添加一个“未知”参数)获得谷歌趋势的图表 例子 当将“100%”作为宽度值时,它无论如何都不起作用。 但是,如果有人知道有一个额外的参数来更改您要使用的单位(默认为px),请尝试在页面加载时使用javascript获取屏幕宽度,然后动态创建嵌入代码,用实际屏幕宽度替换定义的宽度参数 <script> //function which gets screen width function getWidth() { if (self.inn

我想知道是否有可能通过当前给定的代码(添加一个“未知”参数)获得谷歌趋势的图表

例子

当将“100%”作为宽度值时,它无论如何都不起作用。
但是,如果有人知道有一个额外的参数来更改您要使用的单位(默认为px),请尝试在页面加载时使用javascript获取屏幕宽度,然后动态创建嵌入代码,用实际屏幕宽度替换定义的宽度参数

<script>

//function which gets screen width
function getWidth() {
  if (self.innerHeight) {
    return self.innerWidth;
  }

  if (document.documentElement && document.documentElement.clientHeight) {
    return document.documentElement.clientWidth;
  }

  if (document.body) {
    return document.body.clientWidth;
  }
}

    //define screen width variable. Subtract 15 pixels from width just to be on the safe side and reduce chance of getting a horizontal scroll bar
    var screenWidth = getWidth()-Number(15);

    //replace the following URL with your own. Be sure to keep the modified part of the string in tact where it replaces the width with screenWidth variable
    var embedCode = "//www.google.com.au/trends/embed.js?hl=en-US&q=mick+fanning,+wwe&geo=ZA&date=now+7-d&cmpt=q&tz=Etc/GMT-10&tz=Etc/GMT-10&content=1&cid=TIMESERIES_GRAPH_0&export=5&w="+screenWidth+"&h=330";


//write this new code to browser. Split '<script'> tags to prevent browser errors when writing.
document.write('<scr'+'ipt type=\"text/javascript\" src=\"'+embedCode+'\"></scr'+'ipt>');

</script>

//获取屏幕宽度的函数
函数getWidth(){
if(自内高度){
返回self.innerWidth;
}
if(document.documentElement&&document.documentElement.clientHeight){
返回document.documentElement.clientWidth;
}
if(document.body){
返回document.body.clientWidth;
}
}
//定义屏幕宽度变量。为了安全起见,从宽度中减去15个像素,以减少获得水平滚动条的机会
var screenWidth=getWidth()-数字(15);
//用您自己的URL替换以下URL。确保字符串的修改部分保持不变,用screenWidth变量替换宽度
var embedCode=“//www.google.com.au/trends/embed.js?hl=en-US&q=mick+fanning,+wwe&geo=ZA&date=now+7-d&cmpt=q&tz=Etc/GMT-10&tz=Etc/GMT-10&content=1&cid=TIMESERIES\u-GRAPH\u 0&export=5&w=“+screenWidth+”&h=330”;

//将此新代码写入浏览器。拆分“如果单击趋势图右上角的菜单,则可以选择将该图嵌入桌面或移动视图中。选择Mobile,它将为您提供响应并提供代码片段

<script>

//function which gets screen width
function getWidth() {
  if (self.innerHeight) {
    return self.innerWidth;
  }

  if (document.documentElement && document.documentElement.clientHeight) {
    return document.documentElement.clientWidth;
  }

  if (document.body) {
    return document.body.clientWidth;
  }
}

    //define screen width variable. Subtract 15 pixels from width just to be on the safe side and reduce chance of getting a horizontal scroll bar
    var screenWidth = getWidth()-Number(15);

    //replace the following URL with your own. Be sure to keep the modified part of the string in tact where it replaces the width with screenWidth variable
    var embedCode = "//www.google.com.au/trends/embed.js?hl=en-US&q=mick+fanning,+wwe&geo=ZA&date=now+7-d&cmpt=q&tz=Etc/GMT-10&tz=Etc/GMT-10&content=1&cid=TIMESERIES_GRAPH_0&export=5&w="+screenWidth+"&h=330";


//write this new code to browser. Split '<script'> tags to prevent browser errors when writing.
document.write('<scr'+'ipt type=\"text/javascript\" src=\"'+embedCode+'\"></scr'+'ipt>');

</script>