mirror of https://github.com/OCA/web.git
[15.0][MIG] web_widget_bokeh_chart
parent
c84b332048
commit
9019e6dc03
|
@ -23,7 +23,7 @@ Web Widget Bokeh Chart
|
||||||
:target: https://runbot.odoo-community.org/runbot/162/14.0
|
:target: https://runbot.odoo-community.org/runbot/162/14.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
This module add the possibility to insert Bokeh charts into Odoo standard views.
|
This module add the possibility to insert Bokeh charts into Odoo standard views.
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Installation
|
||||||
|
|
||||||
You need to install the python bokeh library::
|
You need to install the python bokeh library::
|
||||||
|
|
||||||
pip3 install bokeh==2.3.1
|
pip3 install bokeh==2.4.2
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
@ -75,7 +75,7 @@ To insert a Bokeh chart in a view proceed as follows:
|
||||||
line = p.line([0, 2], [1, 8], line_width=5)
|
line = p.line([0, 2], [1, 8], line_width=5)
|
||||||
# (...)
|
# (...)
|
||||||
# fill the record field with both markup and the script of a chart.
|
# fill the record field with both markup and the script of a chart.
|
||||||
script, div = components(p)
|
script, div = components(p, wrap_script=False)
|
||||||
rec.bokeh_chart = '%s%s' % (div, script)
|
rec.bokeh_chart = '%s%s' % (div, script)
|
||||||
|
|
||||||
#. In the view, add something like this wherever you want to display your
|
#. In the view, add something like this wherever you want to display your
|
||||||
|
@ -109,6 +109,7 @@ Contributors
|
||||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||||
* Artem Kostyuk <a.kostyuk@mobilunity.com>
|
* Artem Kostyuk <a.kostyuk@mobilunity.com>
|
||||||
|
* Christopher ormaza <chris.ormaza@forgeflow.com>
|
||||||
|
|
||||||
Other credits
|
Other credits
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
@ -134,11 +135,15 @@ promote its widespread use.
|
||||||
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
|
.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px
|
||||||
:target: https://github.com/LoisRForgeFlow
|
:target: https://github.com/LoisRForgeFlow
|
||||||
:alt: LoisRForgeFlow
|
:alt: LoisRForgeFlow
|
||||||
|
.. |maintainer-ChrisOForgeFlow| image:: https://github.com/ChrisOForgeFlow.png?size=40px
|
||||||
|
:target: https://github.com/ChrisOForgeFlow
|
||||||
|
:alt: ChrisOForgeFlow
|
||||||
|
|
||||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||||
|
|
||||||
|maintainer-LoisRForgeFlow|
|
|maintainer-LoisRForgeFlow|
|
||||||
|
|maintainer-ChrisOForgeFlow|
|
||||||
|
|
||||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/14.0/web_widget_bokeh_chart>`_ project on GitHub.
|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_widget_bokeh_chart>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -6,13 +6,18 @@
|
||||||
"category": "Hidden",
|
"category": "Hidden",
|
||||||
"summary": "This widget allows to display charts using Bokeh library.",
|
"summary": "This widget allows to display charts using Bokeh library.",
|
||||||
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
|
"author": "ForgeFlow, " "Odoo Community Association (OCA)",
|
||||||
"version": "14.0.2.3.1",
|
"version": "15.0.1.0.0",
|
||||||
"maintainers": ["LoisRForgeFlow"],
|
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
|
||||||
"development_status": "Production/Stable",
|
"development_status": "Production/Stable",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"depends": ["web"],
|
"depends": ["web"],
|
||||||
"data": ["views/web_widget_bokeh_chart.xml"],
|
"data": [],
|
||||||
"external_dependencies": {"python": ["bokeh==2.3.1"]},
|
"external_dependencies": {"python": ["bokeh==2.4.2"]},
|
||||||
"auto_install": False,
|
"auto_install": False,
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
|
"assets": {
|
||||||
|
"web.assets_backend": [
|
||||||
|
"web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.esm.js",
|
||||||
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
* Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||||
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
* Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||||
* Artem Kostyuk <a.kostyuk@mobilunity.com>
|
* Artem Kostyuk <a.kostyuk@mobilunity.com>
|
||||||
|
* Christopher Ormaza <chris.ormaza@forgeflow.com>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
You need to install the python bokeh library::
|
You need to install the python bokeh library::
|
||||||
|
|
||||||
pip3 install bokeh==2.3.1
|
pip3 install bokeh==2.4.2
|
||||||
|
|
|
@ -16,7 +16,7 @@ To insert a Bokeh chart in a view proceed as follows:
|
||||||
line = p.line([0, 2], [1, 8], line_width=5)
|
line = p.line([0, 2], [1, 8], line_width=5)
|
||||||
# (...)
|
# (...)
|
||||||
# fill the record field with both markup and the script of a chart.
|
# fill the record field with both markup and the script of a chart.
|
||||||
script, div = components(p)
|
script, div = components(p, wrap_script=False)
|
||||||
rec.bokeh_chart = '%s%s' % (div, script)
|
rec.bokeh_chart = '%s%s' % (div, script)
|
||||||
|
|
||||||
#. In the view, add something like this wherever you want to display your
|
#. In the view, add something like this wherever you want to display your
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import basicFields from "web.basic_fields";
|
||||||
|
import fieldRegistry from "web.field_registry";
|
||||||
|
|
||||||
|
const BokehChartWidget = basicFields.FieldChar.extend({
|
||||||
|
jsLibs: [
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.4.2.min.js",
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.4.2.min.js",
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-2.4.2.min.js",
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-2.4.2.min.js",
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-2.4.2.min.js",
|
||||||
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-2.4.2.min.js",
|
||||||
|
],
|
||||||
|
_renderReadonly: function () {
|
||||||
|
try {
|
||||||
|
const val = JSON.parse(this.value);
|
||||||
|
this.$el.html(val.div);
|
||||||
|
const script = document.createElement("script");
|
||||||
|
script.setAttribute("type", "text/javascript");
|
||||||
|
if ("textContent" in script) script.textContent = val.script;
|
||||||
|
else script.text = val.script;
|
||||||
|
$("head").append(script);
|
||||||
|
} catch (error) {
|
||||||
|
return this._super(...arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fieldRegistry.add("bokeh_chart", BokehChartWidget);
|
||||||
|
|
||||||
|
export default BokehChartWidget;
|
|
@ -1,17 +0,0 @@
|
||||||
odoo.define("web_widget_bokeh_chart", function (require) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var fieldRegistry = require("web.field_registry");
|
|
||||||
var AbstractField = require("web.AbstractField");
|
|
||||||
|
|
||||||
var BokehChartWidget = AbstractField.extend({
|
|
||||||
_renderReadonly: function () {
|
|
||||||
var val = this.value;
|
|
||||||
this.$el.html(val);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
fieldRegistry.add("bokeh_chart", BokehChartWidget);
|
|
||||||
return {
|
|
||||||
BokehChartWidget: BokehChartWidget,
|
|
||||||
};
|
|
||||||
});
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,27 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<template
|
|
||||||
id="assets_backend"
|
|
||||||
name="web_widget_bokeh_chart assets"
|
|
||||||
inherit_id="web.assets_backend"
|
|
||||||
>
|
|
||||||
<xpath expr="." position="inside">
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.3.1.min.js"
|
|
||||||
/>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-2.3.1.min.js"
|
|
||||||
/>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.3.1.min.js"
|
|
||||||
/>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.js"
|
|
||||||
/>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
</odoo>
|
|
Loading…
Reference in New Issue