var items=[];
var x=10;
var lg=null;
var params;
var len=10;
var name;



window.onload = function() {
    init();
}

function init(){
    lg = new html5jp.graph.line("sample");

    if( ! lg ) { return; }
    

    for(var i=0;i<3;i++){
	name="商品"+i;
	
	items[i]=[name,
		  Math.floor(Math.random()*100),
		  Math.floor(Math.random()*100),
		  Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      Math.floor(Math.random()*100),
		      ];
	}
	params = {
	    x: ["", "日", "月", "火", "水", "木", "金", "土"],
	    y: ["注文数(個)", 0, 20, 40, 60, 80, 100],
	    yMax: 100,
	    yMin: 0,
	    lineWidth: [1,2],
	    dotRadius: [3,4],
	    dotType: ["disc", "square"],
	    dLabel: false,
	};
	goL();
};


function goL(){
    x--;
    draw();
}
function goR(){
    x++;
    draw();
}

function draw() {
	var cur_item=[];
	for(var i=0;i<3;i++){
	    cur_item[i]=[items[i][0]];
	    for(var j=0;j<len;j++){
		cur_item[i][1+j]=items[i][x+j];
	    }
	}
	
	lg.draw(cur_item,params);
}

function fe(){
    var arr;  
//     arr = new Array(10);
//     arr = new Array("abc", "def", "ghi");
    arr = ["abc", "def", "ghi"];
}
