我正在尝试使null值不可见,我正在尝试此方法,但对我不起作用,我不知道为什么错误是:
All series on a given axis must be of the same data type
[如果有人知道问题出在哪里,请帮助我,谢谢:)这是我的代码:
google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var options = {
title: 'Reparation par RSP',
width: '100%',
height: 500,
bar: { groupWidth: "75%" },
seriesType: 'bars',
series: { 5: { type: 'line' } },
colors: ['#dacfcf','#fee812','#ff7900','#ff0000','#ff0000'],
legend: 'right',
curveType: 'function',
isStacked: true,
hAxis: { format: '###' },
titleTextStyle: {
fontSize: 32,
},
};
$.ajax({
type: "POST",
url: "ReparationParRSP.aspx/GetChartData",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var data = google.visualization.arrayToDataTable(r.d);
var view = new google.visualization.DataView(data);
view.setColumns([0,
1, {calc: function (dataTable, rowIndex) {return getAnnotation(dataTable, rowIndex, 1);}, type: "string", role: "annotation" ,sourceColumn: 1},
2, {calc: function (dataTable, rowIndex) {return getAnnotation(dataTable, rowIndex, 2);}, type: "string", role: "annotation" ,sourceColumn: 2},
3, {calc: function (dataTable, rowIndex) {return getAnnotation(dataTable, rowIndex, 3);}, type: "string", role: "annotation" ,sourceColumn: 3},
4, {calc: function (dataTable, rowIndex) {return getAnnotation(dataTable, rowIndex, 4);}, type: "string", role: "annotation" ,sourceColumn: 4},
5, {calc: function (dataTable, rowIndex) {return getAnnotation(dataTable, rowIndex, 5);}, type: "string", role: "annotation" ,sourceColumn: 5}
]);
function getAnnotation(dataTable, rowIndex, columnIndex) {
return dataTable.getFormattedValue(rowIndex, columnIndex) || null;
}
var chart = new google.visualization.BarChart($("#chart_div")[0]);
chart.draw(view, options);
// updateChart();
},
});
将此添加到您的Site.css(或您使用的任何自定义样式表。):
#Panel1 {
position: fixed;
top: 0;
}
尝试一下
#Panel1 {
position: fixed;
top: 0;
/* and any other style, such as `right`, `left`, `width` and etc. */
}