Merge pull request #16100 from deepeshgarg007/test-fix

Removed total label from graph
This commit is contained in:
Nabin Hait 2018-11-27 11:37:30 +05:30 committed by GitHub
commit 9a4cf4dce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 17 deletions

View File

@ -73,7 +73,8 @@ frappe.query_reports["Sales Analytics"] = {
events: {
onCheckRow: function(data) {
row_name = data[2].content;
row_values = data.slice(4).map(function (column) {
length = data.length
row_values = data.slice(4,length-1).map(function (column) {
return column.content;
})
entry = {
@ -102,12 +103,12 @@ frappe.query_reports["Sales Analytics"] = {
labels: raw_data.labels,
datasets: new_datasets
}
setTimeout(() => {
frappe.query_report.chart.update(new_data)
},200)
setTimeout(() => {
frappe.query_report.chart.draw(true);
}, 800)

View File

@ -166,7 +166,7 @@ class Analytics(object):
for entity, period_data in iteritems(self.entity_periodic_data):
row = {
"entity": entity,
"entity_name": self.entity_names.get(entity)
"entity_name": self.entity_names.get(entity)
}
total = 0
for dummy, end_date in self.periodic_daterange:
@ -177,7 +177,7 @@ class Analytics(object):
row["total"] = total
self.data.append(row)
def get_rows_by_group(self):
self.get_periodic_data()
out = []
@ -185,7 +185,7 @@ class Analytics(object):
for d in reversed(self.group_entries):
row = {
"entity": d.name,
"indent": self.depth_map.get(d.name)
"indent": self.depth_map.get(d.name)
}
total = 0
for dummy, end_date in self.periodic_daterange:
@ -275,7 +275,8 @@ class Analytics(object):
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
def get_chart_data(self):
labels = [d.get("label") for d in self.columns[2:]]
length = len(self.columns)
labels = [d.get("label") for d in self.columns[2:length-1]]
self.chart = {
"data": {
'labels': labels,

View File

@ -88,10 +88,9 @@ frappe.query_reports["Stock Analytics"] = {
events: {
onCheckRow: function(data) {
row_name = data[2].content;
row_values = data.slice(6).map(function (column) {
row_values = data.slice(7).map(function (column) {
return column.content;
})
entry = {
'name':row_name,
'values':row_values
@ -118,12 +117,12 @@ frappe.query_reports["Stock Analytics"] = {
labels: raw_data.labels,
datasets: new_datasets
}
setTimeout(() => {
frappe.query_report.chart.update(new_data)
},200)
setTimeout(() => {
frappe.query_report.chart.draw(true);
}, 800)

View File

@ -167,13 +167,11 @@ def get_data(filters):
return data
def get_chart_data(columns):
labels = [d.get("label") for d in columns[4:]]
labels = [d.get("label") for d in columns[5:]]
chart = {
"data": {
'labels': labels,
'datasets':[
{ "values": ['0' for d in columns[4:]] }
]
'datasets':[]
}
}
chart["type"] = "line"