Created
May 8, 2010 16:03
-
-
Save ryopeko/394622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google.load("visualization", "1", {packages:["linechart"]}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart1(){ | |
var data = new google.visualization.DataTable(); | |
data.addColumn('string', 'days'); | |
data.addColumn('number', 'キャベツ'); | |
data.addColumn('number', 'にんじん'); | |
dataHash = getData(); | |
data.addRows(dataHash.length); | |
$.each(dataHash, | |
function(i,v){ | |
data.setValue(i, 0, v.label); | |
data.setValue(i, 1, v.data1); | |
data.setValue(i, 2, v.data2); | |
}); | |
var chart = new google.visualization.LineChart(document.getElementById('chart_div')); | |
options = { | |
width: 600, | |
height: 350, | |
legend: 'bottom', | |
title: '野菜のお値段' | |
}; | |
chart.draw(data, options); | |
} | |
function getData(){ | |
return data = [ | |
{label:"2010/4/20", data1:350, data2:80}, | |
{label:"2010/4/21", data1:320, data2:78}, | |
{label:"2010/4/22", data1:300, data2:73}, | |
{label:"2010/4/23", data1:280, data2:75}, | |
{label:"2010/4/24", data1:290, data2:75}, | |
{label:"2010/4/25", data1:288, data2:76}, | |
{label:"2010/4/26", data1:270, data2:75} | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment