Goole Visualization DateRangeFilter数据问题。 2月至3月的数据冲突 [英] Goole Visualization DateRangeFilter Data issue. Data Conflict between Feb and March

查看:80
本文介绍了Goole Visualization DateRangeFilter数据问题。 2月至3月的数据冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我选择1月2日至2月28日之间的日期时,Google可视化显示的是3月份的数据,而不是2月份。 Screenshot



下面的代码包含数据和控制以及图表包装。

  google.load('visualization','1',{packages:['corechart','controls','table '],callback:drawChart}); 

Js Fiddle Link



请帮我找到解决方案。



提前致谢。

解决方案

尝试使用更新的库, loader.js vs jsapi



似乎在这里可以正常工作...



  google.charts.load('current',{callback:function(){var data = new google.visualization.DataTable(); data.addColumn('date', 'OrderDate'); data.addColumn('number','Order_Qty'); data.addRows([[new Date(2014,0,1),100],[new Date(2014,0,3),120] ,[新日期(2014,0,30),110],[新日期(2014,1,1),170],[新日期(2014,1,10),180],[新日期(2014,1 ,[新日期(2014,2,1),170],[新日期(2014,2,14),170],[新日期(2014,2,20),170],[新日期(2014,3,12),170],[新日期(2014,3,16),170],[新日期(2014,3,13),170]]); var table_Chart =新谷歌.visualization.ChartWrapper({'chartType':'Table','containerId':'table_div','options':{},'view':{'columns':[0,1]}}); var slider_Date = new google.visualization.ControlWrapper({'controlType':'DateRangeFilter','containerId':'filter_date_div_Date','options':{'filterColumnIndex':'0'}});新的google.visualization.Dashboard(document.getElementById('dashboard_div')).bind([slider_Date],[table_Chart]).draw(data); },packages:['controls','table']}); <$ code> 

 < script src =https://www.gstatic.com/charts/loader.js>< / script>< div id =dashboard_div> < div id =filter_date_div_Date>< / div> < div id =table_div>< / div>< / div>  

When I'm selecting the dates between 1st feb to 28th feb, the Google visualization displaying the data of March instead of February.

Screenshot

The Below code has data and control and chart wrappers.

    google.load('visualization', '1', {packages:['corechart','controls','table'], callback:drawChart});

Js Fiddle Link

Please help me in finding a solution for this.

Thanks in advance.

解决方案

try using the newer library, loader.js vs jsapi

seems to work fine here...

google.charts.load('current', {
  callback: function () {
    var data = new google.visualization.DataTable();
    data.addColumn('date','OrderDate');
    data.addColumn('number','Order_Qty');
    data.addRows([
      [new Date(2014,0,1),100],
      [new Date(2014,0,3),120],
      [new Date(2014,0,30),110],
      [new Date(2014,1,1),170],
      [new Date(2014,1,10),180],
      [new Date(2014,1,25),110],
      [new Date(2014,2,1),170],
      [new Date(2014,2,14),170],
      [new Date(2014,2,20),170],
      [new Date(2014,3,12),170],
      [new Date(2014,3,16),170],
      [new Date(2014,3,13),170]
    ]);


    var table_Chart = new google.visualization.ChartWrapper({
      'chartType': 'Table',
      'containerId': 'table_div',
      'options': {},
      'view': {'columns':[0, 1]}
    });

    var slider_Date = new google.visualization.ControlWrapper({
        'controlType': 'DateRangeFilter',
        'containerId': 'filter_date_div_Date',
        'options': {
          'filterColumnIndex':'0'
        }
    });

    new  google.visualization.Dashboard(document.getElementById('dashboard_div'))
    .bind([slider_Date],[table_Chart])
    .draw(data);
  },
  packages: ['controls', 'table']
});

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="dashboard_div">
  <div id="filter_date_div_Date"></div>
  <div id="table_div"></div>
</div>

这篇关于Goole Visualization DateRangeFilter数据问题。 2月至3月的数据冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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