1
我在我的網頁上繪製了一個Google圖表,繪製了用戶輸入的值(result1和result2)。我不能刪除值[0,0]
。如果我這樣做,圖表不會渲染,但是如果我將它們留下,則在x和y軸的0點上會有一個繪圖點。
我需要的只是圖表繪製[result1, result2]
Google圖表繪製不需要的值
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
"use strict";
var result1 = document.getElementById('finalScore').value;
var result2 = document.getElementById('finalScoreD').value;
var data = google.visualization.arrayToDataTable([
['Quality', 'Delivery'],
[ 0, 0],
[ 'result1', 'result2']
]);
var options = {
title: '',
hAxis: {title: 'Quality', minValue: 0, maxValue: 1, gridlines: { count: 3, color: '#000000' }, titleTextStyle: {italic: false}},
vAxis: {title: 'Delivery', minValue: 0, maxValue: 1, gridlines: { count: 3, color: '#000000'}, titleTextStyle: {italic: false}},
width: 370,
height: 300,
colors: ['#6db33f'],
pointSize: 30,
pointShape: 'circle',
fontName: 'proximaNovaLight',
fontSize: '15',
backgroundColor: { fill:'transparent' },
legend: 'none',
};
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
}
工程就像一個魅力,謝謝! – invincibleme