bargraph_field_json = fields.Text(compute='_compute_bargraph_field_json')
def _compute_bargraph_field_json(self):
for obj in self:
widget_vals = dict()
values = dict()
graph_data = [
(label1, value1),
(label2, value2),
.....
]
for label, value in graph_data:
values[label] = value
widget_vals['content'] = [values]
obj.bargraph_field_json = json.dumps(widget_vals)
<field nolabel="1" name="bargraph_field_json" widget="bar_graph"/>
This component was made using Chart.js library