You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.9 KiB

7 years ago
  1. .. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
  2. :alt: License LGPL-3
  3. ======================
  4. Web Widget Bokeh Chart
  5. ======================
  6. This module add the posibility to insert Bokeh charts into Odoo standard views.
  7. .. image:: /web_widget_bokeh_chart/static/description/example.png
  8. :alt: Bokeh Chart inserted into an Odoo view
  9. :width: 600 px
  10. `Bokeh <https://bokeh.pydata.org>`__ is a Python interactive visualization
  11. library that targets modern web browsers for presentation. Its goal is to
  12. provide elegant, concise construction of basic exploratory and advanced
  13. custom graphics in the style of D3.js, but also deliver this capability with
  14. high-performance interactivity over very large or streaming datasets. Bokeh
  15. can help anyone who would like to quickly and easily create interactive
  16. plots, dashboards, and data applications.
  17. If you want to see some samples of bokeh's capabilities follow this `link
  18. <https://bokeh.pydata.org/en/latest/docs/gallery.html>`_.
  19. Installation
  20. ============
  21. You need to install the python bokeh library::
  22. pip install bokeh==0.12.7
  23. Usage
  24. =====
  25. To insert a Bokeh chart in a view proceed as follows:
  26. #. Declare a text computed field like this::
  27. bokeh_chart = fields.Text(
  28. string='Bokeh Chart',
  29. compute='_compute_bokeh_chart',
  30. )
  31. #. In its computed method do::
  32. def _compute_bokeh_chart(self):
  33. for rec in self:
  34. # Design your bokeh figure:
  35. p = figure() # import that as `from bokeh.plotting import figure`
  36. line = p.line([0, 2], [1, 8], line_width=5)
  37. # (...)
  38. # `p.html.data` contains both markup and the script of a chart.
  39. rec.bokeh_chart = p.html.data
  40. #. In the view, add something like this wherever you want to display your
  41. bokeh chart::
  42. <div>
  43. <field name="bokeh_chart" widget="bokeh_chart" nolabel="1"/>
  44. </div>
  45. Bug Tracker
  46. ===========
  47. Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
  48. In case of trouble, please check there if your issue has already been
  49. reported. If you spotted it first, help us smash it by providing detailed and
  50. welcomed feedback.
  51. Credits
  52. =======
  53. * This module uses the library `Bokeh <https://github.com/bokeh/bokeh>`__
  54. which is under the open-source BSD 3-clause "New" or "Revised" License.
  55. Copyright (c) 2012, Anaconda, Inc.
  56. * Odoo Community Association (OCA)
  57. Contributors
  58. ------------
  59. * Jordi Ballester Alomar <jordi.ballester@eficent.com>
  60. * Lois Rilo Antelo <lois.rilo@eficent.com>
  61. * Artem Kostyuk <a.kostyuk@mobilunity.com>
  62. Maintainer
  63. ----------
  64. .. image:: http://odoo-community.org/logo.png
  65. :alt: Odoo Community Association
  66. :target: http://odoo-community.org
  67. This module is maintained by the OCA.
  68. OCA, or the Odoo Community Association, is a nonprofit organization whose
  69. mission is to support the collaborative development of Odoo features and
  70. promote its widespread use.
  71. To contribute to this module, please visit http://odoo-community.org.