Skip to content

Commit

Permalink
bug fixed2
Browse files Browse the repository at this point in the history
  • Loading branch information
kanemura1206 committed Jan 9, 2013
1 parent a02dc11 commit f2a350a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
36 changes: 36 additions & 0 deletions local/aspen/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,42 @@

<script src="%PATH%static/js/vendor/modernizr-2.6.1-respond-1.1.0.min.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['annotatedtimeline']});
function drawVisualization() {
$.ajax({
type: "GET",
url: ROOTURL + "webservice/rest/server.php",
dataType: "text",
data: {
wstoken: "2d1a05efd36f0751a6a9fa7c6e3179e7",
wsfunction: "local_exfunctions_get_run_status",
moodlewsrestformat: "json",
id: ID,
userid: USERID
},
success: function(res) {
var obj = JSON.parse(res);
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'code');
data.addColumn('number', 'error');
data.addColumn('number', 'score');

for(var i in obj){obj[i][0] = new Date(obj[i][0]*1000);}
data.addRows(obj);

var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
document.getElementById('visualization'));
annotatedtimeline.draw(data, {'displayAnnotations': true, 'dateFormat': "yyyy.MM.dd 'at' HH:mm:ss", 'fill': 10, 'thickness': 2});
}
});

google.setOnLoadCallback(drawVisualization);
}

google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body>
<!--[if lt IE 7]>
Expand Down
38 changes: 2 additions & 36 deletions local/aspen/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,42 +150,8 @@ $(function() {
});

$("#button-graph").click(function() {
google.load('visualization', '1', {packages: ['annotatedtimeline']});
function drawVisualization() {
$.ajax({
type: "GET",
url: ROOTURL + "webservice/rest/server.php",
dataType: "text",
data: {
wstoken: "2d1a05efd36f0751a6a9fa7c6e3179e7",
wsfunction: "local_exfunctions_get_run_status",
moodlewsrestformat: "json",
id: ID,
userid: USERID
},
success: function(res) {
var obj = JSON.parse(res);
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'code');
data.addColumn('number', 'error');
data.addColumn('number', 'score');

for(var i in obj){obj[i][0] = new Date(obj[i][0]*1000);}
data.addRows(obj);

var annotatedtimeline = new google.visualization.AnnotatedTimeLine(
document.getElementById('visualization'));
annotatedtimeline.draw(data, {'displayAnnotations': true, 'dateFormat': "yyyy.MM.dd 'at' HH:mm:ss", 'fill': 10, 'thickness': 2});
$("#modal-graph").modal("show");
prettyPrint();
}
});

google.setOnLoadCallback(drawVisualization);
$("#modal-graph").modal("show");
prettyPrint();
}
$("#modal-graph").modal("show");
prettyPrint();
});

function parse_time(ts) {
Expand Down

0 comments on commit f2a350a

Please sign in to comment.