【发布时间】:2021-08-19 04:46:35
【问题描述】:
我正在尝试使用 Google Charts api 将星形图标添加到烛台图表,但我遇到了困难。如果有人可以帮助我:
我在这个谷歌页面上看到了它:https://developers.google.com/chart/interactive/docs/points https://i.stack.imgur.com/blkeK.png
尽管我添加了 css 并定义了列类型,但它不起作用。
以下是我的代码,但这是 jsfiddle 中的测试链接:https://jsfiddle.net/wd4egpo1/
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['x', 'n1', 'n2', 'n3', 'n4', {label:'point', role:'style', type:'string'}],
['Mon', 20, 28, 38, 45, undefined],
['Tue', 31, 38, 55, 66, undefined],
['Wed', 50, 55, 77, 80, undefined],
['Thu', 77, 77, 66, 50, 'point { size: 18; shape-type: star; fill-color: #a52714; }'],
['Fri', 68, 66, 22, 15, undefined]
// Treat first row as data as well.
], false);
var options = {
legend:'none'
};
var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
【问题讨论】:
标签: javascript svg canvas graphics google-visualization