2
꺾은 선형 차트를 그릴 경우 아무런 문제가 없지만 히스토그램 그래프에서이를 원합니다. (https://developers.google.com/chart/interactive/docs/gallery/histogram)Google 차트에서 세로선과 막대 그래프를 그리는 방법은 무엇입니까?
LineChart의 경우 :
var chart = new google.visualization.LineChart(document.querySelector('#chart_div'));
히스토그램의 경우;
var chart = new google.visualization.Histogram(document.querySelector('#chart_div'));
기타 코드;
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn('number', 'Value');
data.addRows([
['Foo', null, 4],
['Bar', null, 3],
['Baz', null, 7],
['Bat', null, 9],
['Cad', 'Vertical line here', 9],
['Qud', null, 2],
['Piz', null, 6]
]);
var chart = new google.visualization.Histogram(document.querySelector('#chart_div'));
chart.draw(data, {
height: 300,
width: 400,
annotation: {
// index here is the index of the DataTable column providing the annotation
1: {
style: 'line'
}
}
});
}
을 선을 그어야 할이 또한 선 그래프에 "주석"라인에 애니메이션을 사용할 수 있습니다 - 나는 구글 그래프를 얻을 수있는 방법을 찾을 수 없습니다 주석의 변화하는 위치를 애니메이션으로 만들지 만, 위의 코드에 그려진 선의 X 위치에 애니메이션을 적용하는 것은 매우 간단합니다. 올바른 방향으로 밀어 주셔서 감사합니다, dustqm! – roguenet