Replace c3 (#11112)

* [charts] replace in asset.js

* replace in reports
This commit is contained in:
Prateeksha Singh
2017-10-17 12:03:02 +05:30
committed by Rushabh Mehta
parent 53659cf0bd
commit bfb108d722
10 changed files with 139 additions and 167 deletions

View File

@@ -18,23 +18,13 @@ frappe.query_reports["Minutes to First Response for Issues"] = {
get_chart_data: function(columns, result) {
return {
data: {
x: 'Date',
columns: [
['Date'].concat($.map(result, function(d) { return d[0]; })),
['Mins to first response'].concat($.map(result, function(d) { return d[1]; }))
]
// rows: [['Date', 'Mins to first response']].concat(result)
labels: result.map(d => d[0]),
datasets: [{
title: 'Mins to first response',
values: result.map(d => d[1])
}]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: frappe.ui.py_date_format
}
}
},
chart_type: 'line',
type: 'line',
}
}
}

View File

@@ -24,7 +24,7 @@ def execute(filters=None):
columns = get_columns()
data, timeslot_wise_count = get_data(filters)
chart = get_chartdata(timeslot_wise_count)
chart = get_chart_data(timeslot_wise_count)
return columns, data, None, chart
def get_data(filters):
@@ -75,23 +75,21 @@ def get_columns():
return columns
def get_chartdata(timeslot_wise_count):
x_interval = ['x']
total_count = ['Total']
def get_chart_data(timeslot_wise_count):
total_count = []
timeslots = ['12AM - 3AM', '3AM - 6AM', '6AM - 9AM',
'9AM - 12PM', '12PM - 3PM', '3PM - 6PM', '6PM - 9PM', '9PM - 12AM']
x_interval.extend(timeslots)
columns = [x_interval]
datasets = []
for data in timeslots:
total_count.append(timeslot_wise_count.get(data, 0))
columns.append(total_count)
datasets.append({'values': total_count})
chart = {
"data": {
'x': 'x',
'columns': columns
'labels': timeslots,
'datasets': datasets
}
}
chart["chart_type"] = "line"
chart["type"] = "line"
return chart