remove cal_heatmap

This commit is contained in:
pratu16x7 2017-09-12 11:23:39 +05:30
parent 2b200bcf7f
commit 6fb4984e41
7 changed files with 19 additions and 3642 deletions

View file

@ -49,7 +49,6 @@
"moment": true,
"hljs": true,
"Awesomplete": true,
"CalHeatMap": true,
"Sortable": true,
"Showdown": true,
"Taggle": true,

View file

@ -180,30 +180,12 @@ frappe.activity.render_heatmap = function(page) {
method: "frappe.desk.page.activity.activity.get_heatmap_data",
callback: function(r) {
if(r.message) {
var legend = [];
var max = Math.max.apply(this, $.map(r.message, function(v) { return v }));
var legend = [cint(max/5), cint(max*2/5), cint(max*3/5), cint(max*4/5)];
var heatmap = new CalHeatMap();
heatmap.init({
itemSelector: ".heatmap",
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"
var heatmap = new frappe.ui.HeatMap({
parent: $(".heatmap"),
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "actions",
discrete_domains: 0
});
heatmap.update(r.message);

View file

@ -97,7 +97,6 @@
"public/css/bootstrap.css",
"public/css/font-awesome.css",
"public/css/octicons/octicons.css",
"public/css/cal-heatmap.css",
"public/css/c3.min.css",
"public/css/desk.css",
"public/css/indicator.css",
@ -231,7 +230,6 @@
],
"js/d3.min.js": [
"public/js/lib/d3.min.js",
"public/js/lib/cal-heatmap.js",
"public/js/lib/c3.min.js"
],
"css/module.min.css": [

View file

@ -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;
}

View file

@ -338,6 +338,7 @@ frappe.ui.form.Dashboard = Class.extend({
parent: this.heatmap_area.find("#heatmap-" + frappe.model.scrub(this.frm.doctype)),
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "items",
discrete_domains: 0
});

View file

@ -618,6 +618,7 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
subdomain = '',
data = {},
discrete_domains = 0,
count_label = '',
// remove these graph related args
y = [],
@ -631,6 +632,8 @@ frappe.ui.HeatMap = class HeatMap extends frappe.ui.Graph {
this.data = data;
this.discrete_domains = discrete_domains;
this.count_label = count_label;
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);
}
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;
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() {
this.first_month_label = 1;
if (this.first_week_start.getDate() > 8) {
this.first_month_label = 0;
}
// if (this.first_week_start.getDate() > 8) {
// this.first_month_label = 0;
// }
this.last_month_label = 1;
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 x = p_off.left - g_off.left + (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];
this.tip.set_values(x, y, name, value, [], 1);

File diff suppressed because it is too large Load diff