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