Draw json fields with graphs.
Project description
This module allows to load a line graph per ordered pair from an One2many or Many2many field.
Table of contents
Usage
Use this widget by including:
<field name="field_text_json" widget="json_graph" />
For example:
<field name="values_data" widget="json_graph"/>
The JSON needs to be like:
info = { "type": "line", "data": {"datasets": [], "labels": []}, "options": { "scales": { "yAxes": [ { "ticks": {"beginAtZero": True, "stacked": False}, "scaleLabel": {"display": True, "labelString": "Quantity"}, } ], "xAxes": [ { "scaleLabel": {"display": True, "labelString": "Date"}, } ], }, "elements": {"point": {"radius": 3}}, "legend": {"labels": {"usePointStyle": True}}, "tooltips": {"intersect": False, "axis": "xy", "mode": "index"}, }, } self.field_text_json = json.dumps(info)
For example:
plot_dataset = [1, 2, 3, 4, 3, 2] labels = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] info = { "type": "line", "data": {"datasets": plot_dataset, "labels": labels}, "options": { "scales": { "yAxes": [ { "ticks": {"beginAtZero": True, "stacked": False}, "scaleLabel": {"display": True, "labelString": "Quantity"}, } ], "xAxes": [ { "scaleLabel": {"display": True, "labelString": "Date"}, } ], }, "elements": {"point": {"radius": 3}}, "legend": {"labels": {"usePointStyle": True}}, "tooltips": {"intersect": False, "axis": "xy", "mode": "index"}, }, } self.values_data = json.dumps(info)
For more information, please see Chart Js Documentation <https://www.chartjs.org/docs/2.9.4/>.
Known issues / Roadmap
None
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Francisco Luna <fluna@vauxoo.com>
José Robles <josemanuel@vauxoo.com>
Luis González <lgonzalez@vauxoo.com>
Nhomar Hernández <nhomar@vauxoo.com>
Other credits
Vauxoo
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
Current maintainers:
This module is part of the OCA/web project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo_addon_web_widget_json_graph-15.0.1.0.0.3-py3-none-any.whl
.
File metadata
- Download URL: odoo_addon_web_widget_json_graph-15.0.1.0.0.3-py3-none-any.whl
- Upload date:
- Size: 191.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc1fb739487a0cedc8614e3f4067977925baa0fad96e7ed17df71a089979c540 |
|
MD5 | 70334419e2fa5979bf1bb55fde8fa168 |
|
BLAKE2b-256 | b92c8a362fccb75c63c6b1e4a0fed63b59592a01241831f761e966d0c0e82310 |