[charts] update, without new build system

This commit is contained in:
Prateeksha Singh 2018-05-21 18:03:33 +05:30
parent 915e9cf876
commit 2e76a75b4b
5 changed files with 17 additions and 19 deletions

View file

@ -180,17 +180,18 @@ frappe.activity.render_heatmap = function(page) {
method: "frappe.desk.page.activity.activity.get_heatmap_data",
callback: function(r) {
if(r.message) {
var heatmap = new Chart({
parent: ".heatmap",
var heatmap = new frappeChart.Chart(".heatmap", {
type: 'heatmap',
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "actions",
discrete_domains: 0,
countLabel: "actions",
discreteDomains: 0,
data: {}
});
heatmap.update(r.message);
heatmap.update({
dataPoints: r.message
});
}
}
})

View file

@ -327,20 +327,20 @@ frappe.ui.form.Dashboard = Class.extend({
update_heatmap: function(data) {
if(this.heatmap) {
this.heatmap.update(data);
this.heatmap.update({
dataPoints: data
});
}
},
// heatmap
render_heatmap: function() {
if(!this.heatmap) {
this.heatmap = new Chart({
parent: "#heatmap-" + frappe.model.scrub(this.frm.doctype),
this.heatmap = new frappeChart.Chart("#heatmap-" + frappe.model.scrub(this.frm.doctype), {
type: 'heatmap',
height: 100,
start: new Date(moment().subtract(1, 'year').toDate()),
count_label: "interactions",
discrete_domains: 0,
countLabel: "interactions",
discreteDomains: 0,
data: {}
});
@ -407,14 +407,12 @@ frappe.ui.form.Dashboard = Class.extend({
var me = this;
this.chart_area.empty().removeClass('hidden');
$.extend(args, {
parent: '.form-graph',
type: 'line',
height: 140,
colors: ['green']
});
this.show();
this.chart = new Chart(args);
this.chart = new frappeChart.Chart('.form-graph', args);
if(!this.chart) {
this.hide();
}

View file

@ -674,8 +674,7 @@ frappe.views.GridReportWithPlot = frappe.views.GridReport.extend({
}
var chart_data = this.get_chart_data ? this.get_chart_data() : null;
this.chart = new Chart({
parent: ".chart",
this.chart = new frappeChart.Chart(".chart", {
height: 200,
data: chart_data,
type: 'line'

View file

@ -949,13 +949,12 @@ frappe.views.QueryReport = Class.extend({
}
$.extend(opts, {
parent: ".chart-area",
height: 200
});
if(opts.data && opts.data.labels && opts.data.labels.length) {
this.chart_area.toggle(true);
this.chart = new Chart(opts);
this.chart = new frappeChart.Chart(".chart-area", opts);
}
},

File diff suppressed because one or more lines are too long