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.

97 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. #. In its computed method do::
  31. def _compute_bokeh_chart(self):
  32. for rec in self:
  33. # Design your bokeh figure:
  34. p = figure()
  35. line = p.line([0, 2], [1, 8], line_width=5)
  36. # (...)
  37. # Get the html components and convert them to string into the field.
  38. script, div = components(p)
  39. rec.bokeh_chart = '%s%s' % (div, script)
  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. Maintainer
  62. ----------
  63. .. image:: http://odoo-community.org/logo.png
  64. :alt: Odoo Community Association
  65. :target: http://odoo-community.org
  66. This module is maintained by the OCA.
  67. OCA, or the Odoo Community Association, is a nonprofit organization whose
  68. mission is to support the collaborative development of Odoo features and
  69. promote its widespread use.
  70. To contribute to this module, please visit http://odoo-community.org.