Search 1.9 billion lines of Odoo code on GitHub

web_widget_json_graph

Author: Vauxoo, Odoo Community Association (OCA)
License: LGPL-3
Branch: 12.0-ocabot-merge-pr-1733-by-moylop260-bump-nobump
Repository: brain-tec/web
Dependencies: web
Languages: HTML (422, 21.2%), JavaScript (41, 2.1%), Python (22, 1.1%), RobotFramework (1281, 64.5%), Sass (26, 1.3%), XML (19, 1.0%), and reStructuredText (175, 8.8%)
Other branches: 12.0, 12.0-ocabot-merge-pr-1347-by-dreispt-bump-minor, 12.0-ocabot-merge-pr-1522-by-dreispt-bump-nobump, 12.0-ocabot-merge-pr-1523-by-dreispt-bump-nobump, 12.0-ocabot-merge-pr-1702-by-dreispt-bump-patch, 12.0-ocabot-merge-pr-1738-by-dreispt-bump-nobump, 12.0-ocabot-merge-pr-1760-by-legalsylvain-bump-patch, 12.0-ocabot-merge-pr-1827-by-dreispt-bump-patch, 12.0-ocabot-merge-pr-2026-by-dreispt-bump-minor, 12.0.project_MI_465, 15.0, 15.0-ocabot-merge-pr-2251-by-pedrobaeza-bump-nobump, 15.0.project_LA_443, 15.0.project_SV_559, 15.0.project_SY_639, and 15.0.test
Other repositories: AITIC/web, AntoniRomera/web, AyoubZahid/web, Change2improve/web, Darknroses/web, Digital5-Odoo/web, Dobtor-OCA/web, ERPLibre/web, ForgeFlow/web, GSLabIt/web, Gabinete-Digital/web, GlodoUK/oca-web, Ingeos/web, Jarsa/web, KKamaa/web, LevelPrime/web, Martronic-SA/web, MihranThalhath/web, OCA/web, SeuMarco/web, SimoRubi/web, Studio73/web, Tecnativa/web, VanMoof/web, Vauxoo/web, WilldooIT/web, aaltinisik/web, acsone/web, anhvu-sg/web, aurestic/web, bizzappdev/web, blooparksystems/web, camptocamp/web, coopiteasy/web, diggy128/web, dingguijin/web, dynapps/web, eLBati/web, ecosoft-odoo/web, factorlibre/web, focusate/web-oca, gfcapalbo/web, hbrunn/web, i-vyshnevska/web, initOS/web, jeroen7s/web, kmee/web, kos94ok-3D/web, leanhtuan1996/web, legalsylvain/web, mharenz/web, modoolar/oca-web, mohamedhagag/web, multidadosti-erp/web, onurugur/web, pegonzalezspesol/web, petrus-v/web, sergiocorato/web, sewisoft/web, solvosci/web, steingabelgaard/web, sunflowerit/web, takinobori/oca-web, tarteo/web, tegin/web, tirix/web, tirma-sa/web, trevi-software/web, trobz/web, tvtma/web, unitek-solusi/OCA-web, ursais/web, vialaurea/OCA-web, xcgd/web, zarumaru/web, and zcyuefan/web

<h1 class="title">Web Widget JSON Graph</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_widget_json_graph"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_widget_json_graph"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module allows to load a line graph per ordered pair from an One2many or Many2many field.</p> <img alt="Widget in action" src="https://raw.githubusercontent.com/OCA/web/12.0/web_widget_json_graph/static/description/widget_in_action.png" style="width: 400px;" /> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#other-credits" id="id7">Other credits</a></li> <li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>Use this widget by including:</p> <pre> <code>&lt;field name=&quot;field_text_json&quot; widget=&quot;json_graph&quot; /&gt;</code> </pre> <p>For example:</p> <pre> <code>&lt;field name=&quot;values_data&quot; widget=&quot;json_graph&quot;/&gt;</code> </pre> <p>The JSON needs to be like:</p> <pre> <code>fields = ['field1', 'field2', 'field3', ...] field_x = 'field_x' dictionary = self.value_ids.sorted(field_x).read(fields) color = { 'field1': HEXCOLOR1, 'field2': '#FFBB78', 'field3': '#1F77B4', ... } dictionary = self.value_ids.sorted(field_x).read(fields) content = {} data = [] for field in fields: if field != field_x: content[field] = [] for rec in dictionary: content[field].append({'x': rec[field_x], 'y': rec[field]}) if field in color: data.append({'values': content[field], 'key': field, 'color': color[field]}) continue data.append({'values': content[field], 'key': field}) info = { 'label_x': 'X Label', 'label_y': 'Y label', 'data': data } self.field_text_json = json.dumps(info)</code> </pre> <p>For example:</p> <pre> <code>fields = ['sequence', 'value', 'sma', 'cma'] field_x = 'sequence' dictionary = self.value_ids.sorted(field_x).read(fields) color = { 'value': '#2CA02C', 'sma': '#FFBB78' } dictionary = self.value_ids.sorted(field_x).read(fields) content = {} data = [] for field in fields: if field != field_x: content[field] = [] for rec in dictionary: content[field].append({'x': rec[field_x], 'y': rec[field]}) if field in color: data.append({'values': content[field], 'key': field, 'color': color[field]}) continue data.append({'values': content[field], 'key': field}) info = { 'label_x': 'Sequence', 'label_y': '', 'data': data } self.values_data = json.dumps(info)</code> </pre> <a name="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h2> <ul class="simple"> <li><code>nolabel</code> is ignored, this image will never bring a label, by default simply use an extra separator.</li> <li>A graph will always use 100% of the width, pending the css dynamic attribute.</li> <li>Height is harcoded.</li> </ul> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_json_graph%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id4">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id5">Authors</a></h3> <ul class="simple"> <li>Vauxoo</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id6">Contributors</a></h3> <ul class="simple"> <li>Francisco Luna &lt;<a class="reference external" href="mailto:fluna&#64;vauxoo.com">fluna&#64;vauxoo.com</a>&gt;</li> <li>José Robles &lt;<a class="reference external" href="mailto:josemanuel&#64;vauxoo.com">josemanuel&#64;vauxoo.com</a>&gt;</li> <li>Luis González &lt;<a class="reference external" href="mailto:lgonzalez&#64;vauxoo.com">lgonzalez&#64;vauxoo.com</a>&gt;</li> <li>Nhomar Hernández &lt;<a class="reference external" href="mailto:nhomar&#64;vauxoo.com">nhomar&#64;vauxoo.com</a>&gt;</li> </ul> <a name="other-credits"></a> <h3><a class="toc-backref" href="#id7">Other credits</a></h3> <p>Vauxoo</p> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id8">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p><a class="reference external" href="https://github.com/luisg123v"><img alt="luisg123v" src="https://github.com/luisg123v.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/12.0/web_widget_json_graph">OCA/web</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>