AdminLTE/dist/js/pages/dashboard3.js

148 lines
3.4 KiB
JavaScript
Raw Normal View History

2020-05-30 13:44:20 +00:00
/* global Chart:false */
2018-03-17 17:07:55 +00:00
$(function () {
'use strict'
var ticksStyle = {
fontColor: '#495057',
fontStyle: 'bold'
}
2020-05-30 13:44:20 +00:00
var mode = 'index'
2018-03-17 17:07:55 +00:00
var intersect = true
var $salesChart = $('#sales-chart')
2020-05-30 13:44:20 +00:00
// eslint-disable-next-line no-unused-vars
var salesChart = new Chart($salesChart, {
type: 'bar',
data: {
labels: ['JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
2018-03-17 17:07:55 +00:00
datasets: [
{
backgroundColor: '#007bff',
2020-05-30 13:44:20 +00:00
borderColor: '#007bff',
data: [1000, 2000, 3000, 2500, 2700, 2500, 3000]
2018-03-17 17:07:55 +00:00
},
{
backgroundColor: '#ced4da',
2020-05-30 13:44:20 +00:00
borderColor: '#ced4da',
data: [700, 1700, 2700, 2000, 1800, 1500, 2000]
2018-03-17 17:07:55 +00:00
}
]
},
options: {
maintainAspectRatio: false,
2020-05-30 13:44:20 +00:00
tooltips: {
mode: mode,
2018-03-17 17:07:55 +00:00
intersect: intersect
},
2020-05-30 13:44:20 +00:00
hover: {
mode: mode,
2018-03-17 17:07:55 +00:00
intersect: intersect
},
2020-05-30 13:44:20 +00:00
legend: {
2018-03-17 17:07:55 +00:00
display: false
},
2020-05-30 13:44:20 +00:00
scales: {
2018-03-17 17:07:55 +00:00
yAxes: [{
// display: false,
gridLines: {
2020-05-30 13:44:20 +00:00
display: true,
lineWidth: '4px',
color: 'rgba(0, 0, 0, .2)',
2018-03-17 17:07:55 +00:00
zeroLineColor: 'transparent'
},
2020-05-30 13:44:20 +00:00
ticks: $.extend({
2018-03-17 17:07:55 +00:00
beginAtZero: true,
// Include a dollar sign in the ticks
2020-05-30 13:44:20 +00:00
callback: function (value) {
2018-03-17 17:07:55 +00:00
if (value >= 1000) {
value /= 1000
value += 'k'
}
2020-05-30 13:44:20 +00:00
2018-03-17 17:07:55 +00:00
return '$' + value
}
}, ticksStyle)
}],
xAxes: [{
2020-05-30 13:44:20 +00:00
display: true,
2018-03-17 17:07:55 +00:00
gridLines: {
display: false
},
2020-05-30 13:44:20 +00:00
ticks: ticksStyle
2018-03-17 17:07:55 +00:00
}]
}
}
})
var $visitorsChart = $('#visitors-chart')
2020-05-30 13:44:20 +00:00
// eslint-disable-next-line no-unused-vars
var visitorsChart = new Chart($visitorsChart, {
data: {
labels: ['18th', '20th', '22nd', '24th', '26th', '28th', '30th'],
2018-03-17 17:07:55 +00:00
datasets: [{
2020-05-30 13:44:20 +00:00
type: 'line',
data: [100, 120, 170, 167, 180, 177, 160],
backgroundColor: 'transparent',
borderColor: '#007bff',
pointBorderColor: '#007bff',
2018-03-17 17:07:55 +00:00
pointBackgroundColor: '#007bff',
2020-05-30 13:44:20 +00:00
fill: false
2018-03-17 17:07:55 +00:00
// pointHoverBackgroundColor: '#007bff',
// pointHoverBorderColor : '#007bff'
},
2020-05-30 13:44:20 +00:00
{
type: 'line',
data: [60, 80, 70, 67, 80, 77, 100],
backgroundColor: 'tansparent',
borderColor: '#ced4da',
pointBorderColor: '#ced4da',
pointBackgroundColor: '#ced4da',
fill: false
// pointHoverBackgroundColor: '#ced4da',
// pointHoverBorderColor : '#ced4da'
}]
2018-03-17 17:07:55 +00:00
},
options: {
maintainAspectRatio: false,
2020-05-30 13:44:20 +00:00
tooltips: {
mode: mode,
2018-03-17 17:07:55 +00:00
intersect: intersect
},
2020-05-30 13:44:20 +00:00
hover: {
mode: mode,
2018-03-17 17:07:55 +00:00
intersect: intersect
},
2020-05-30 13:44:20 +00:00
legend: {
2018-03-17 17:07:55 +00:00
display: false
},
2020-05-30 13:44:20 +00:00
scales: {
2018-03-17 17:07:55 +00:00
yAxes: [{
// display: false,
gridLines: {
2020-05-30 13:44:20 +00:00
display: true,
lineWidth: '4px',
color: 'rgba(0, 0, 0, .2)',
2018-03-17 17:07:55 +00:00
zeroLineColor: 'transparent'
},
2020-05-30 13:44:20 +00:00
ticks: $.extend({
beginAtZero: true,
2018-03-17 17:07:55 +00:00
suggestedMax: 200
}, ticksStyle)
}],
xAxes: [{
2020-05-30 13:44:20 +00:00
display: true,
2018-03-17 17:07:55 +00:00
gridLines: {
display: false
},
2020-05-30 13:44:20 +00:00
ticks: ticksStyle
2018-03-17 17:07:55 +00:00
}]
}
}
})
})
// lgtm [js/unused-local-variable]