-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create statistics chart with chartjs
- Loading branch information
Muhammad Ruhul Amin
committed
May 24, 2018
1 parent
bd30270
commit 3550f6d
Showing
7 changed files
with
158 additions
and
54 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,93 @@ | ||
var chart = document.getElementById("chart").getContext("2d"), | ||
gradient = chart.createLinearGradient(0, 0, 0, 350); | ||
|
||
gradient.addColorStop(0, "rgba(0, 72, 253, 0.54)"); | ||
gradient.addColorStop(0.5, "rgba(0, 72, 253, 0.24)"); | ||
gradient.addColorStop(1, "rgba(255, 255, 255, 0.5)"); | ||
|
||
Chart.defaults.global.defaultFontFamily = "Open Sans"; | ||
|
||
var data = { | ||
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"], | ||
datasets: [ | ||
{ | ||
label: "Income/Expence", | ||
backgroundColor: gradient, | ||
pointBackgroundColor: "white", | ||
borderWidth: 3, | ||
borderColor: "#205df9", | ||
data: [5, 32, 13, 29, 36, 11, 36] | ||
} | ||
] | ||
}; | ||
|
||
var options = { | ||
responsive: true, | ||
maintainAspectRatio: false, | ||
animation: { | ||
easing: "easeInOutQuad", | ||
duration: 520 | ||
}, | ||
scales: { | ||
xAxes: [ | ||
{ | ||
gridLines: { | ||
display: false, | ||
drawBorder: false | ||
}, | ||
ticks: { | ||
display: true, | ||
fontStyle: "bold", | ||
fontSize: 12 | ||
} | ||
} | ||
], | ||
yAxes: [ | ||
{ | ||
position: "right", | ||
gridLines: { | ||
color: "rgba(0, 0, 0, 0.05)", | ||
lineWidth: 2, | ||
zeroLineColor: "transparent" | ||
}, | ||
ticks: { | ||
display: true, | ||
fontStyle: "bold", | ||
fontSize: 12, | ||
beginAtZero: true, | ||
callback: function(value) { | ||
return "$" + value + "k"; | ||
}, | ||
autoSkip: true, | ||
maxTicksLimit: 5 | ||
} | ||
} | ||
] | ||
}, | ||
elements: { | ||
line: { | ||
tension: 0.4 | ||
} | ||
}, | ||
legend: { | ||
display: false | ||
}, | ||
point: { | ||
backgroundColor: "blue" | ||
}, | ||
tooltips: { | ||
titleFontFamily: "Open Sans", | ||
backgroundColor: "rgba(0,0,0,0.4)", | ||
titleFontColor: "white", | ||
caretSize: 0, | ||
cornerRadius: 14, | ||
xPadding: 10, | ||
yPadding: 10 | ||
} | ||
}; | ||
|
||
var chartInstance = new Chart(chart, { | ||
type: "line", | ||
data: data, | ||
options: options | ||
}); |
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 |
---|---|---|
|
@@ -575,7 +575,7 @@ [email protected], combined-stream@^1.0.5, combined-stream@~1.0.5: | |
dependencies: | ||
delayed-stream "~1.0.0" | ||
|
||
commander@^2.2.0, commander@^2.9.0: | ||
commander@^2.2.0, commander@^2.9.0, commander@~2.15.0: | ||
version "2.15.1" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" | ||
|
||
|
@@ -1396,6 +1396,18 @@ gulp-sass@^4.0.1: | |
through2 "^2.0.0" | ||
vinyl-sourcemaps-apply "^0.2.0" | ||
|
||
gulp-uglify@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.0.tgz#0df0331d72a0d302e3e37e109485dddf33c6d1ca" | ||
dependencies: | ||
gulplog "^1.0.0" | ||
has-gulplog "^0.1.0" | ||
lodash "^4.13.1" | ||
make-error-cause "^1.1.1" | ||
through2 "^2.0.0" | ||
uglify-js "^3.0.5" | ||
vinyl-sourcemaps-apply "^0.2.0" | ||
|
||
gulp-util@^3.0.0: | ||
version "3.0.8" | ||
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" | ||
|
@@ -2114,7 +2126,7 @@ lodash@^3.10.1: | |
version "3.10.1" | ||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" | ||
|
||
lodash@^4.0.0, lodash@~4.17.4: | ||
lodash@^4.0.0, lodash@^4.13.1, lodash@~4.17.4: | ||
version "4.17.10" | ||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" | ||
|
||
|
@@ -2140,6 +2152,16 @@ lru-cache@^4.0.1: | |
pseudomap "^1.0.2" | ||
yallist "^2.1.2" | ||
|
||
make-error-cause@^1.1.1: | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" | ||
dependencies: | ||
make-error "^1.2.0" | ||
|
||
make-error@^1.2.0: | ||
version "1.3.4" | ||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535" | ||
|
||
make-iterator@^1.0.0: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" | ||
|
@@ -3245,7 +3267,7 @@ source-map@^0.4.2: | |
dependencies: | ||
amdefine ">=0.0.4" | ||
|
||
source-map@^0.6.1: | ||
source-map@^0.6.1, source-map@~0.6.1: | ||
version "0.6.1" | ||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" | ||
|
||
|
@@ -3537,6 +3559,13 @@ [email protected]: | |
version "0.7.17" | ||
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac" | ||
|
||
uglify-js@^3.0.5: | ||
version "3.3.27" | ||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.27.tgz#eb8c3c9429969f86ff5b0a2422ffc78c3cea8cc0" | ||
dependencies: | ||
commander "~2.15.0" | ||
source-map "~0.6.1" | ||
|
||
ultron@~1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" | ||
|