forked from syhsyh9696/javlibrary-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5278364
commit 6a15a92
Showing
6 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<div class="panel panel-primary"> | ||
<div class="panel-heading text-center">Genres Statistics</div> | ||
<div class="panel-body"> | ||
<div id="chart-wrapper"> | ||
<canvas id="genres"></canvas> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
var genres; | ||
var values; | ||
var url = window.location.href; | ||
url = url + "/genres" | ||
|
||
$.ajax({ | ||
url: url, | ||
dataType: 'JSON', | ||
type: 'GET', | ||
async: false, | ||
success: function(result) { | ||
genres = result.genres; | ||
values = result.values; | ||
} | ||
}); | ||
|
||
var ctx = document.getElementById("genres").getContext('2d'); | ||
var myChart = new Chart(ctx, { | ||
type: 'pie', | ||
data: { | ||
labels : genres, | ||
datasets : [ | ||
{ | ||
fillColor : "rgba(220,220,220,0.5)", | ||
strokeColor : "rgba(220,220,220,1)", | ||
data : values | ||
} | ||
] | ||
} | ||
}); | ||
</script> |
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
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