google.charts.load('current', {
packages: ['corechart']
}).then(function() {
var data = google.visualization.arrayToDataTable([
['x', 'y0', 'y1'],
[new Date(2017, 11, 28), 175, 10],
[new Date(2017, 11, 29), 159, 20],
[new Date(2017, 11, 30), 126, 35],
[new Date(2017, 11, 31), 129, 40],
[new Date(2018, 0, 1), 108, 60],
[new Date(2018, 0, 2), 92, 70]
]);
var options = {
chartArea: {
bottom: 72
},
hAxis: {
slantedText: true
},
height: 400,
legend: {
maxLines: 2,
position: 'top'
},
tooltip: {
isHtml: true
},
trendlines: {
0: {
labelInLegend: '0-Linear Trend',
showR2: true,
type: 'linear',
visibleInLegend: true
},
1: {
labelInLegend: '1-Linear Trend',
showR2: true,
type: 'linear',
visibleInLegend: true
}
},
width: 400
};
var container = document.getElementById('chart_div');
var chart = new google.visualization.ColumnChart(container);
google.visualization.events.addListener(chart, 'onmouseover', function (props) {
var tooltipLabels = container.getElementsByTagName('span');
for (var i = 0; i < tooltipLabels.length; i++) {
if (tooltipLabels[i].innerHTML.indexOf('y =') > -1) {
tooltipLabels[i].innerHTML = 'CUSTOM TEXT:';
}
}
});
chart.draw(data, options);
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
이 참으로 많은 도움이됩니다. 나는 다음과 같은 질문을 가지고있다. 파이 차트의 중심에 요약 데이터를 배치하는 pieData의 오버레이 원을 만들었다. 그러나 브라우저의 크기를 조정할 때 오버레이 서클이 센터에 머물지 않습니다. 제안 사항은 무엇입니까 ?? – alex
아, 그리고 파이 그래프로 최대 라인이 작동하지 않는다. 화살표가 생겼다. – alex
아, 쏘지 마라. 나는 대문자 L을 잊어 버렸다. 이제 막 새 라인을 시작할 수있는 능력이 좋아. ?? 너비 또는 너트를 설정할 수 있습니까? 전설 텍스트 중 두 가지는 ..... – alex