【问题标题】:How to translate Google Analytics dashboard?如何翻译谷歌分析仪表板?
【发布时间】:2012-11-23 11:17:10
【问题描述】:

我正在使用gadash library,但我不知道如何翻译图表图例标签。

this example demo 中,我得到“访问者、访问量、浏览量”。我想要那些被翻译的。

我的代码:

  <script>
    var dataOverTime = new gadash.Chart({
        'last-n-days': 30,
        'chartOptions': {
            width: 700
        },
        'divContainer': 'dataOverTimeConfig',
        'type': 'LineChart',
        'query': {
          'dimensions': 'ga:date',
          'sort': 'ga:date',
          'metrics': 'ga:visitors, ga:visits, ga:pageviews',
          'ids' : TABLE_ID    
        },
        'chartOptions': {
            height: 300,
            legend: {position: 'bottom'},
            hAxis: {title:'Data'},
            curveType: 'function'
        }
    }).render();
  </script>

我可以在查询中添加任何“语言环境”属性吗?

【问题讨论】:

    标签: javascript google-analytics google-analytics-api dashboard google-visualization


    【解决方案1】:

    答案是自定义 onSuccess 函数:

            'onSuccess': function(resp) {              
                var dataTable = gadash.util.getDataTable(resp);
                // customized part
                dataTable.z[1].label = "First custom label";
                dataTable.z[2].label = "Second custom label";
                dataTable.z[3].label = "Third custom label";
                // end of customized part
                var chart = gadash.util.getChart(this.config.divContainer, this.config.type);
                gadash.util.draw(chart, dataTable, this.config.chartOptions);
                gadash.onSuccess();
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-26
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多