mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[12.0][NEW] web_widget_plotly_chart
This commit is contained in:
2
web_widget_plotly_chart/readme/CONTRIBUTORS.rst
Normal file
2
web_widget_plotly_chart/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,2 @@
|
||||
* Roberto Fichera <roberto.fichera@levelprime.com>
|
||||
* Michele Zaccheddu <michele.zaccheddu@levelprime.com>
|
||||
4
web_widget_plotly_chart/readme/CREDITS.rst
Normal file
4
web_widget_plotly_chart/readme/CREDITS.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
* This module uses the library `Plotly.js <https://github.com/plotly/plotly.js>`__
|
||||
which is under the open-source MIT License.
|
||||
Copyright (c) 2019 Plotly, Inc
|
||||
* Odoo Community Association (OCA)
|
||||
14
web_widget_plotly_chart/readme/DESCRIPTION.rst
Normal file
14
web_widget_plotly_chart/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
This module add the possibility to insert Plotly charts into Odoo standard views.
|
||||
|
||||
.. image:: /web_widget_plotly_chart/static/description/example.png
|
||||
:alt: Plotly Chart inserted into an Odoo view
|
||||
:width: 600 px
|
||||
|
||||
`Plotly <https://plot.ly/>`__ is a Python interactive visualization
|
||||
library built on top of d3.js and stack.gl, plotly.js is a high-level,
|
||||
declarative charting library. plotly.js ships with over 40 chart types,
|
||||
including scientific charts, 3D graphs, statistical charts, SVG maps, financial
|
||||
charts, and more.
|
||||
|
||||
If you want to see some samples of plotly's capabilities follow this `link
|
||||
<https://github.com/plotly/plotly.py#overview>`_.
|
||||
3
web_widget_plotly_chart/readme/INSTALL.rst
Normal file
3
web_widget_plotly_chart/readme/INSTALL.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
You need to install the python plotly library::
|
||||
|
||||
pip3 install plotly==4.1.0
|
||||
24
web_widget_plotly_chart/readme/USAGE.rst
Normal file
24
web_widget_plotly_chart/readme/USAGE.rst
Normal file
@@ -0,0 +1,24 @@
|
||||
To insert a Plotly chart in a view proceed as follows:
|
||||
|
||||
#. Declare a text computed field like this::
|
||||
|
||||
plotly_chart = fields.Text(
|
||||
string='Plotly Chart',
|
||||
compute='_compute_plotly_chart',
|
||||
)
|
||||
|
||||
#. In its computed method do::
|
||||
|
||||
def _compute_plotly_chart(self):
|
||||
for rec in self:
|
||||
data = [{'x': [1, 2, 3], 'y': [2, 3, 4]}]
|
||||
rec.plotly_chart = plotly.offline.plot(data,
|
||||
include_plotlyjs=False,
|
||||
output_type='div')
|
||||
|
||||
#. In the view, add something like this wherever you want to display your
|
||||
plotly chart::
|
||||
|
||||
<div>
|
||||
<field name="plotly_chart" widget="plotly_chart" nolabel="1"/>
|
||||
</div>
|
||||
Reference in New Issue
Block a user