如何翻译谷歌分析仪表板



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

在此示例演示中,我得到"访问者,访问,浏览量"。我希望这些翻译。

我的代码:

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

是否有任何可以添加到查询中的"区域设置"属性?

答案是自定义成功函数:

        '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();
        }

最新更新