-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,604 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,3 +89,5 @@ docs/_build/ | |
# Backup files | ||
*~ | ||
*.swp | ||
|
||
\.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
Multi Value Dimension | ||
===================== | ||
|
||
This module allows load a line graph per ordered pair in a x2many field. | ||
|
||
|
||
.. image:: https://www.evernote.com/l/AJ5Fxuoyfn5DPZCq0oTlbakT4KWh7YisWL0B/image.png | ||
:alt: Screenshot | ||
|
||
Usage | ||
===== | ||
|
||
Use this widget by saying:: | ||
|
||
<field name="field_text_json" widget="json_graph" /> | ||
|
||
Use of widget example:: | ||
|
||
<field name="values_data" widget="json_graph"/> | ||
|
||
The JSON needs to be like:: | ||
|
||
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) | ||
|
||
JSON example:: | ||
|
||
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) | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* nolabel is ignored, this image will never bring a label, by default simply use an extra separator. | ||
* A graph will use always 100% of the width, pending the css dynamic attribute. | ||
* The height is wired. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/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 | ||
`here <https://github.com/OCA/web/issues/new?body=module:%20web_widget_x2many_2d_graph%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Nhomar Hernández <nhomar@vauxoo.com> | ||
* José Robles <josemanuel@vauxoo.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://odoo-community.org | ||
|
||
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. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# This module copyright (C) 2015 Therp BV <http://therp.nl>. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# This module copyright (C) 2019 Vauxoo <http://vauxoo.com>. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
{ | ||
"name": "Line Graph for json fields", | ||
"version": "12.0.1.0.0", | ||
"author": "Vauxoo, " | ||
"Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"category": "Hidden/Dependency", | ||
"summary": "Draw awesome json fields with graphs.", | ||
"depends": [ | ||
'web', | ||
], | ||
"data": [ | ||
'views/templates.xml', | ||
], | ||
"qweb": [ | ||
'static/src/xml/web_widget_json_graph.xml', | ||
], | ||
"test": [ | ||
], | ||
"auto_install": False, | ||
"installable": True, | ||
"application": False, | ||
"external_dependencies": { | ||
'python': [], | ||
}, | ||
} |
Oops, something went wrong.