我是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);
}
产生
鉴于:
<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);
}
产生
我错过了什么?
提前致谢!