Google Charts - interpolateNulls选项不适用于AnnotationChart

时间:2014-02-28 05:51:42

标签: google-visualization

我是Google Visualizations的初学者。我在使用AnnotationChart正确地使用“interpolateNulls:true”选项时遇到了麻烦。如果我使用与基本LineChart相同的数据集,它将按预期工作。这是我的代码和结果图表:

    <script type='text/javascript'>
  google.load('visualization', '1.1', {'packages':['Annotationchart']});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data1 = new google.visualization.DataTable(<?=$json1?>);
    var data2 = new google.visualization.DataTable(<?=$json2?>);

    var joinedData = google.visualization.data.join(data1, data2, 'full', [[0, 0]], [1], [1]);

    var chart1 = new google.visualization.AnnotationChart(document.getElementById('chart1'));

    var options = {
      displayAnnotations: false,
  thickness: 2,
  colors: ['red', 'blue'],
  interpolateNulls: true,
      curveType: 'function',
    };

    chart1.draw(joinedData, options);
  }

产生

http://imgur.com/r5sqtvd

鉴于:

    <script type='text/javascript'>
  google.load('visualization', '1', {'packages':['corechart']});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data1 = new google.visualization.DataTable(<?=$json1?>);
    var data2 = new google.visualization.DataTable(<?=$json2?>);

    var joinedData = google.visualization.data.join(data1, data2, 'full', [[0, 0]], [1], [1]);

    var chart1 = new google.visualization.LineChart(document.getElementById('chart1'));

    var options = {
      displayAnnotations: false,
  thickness: 2,
  colors: ['red', 'blue'],
  interpolateNulls: true,
      curveType: 'function',
    };

    chart1.draw(joinedData, options);
  }

产生

http://imgur.com/qk79hob

我错过了什么?

提前致谢!

1 个答案:

答案 0 :(得分:2)

AnnotationChart没有选项interpolateNulls。请参阅google docs Annotation Chart