【问题标题】:Update Embeded Google Trends更新嵌入式 Google 趋势
【发布时间】:2021-06-03 16:18:32
【问题描述】:

我有这个加载谷歌趋势图的功能。它有效,但如果我用新数据再次调用它,图表就会重复!我该如何解决这个问题?

loadGraph(div: HTMLElement, type: string) {
  trends.embed.renderExploreWidgetTo(div, type,
    {
        comparisonItem: this.keyWords,
        category: 0,
        property: ""
    },
    {
        exploreQuery: "geo=MX&q=chamarras%20de%20piel&date=today 12-m",
        guestPath:"https://trends.google.es:443/trends/embed/"
    });}

数据:

keyWords: any[] = [
{
    keyword: "some word",
    geo: "US",
    time:"today 12-m"
}]

【问题讨论】:

    标签: javascript html typescript api


    【解决方案1】:

    我找到了答案。 renderExploreWidgetTo 将 Child 附加到 HTMl 元素,因此 div.innerHTML = '';解决了。​​

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-17
      • 1970-01-01
      • 2013-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多