チャートに渡されたデータの配列と、java スクリプトのドロップダウンに基づいたタイトルを変更する方法を考えていました。
ConsultingSales と Lifesciences を切り替えるドロップダウンと、タイトルの変更が必要です。これをいじっていて、それを理解できません。助けてください。
ありがとう
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var LifeSciencesSales = [ ['Month', 'Sales', 'Expenses'],
['Jan-12',1500,464.0070717],
['Feb-12',800,578.2656461],
['Mar-12',900,220.8059709],
['Apr-12',1000,534.1582816],
['May-12',505,768.0671543],
['Jun-12',958,181.6553778],
['Jul-12',2000,436.6480464],
['Aug-12',1300,108.9466581],
['Sept-12',1500,930.5872168],
['Oct-12',800,902.2438355],
['Dec-12',958,621.7321969]
]
var ConsultingSales = [ ['Month', 'Sales', 'Expenses'],
['Jan-12',455,44.0070717],
['Feb-12',800,578.2656461],
['Mar-12',545,220.8059709],
['Apr-12',1000,534.1582816],
['May-12',505,768.0671543],
['Jun-12',876,181.6553778],
['Jul-12',875,436.6480464],
['Aug-12',1300,108.9466581],
['Sept-12',1000,930.5872168],
['Oct-12',1345,902.2438355],
['Dec-12',895,621.7321969]
]
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
google.setOnLoadCallback(drawChart1);
function drawChart() {
var data = google.visualization.arrayToDataTable(LifeSciencesSales);
var options = {
title: "Sales"
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<div id="chart_div" style="width: 1200px; height: 400px;"></div>
<div id="chart_div1" style="width: 1200px; height: 400px;"></div>
</body>
</html>