refactor: added donut chart and made height implicit

This commit is contained in:
Shivam Mishra 2019-06-11 17:11:12 +05:30
parent 3ef35589b2
commit 63828ed111

View file

@ -486,11 +486,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
return options;
}
render_chart(options, height=200) {
Object.assign(options, {
height: height
});
render_chart(options) {
this.$chart.empty();
this.chart = new Chart(this.$chart[0], options);
this.$chart.show();
@ -543,10 +539,6 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
const values = dialog.get_values(true);
let options = make_chart_options(values);
Object.assign(options, {
height: 150
});
wrapper.empty();
new Chart(wrapper[0], options);
wrapper.find('.chart-container .title, .chart-container .sub-title').hide();
@ -587,7 +579,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
fieldname: 'chart_type',
label: 'Type of Chart',
fieldtype: 'Select',
options: ['Bar', 'Line', 'Percentage', 'Pie'],
options: ['Bar', 'Line', 'Percentage', 'Pie', 'Donut'],
default: 'Bar',
onchange: preview_chart
},