mirror of https://github.com/OCA/web.git
[MIG] web_widget_bokeh_chart: Migration to 11.0
parent
321d690082
commit
53b2940f1b
|
@ -0,0 +1,2 @@
|
|||
# web_widget_bokeh_chart
|
||||
bokeh==0.12.7
|
|
@ -38,19 +38,19 @@ To insert a Bokeh chart in a view proceed as follows:
|
|||
|
||||
bokeh_chart = fields.Text(
|
||||
string='Bokeh Chart',
|
||||
compute=_compute_bokeh_chart)
|
||||
compute='_compute_bokeh_chart',
|
||||
)
|
||||
|
||||
#. In its computed method do::
|
||||
|
||||
def _compute_bokeh_chart(self):
|
||||
for rec in self:
|
||||
# Design your bokeh figure:
|
||||
p = figure()
|
||||
p = figure() # import that as `from bokeh.plotting import figure`
|
||||
line = p.line([0, 2], [1, 8], line_width=5)
|
||||
# (...)
|
||||
# Get the html components and convert them to string into the field.
|
||||
script, div = components(p)
|
||||
rec.bokeh_chart = '%s%s' % (div, script)
|
||||
# `p.html.data` contains both markup and the script of a chart.
|
||||
rec.bokeh_chart = p.html.data
|
||||
|
||||
#. In the view, add something like this wherever you want to display your
|
||||
bokeh chart::
|
||||
|
@ -80,6 +80,7 @@ Contributors
|
|||
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Lois Rilo Antelo <lois.rilo@eficent.com>
|
||||
* Artem Kostyuk <a.kostyuk@mobilunity.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).#
|
||||
|
||||
|
@ -8,7 +7,7 @@
|
|||
"summary": "This widget allows to display charts using Bokeh library.",
|
||||
"author": "Eficent, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"version": "10.0.1.0.0",
|
||||
"version": "11.0.1.0.0",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": ["web"],
|
||||
"data": [
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
odoo.define('web_widget_bokeh_chart', function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require('web.core');
|
||||
var form_common = require('web.form_common');
|
||||
var formats = require('web.formats');
|
||||
var Model = require('web.Model');
|
||||
var fieldRegistry = require('web.field_registry');
|
||||
var AbstractField = require('web.AbstractField');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
var BokehChartWidget = form_common.AbstractField.extend({
|
||||
render_value: function() {
|
||||
var val = this.get('value');
|
||||
var BokehChartWidget = AbstractField.extend({
|
||||
start: function() {
|
||||
var val = this.value;
|
||||
this.$el.html(val);
|
||||
}
|
||||
});
|
||||
core.form_widget_registry.add('bokeh_chart', BokehChartWidget);
|
||||
fieldRegistry.add('bokeh_chart', BokehChartWidget);
|
||||
return {
|
||||
BokehChartWidget: BokehChartWidget
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue