Google Chart 기능 코드를 사용해 보았습니다. 현재 카테고리 필터를 사용하여 선 차트를 작성하려고합니다. 내 코드는 다음과 같습니다.Google 차트 - 카테고리 코드 필터
function drawVisualization() {
// Prepare the data.
var data = google.visualization.arrayToDataTable([
['x', 'Cats', 'Blanket 1', 'Blanket 2'],
['A', 1, 1, 0.5],
['B', 2, 0.5, 1],
['C', 4, 1, 0.5],
['D', 8, 0.5, 1],
['E', 7, 1, 0.5],
['F', 7, 0.5, 1],
['G', 8, 1, 0.5],
['H', 4, 0.5, 1],
['I', 2, 1, 0.5],
['J', 3.5, 0.5, 1],
['K', 3, 1, 0.5],
['L', 3.5, 0.5, 1],
['M', 1, 1, 0.5],
['N', 1, 0.5, 1]
]);
// Define a category picker for the 'category' column.
var categoryPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': 'item',
'ui': {
'allowTyping': false,
'allowMultiple': true,
'selectedValuesLayout': 'belowStacked'
}
},
// Define an initial state, i.e. a set of metrics to be initially selected.
'state': {'selectedValues': ['Cats', 'Blanket 1', 'Blanket 2']}
});
// Define a line chart.
var LineChart = new google.visualization.ChartWrapper({
'chartType': "Line",
'containerId': 'chart1',
'options': {
'width': 500,
'height': 400,
'vAxis': {maxValue: 10}
}
});
// Create the dashboard.
var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard')).
// Configure the category picker to affect the line chart
bind(categoryPicker, LineChart).
// Draw the dashboard
draw(data);
}
그래프가 Google 놀이터에 표시되지 않는 이유는 누구에게 말해 줄 수 있습니까? 나는 그것이 단순한 실수 일 것임에 틀림 없다. 그러나 나는 공백을 그리고있다.
도움 주셔서 감사합니다.
환상적입니다. 나는 이것을 위해 jsfiddle을 보았고 그것의 개념을 이해하려고 시도했지만 결코 할 수 없었다. 너무 간단하면서도 효과적입니다! 솔직히, 나는 당신이 얼마나 행복하게 참여하고 있는지 표현할 수 없습니다! – jmac
@jmac, 봉사하게되어 기쁩니다.>; o) – asgallant