在以下物料折线图的代码中,pointSize
属性未按预期工作。虽然在文档中写了pointSize
的默认值为0
并将其设置为大于0
的值会使其可见,但它在我的情况下不起作用。< / p>
简而言之,我想让我的图表上的点可见,但它不起作用。
google.charts.load('current', {'packages':['line']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Day');
data.addColumn('number', 'Guardians of the Galaxy');
data.addColumn('number', 'The Avengers');
data.addColumn('number', 'Transformers: Age of Extinction');
data.addRows([
[1, 0, 0, 41.8],
[2, 30.9, 69.5, 32.4],
[3, 25.4, 57, 25.7],
[4, 11.7, 18.8, 10.5],
[5, 11.9, 17.6, 10.4],
[6, 8.8, 13.6, 7.7],
[7, 7.6, 12.3, 9.6],
[8, 12.3, 29.2, 10.6],
[9, 16.9, 0, 14.8],
[10, 12.8, 30.9, 11.6],
[11, 5.3, 7.9, 4.7],
[12, 6.6, 8.4, 5.2],
[13, 4.8, 6.3, 3.6],
[14, 4.2, 6.2, 3.4],
[15, 4.5, 5.9, 41.8],
[16, 30.9, 69.5, 32.4],
[17, 25.4, 57, 25.7],
[18, 11.7, 18.8, 10.5],
[19, 11.9, 17.6, 10.4],
[20, 8.8, 13.6, 7.7],
[21, 7.6, 12.3, 9.6],
[22, 12.3, 29.2,10.6],
[23, 16.9, 0, 14.8],
[24, 12.8, 30.9, 11.6],
[25, 5.3, 7.9, 4.7],
[26, 6.6, 8.4, 5.2],
[27, 4.8, 6.3, 3.6],
[28, 30.2, 45.2, 25.4],
[29, 40.2, 25.2, 36.4],
[30, 25.2, 35.2, 30.4]
]);
var options = {
chart: {
title: 'Box Office Earnings in First Two Weeks of Opening',
subtitle: 'in millions of dollars (USD)',
},
pointSize: 20,
pointShape: 'square',
width: 600,
height: 400
};
var chart = new google.charts.Line(document.getElementById('linechart_material'));
chart.draw(data, options);
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="linechart_material"></div>