first commit
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
!(function (l) {
|
||||
"use strict";
|
||||
function t() {
|
||||
(this.$body = l("body")), (this.charts = []);
|
||||
}
|
||||
(t.prototype.respChart = function (a, r, e, o) {
|
||||
var n = Chart.controllers.line.prototype.draw;
|
||||
(Chart.controllers.line.prototype.draw = function () {
|
||||
n.apply(this, arguments);
|
||||
var t = this.chart.ctx,
|
||||
a = t.stroke;
|
||||
t.stroke = function () {
|
||||
t.save(),
|
||||
(t.shadowColor = "rgba(0,0,0,0.01)"),
|
||||
(t.shadowBlur = 20),
|
||||
(t.shadowOffsetX = 0),
|
||||
(t.shadowOffsetY = 5),
|
||||
a.apply(this, arguments),
|
||||
t.restore();
|
||||
};
|
||||
}),
|
||||
(Chart.defaults.font.color = "#8391a2"),
|
||||
(Chart.defaults.scale.grid.color = "#8391a2");
|
||||
var s = a.get(0).getContext("2d"),
|
||||
i = l(a).parent();
|
||||
return (function () {
|
||||
var t;
|
||||
switch ((a.attr("width", l(i).width()), r)) {
|
||||
case "Line":
|
||||
t = new Chart(s, { type: "line", data: e, options: o });
|
||||
break;
|
||||
case "Doughnut":
|
||||
t = new Chart(s, { type: "doughnut", data: e, options: o });
|
||||
break;
|
||||
case "Pie":
|
||||
t = new Chart(s, { type: "pie", data: e, options: o });
|
||||
break;
|
||||
case "Bar":
|
||||
t = new Chart(s, { type: "bar", data: e, options: o });
|
||||
break;
|
||||
case "Radar":
|
||||
t = new Chart(s, { type: "radar", data: e, options: o });
|
||||
break;
|
||||
case "PolarArea":
|
||||
t = new Chart(s, {
|
||||
data: e,
|
||||
type: "polarArea",
|
||||
options: o,
|
||||
});
|
||||
}
|
||||
return t;
|
||||
})();
|
||||
}),
|
||||
(t.prototype.initCharts = function () {
|
||||
var t = [];
|
||||
return (
|
||||
0 < l("#line-chart-example").length &&
|
||||
(0,
|
||||
t.push(
|
||||
this.respChart(
|
||||
l("#line-chart-example"),
|
||||
"Line",
|
||||
{
|
||||
labels: [
|
||||
"Mon",
|
||||
"Tue",
|
||||
"Wed",
|
||||
"Thu",
|
||||
"Fri",
|
||||
"Sat",
|
||||
"Sun",
|
||||
],
|
||||
datasets: [
|
||||
{
|
||||
label: "Completed Tasks",
|
||||
backgroundColor:
|
||||
"rgba(10, 207, 151, 0.3)",
|
||||
borderColor: "#0acf97",
|
||||
fill: !0,
|
||||
data: [32, 42, 42, 62, 52, 75, 62],
|
||||
},
|
||||
{
|
||||
label: "Plan Tasks",
|
||||
fill: !0,
|
||||
backgroundColor: "transparent",
|
||||
borderColor: "#0166D2",
|
||||
borderDash: [5, 5],
|
||||
data: [42, 58, 66, 93, 82, 105, 92],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
maintainAspectRatio: !1,
|
||||
plugins: {
|
||||
filler: { propagate: !1 },
|
||||
legend: { display: !1 },
|
||||
tooltips: { intersect: !1 },
|
||||
hover: { intersect: !0 },
|
||||
},
|
||||
tension: 0.3,
|
||||
scales: {
|
||||
x: { grid: { color: "rgba(0,0,0,0.05)" } },
|
||||
y: {
|
||||
ticks: { stepSize: 20 },
|
||||
display: !0,
|
||||
borderDash: [5, 5],
|
||||
grid: {
|
||||
color: "rgba(0,0,0,0)",
|
||||
fontColor: "#fff",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
)),
|
||||
t
|
||||
);
|
||||
}),
|
||||
(t.prototype.init = function () {
|
||||
var a = this;
|
||||
(Chart.defaults.font.family =
|
||||
'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif'),
|
||||
(a.charts = this.initCharts()),
|
||||
l(window).on("resize", function (t) {
|
||||
l.each(a.charts, function (t, a) {
|
||||
try {
|
||||
a.destroy();
|
||||
} catch (t) {}
|
||||
}),
|
||||
(a.charts = a.initCharts());
|
||||
});
|
||||
}),
|
||||
(l.ChartJs = new t()),
|
||||
(l.ChartJs.Constructor = t);
|
||||
})(window.jQuery),
|
||||
(function () {
|
||||
"use strict";
|
||||
window.jQuery.ChartJs.init();
|
||||
})();
|
||||
Reference in New Issue
Block a user