remove cal_heatmap
This commit is contained in:
parent
2b200bcf7f
commit
6fb4984e41
7 changed files with 19 additions and 3642 deletions
|
|
@ -49,7 +49,6 @@
|
||||||
"moment": true,
|
"moment": true,
|
||||||
"hljs": true,
|
"hljs": true,
|
||||||
"Awesomplete": true,
|
"Awesomplete": true,
|
||||||
"CalHeatMap": true,
|
|
||||||
"Sortable": true,
|
"Sortable": true,
|
||||||
"Showdown": true,
|
"Showdown": true,
|
||||||
"Taggle": true,
|
"Taggle": true,
|
||||||
|
|
|
||||||
|
|
@ -180,30 +180,12 @@ frappe.activity.render_heatmap = function(page) {
|
||||||
method: "frappe.desk.page.activity.activity.get_heatmap_data",
|
method: "frappe.desk.page.activity.activity.get_heatmap_data",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
var legend = [];
|
var heatmap = new frappe.ui.HeatMap({
|
||||||
var max = Math.max.apply(this, $.map(r.message, function(v) { return v }));
|
parent: $(".heatmap"),
|
||||||
var legend = [cint(max/5), cint(max*2/5), cint(max*3/5), cint(max*4/5)];
|
height: 100,
|
||||||
var heatmap = new CalHeatMap();
|
start: new Date(moment().subtract(1, 'year').toDate()),
|
||||||
heatmap.init({
|
count_label: "actions",
|
||||||
itemSelector: ".heatmap",
|
discrete_domains: 0
|
||||||
domain: "month",
|
|
||||||
subDomain: "day",
|
|
||||||
start: moment().subtract(1, 'year').add(1, 'month').toDate(),
|
|
||||||
cellSize: 9,
|
|
||||||
cellPadding: 2,
|
|
||||||
domainGutter: 2,
|
|
||||||
range: 12,
|
|
||||||
domainLabelFormat: function(date) {
|
|
||||||
return moment(date).format("MMM").toUpperCase();
|
|
||||||
},
|
|
||||||
displayLegend: false,
|
|
||||||
legend: legend,
|
|
||||||
tooltip: true,
|
|
||||||
subDomainTitleFormat: {
|
|
||||||
empty: "{date}",
|
|
||||||
filled: "{count} actions on {date}"
|
|
||||||
},
|
|
||||||
subDomainDateFormat: "%d-%b"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
heatmap.update(r.message);
|
heatmap.update(r.message);
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,6 @@
|
||||||
"public/css/bootstrap.css",
|
"public/css/bootstrap.css",
|
||||||
"public/css/font-awesome.css",
|
"public/css/font-awesome.css",
|
||||||
"public/css/octicons/octicons.css",
|
"public/css/octicons/octicons.css",
|
||||||
"public/css/cal-heatmap.css",
|
|
||||||
"public/css/c3.min.css",
|
"public/css/c3.min.css",
|
||||||
"public/css/desk.css",
|
"public/css/desk.css",
|
||||||
"public/css/indicator.css",
|
"public/css/indicator.css",
|
||||||
|
|
@ -231,7 +230,6 @@
|
||||||
],
|
],
|
||||||
"js/d3.min.js": [
|
"js/d3.min.js": [
|
||||||
"public/js/lib/d3.min.js",
|
"public/js/lib/d3.min.js",
|
||||||
"public/js/lib/cal-heatmap.js",
|
|
||||||
"public/js/lib/c3.min.js"
|
"public/js/lib/c3.min.js"
|
||||||
],
|
],
|
||||||
"css/module.min.css": [
|
"css/module.min.css": [
|
||||||
|
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
/* Cal-HeatMap CSS */
|
|
||||||
|
|
||||||
.cal-heatmap-container {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .graph-label
|
|
||||||
{
|
|
||||||
fill: #999;
|
|
||||||
font-size: 10px
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .graph, .cal-heatmap-container .graph-legend rect {
|
|
||||||
shape-rendering: crispedges
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .graph-rect
|
|
||||||
{
|
|
||||||
fill: #ededed
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .graph-subdomain-group rect:hover
|
|
||||||
{
|
|
||||||
stroke: #000;
|
|
||||||
stroke-width: 1px
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .subdomain-text {
|
|
||||||
font-size: 8px;
|
|
||||||
fill: #999;
|
|
||||||
pointer-events: none
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .hover_cursor:hover {
|
|
||||||
cursor: pointer
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .qi {
|
|
||||||
background-color: #999;
|
|
||||||
fill: #999
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Remove comment to apply this style to date with value equal to 0
|
|
||||||
.q0
|
|
||||||
{
|
|
||||||
background-color: #fff;
|
|
||||||
fill: #fff;
|
|
||||||
stroke: #ededed
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
.cal-heatmap-container .q1
|
|
||||||
{
|
|
||||||
background-color: #dae289;
|
|
||||||
fill: #dae289
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .q2
|
|
||||||
{
|
|
||||||
background-color: #cedb9c;
|
|
||||||
fill: #9cc069
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .q3
|
|
||||||
{
|
|
||||||
background-color: #b5cf6b;
|
|
||||||
fill: #669d45
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .q4
|
|
||||||
{
|
|
||||||
background-color: #637939;
|
|
||||||
fill: #637939
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .q5
|
|
||||||
{
|
|
||||||
background-color: #3b6427;
|
|
||||||
fill: #3b6427
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container rect.highlight
|
|
||||||
{
|
|
||||||
stroke:#444;
|
|
||||||
stroke-width:1
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container text.highlight
|
|
||||||
{
|
|
||||||
fill: #444
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container rect.now
|
|
||||||
{
|
|
||||||
stroke: red
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container text.now
|
|
||||||
{
|
|
||||||
fill: red;
|
|
||||||
font-weight: 800
|
|
||||||
}
|
|
||||||
|
|
||||||
.cal-heatmap-container .domain-background {
|
|
||||||
fill: none;
|
|
||||||
shape-rendering: crispedges
|
|
||||||
}
|
|
||||||
|
|
||||||
.ch-tooltip {
|
|
||||||
padding: 10px;
|
|
||||||
background: #222;
|
|
||||||
color: #bbb;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.4;
|
|
||||||
width: 140px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 99999;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 2px;
|
|
||||||
box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
|
|
||||||
display: none;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ch-tooltip::after{
|
|
||||||
position: absolute;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
border-color: transparent;
|
|
||||||
border-style: solid;
|
|
||||||
content: "";
|
|
||||||
padding: 0;
|
|
||||||
display: block;
|
|
||||||
bottom: -6px;
|
|
||||||
left: 50%;
|
|
||||||
margin-left: -6px;
|
|
||||||
border-width: 6px 6px 0;
|
|
||||||
border-top-color: #222;
|
|
||||||
}
|
|
||||||
|
|
@ -338,6 +338,7 @@ frappe.ui.form.Dashboard = Class.extend({
|
||||||
parent: this.heatmap_area.find("#heatmap-" + frappe.model.scrub(this.frm.doctype)),
|
parent: this.heatmap_area.find("#heatmap-" + frappe.model.scrub(this.frm.doctype)),
|
||||||
height: 100,
|
height: 100,
|
||||||
start: new Date(moment().subtract(1, 'year').toDate()),
|
start: new Date(moment().subtract(1, 'year').toDate()),
|
||||||
|
count_label: "items",
|
||||||
discrete_domains: 0
|
discrete_domains: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -618,6 +618,7 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
|
||||||
subdomain = '',
|
subdomain = '',
|
||||||
data = {},
|
data = {},
|
||||||
discrete_domains = 0,
|
discrete_domains = 0,
|
||||||
|
count_label = '',
|
||||||
|
|
||||||
// remove these graph related args
|
// remove these graph related args
|
||||||
y = [],
|
y = [],
|
||||||
|
|
@ -631,6 +632,8 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.discrete_domains = discrete_domains;
|
this.discrete_domains = discrete_domains;
|
||||||
|
|
||||||
|
this.count_label = count_label;
|
||||||
|
|
||||||
this.legend_colors = ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127'];
|
this.legend_colors = ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -717,6 +720,11 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
|
||||||
color_index = this.get_max_checkpoint(data_value, this.distribution);
|
color_index = this.get_max_checkpoint(data_value, this.distribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.data[Math.round(timestamp)]) {
|
||||||
|
data_value = this.data[Math.round(timestamp)];
|
||||||
|
color_index = this.get_max_checkpoint(data_value, this.distribution);
|
||||||
|
}
|
||||||
|
|
||||||
let x = 13 + (index + week_col_change) * 12;
|
let x = 13 + (index + week_col_change) * 12;
|
||||||
|
|
||||||
data_group.add(this.snap.rect(x, y, square_side, square_side).attr({
|
data_group.add(this.snap.rect(x, y, square_side, square_side).attr({
|
||||||
|
|
@ -745,9 +753,9 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
|
||||||
|
|
||||||
render_month_labels() {
|
render_month_labels() {
|
||||||
this.first_month_label = 1;
|
this.first_month_label = 1;
|
||||||
if (this.first_week_start.getDate() > 8) {
|
// if (this.first_week_start.getDate() > 8) {
|
||||||
this.first_month_label = 0;
|
// this.first_month_label = 0;
|
||||||
}
|
// }
|
||||||
this.last_month_label = 1;
|
this.last_month_label = 1;
|
||||||
|
|
||||||
let first_month = this.months.shift();
|
let first_month = this.months.shift();
|
||||||
|
|
@ -785,7 +793,7 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
|
||||||
let width = parseInt(subdomain.attr('width'));
|
let width = parseInt(subdomain.attr('width'));
|
||||||
let x = p_off.left - g_off.left + (width+2)/2;
|
let x = p_off.left - g_off.left + (width+2)/2;
|
||||||
let y = p_off.top - g_off.top - (width+2)/2;
|
let y = p_off.top - g_off.top - (width+2)/2;
|
||||||
let value = count + ' items';
|
let value = count + ' ' + this.count_label;
|
||||||
let name = ' on ' + month + ' ' + date_parts[0] + ', ' + date_parts[2];
|
let name = ' on ' + month + ' ' + date_parts[0] + ', ' + date_parts[2];
|
||||||
|
|
||||||
this.tip.set_values(x, y, name, value, [], 1);
|
this.tip.set_values(x, y, name, value, [], 1);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue