Web Widget JSON Graph
(0)
44

Web Widget JSON Graph

FREE

Available versions
Technical name
web_widget_json_graph
License
LGPL-3
Secure dependencies
N/A
Web Widget JSON Graph

Web Widget JSON Graph

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runbot

This module allows to load a line graph per ordered pair from an One2many or Many2many field.

Widget in action

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/>.

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 smashing it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Vauxoo

Contributors

Other credits

Vauxoo

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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:

luisg123v frahikLV

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.

0.0 / 5.0
based on 0 ratings
This app does not use any external Python dependencies.
This app is not translated in any languages, it is only available in English.