javascript - How to "split" dates in order to put them in google charts -
(yes didn't find "question" problem)
hello, i've been looking hours , can't find answers anywhere. want make own up- , downtime graph google charts using timeline of google visualization , pingdom api.
the problem in javascript part, php part pingdom api. i'm using summary.outage api , see on webpage return json string. , that's have work with.
current javascript have is:
google.load("visualization", "1.1", {packages:["timeline"]}); google.setonloadcallback(drawchart); function drawchart() { var json = <?php echo $list; ?>, options, data; data = new google.visualization.datatable(); data.addcolumn("string","state"); data.addcolumn("date","start"); data.addcolumn("date","end"); (var = 0; < json.length; i++) { data.addrow([json[i].status, new date(json[i].timefrom * 1000), new date(json[i].timeto * 1000)]); }; options = { height: 500, timeline: { groupbyrowlabel: false } }; var chart = new google.visualization.timeline(document.getelementbyid('graph')); chart.draw(data, options); } and gives output: http://puu.sh/hjk2f.png
but yeah, want change like:
data.addcolumn("date","date"); data.addcolumn("date","start"); data.addcolumn("date","end"); you know going right ? want in stead of "up" , "down" actual date
i have change index 0 here
data.addrow([/*what put here*/, new date(json[i].timefrom * 1000), new date(json[i].timeto * 1000)]); but have no idea how. , if think common sense it's bar chart times - also, min limit should start of day (00:00) , max limit should end of day (23:59)
so gives decent overview of , down time past 5 days. make more clear check image - it's same instead of procent @ bottom want times + instead bar chart it's timeline chart
Comments
Post a Comment