eea.plotly 1.6__tar.gz → 1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eea_plotly-1.6/eea.plotly.egg-info → eea_plotly-1.8}/PKG-INFO +11 -1
- {eea_plotly-1.6 → eea_plotly-1.8}/docs/HISTORY.txt +10 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/preview_adapter/soer_miniature.py +88 -24
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/controlpanel.json +219 -92
- eea_plotly-1.8/eea/plotly/version.txt +1 -0
- {eea_plotly-1.6 → eea_plotly-1.8/eea.plotly.egg-info}/PKG-INFO +11 -1
- eea_plotly-1.6/eea/plotly/version.txt +0 -1
- {eea_plotly-1.6 → eea_plotly-1.8}/CONTRIBUTING.md +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/MANIFEST.in +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/README.rst +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/docs/LICENSE.GPL +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/docs/LICENSE.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/README.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/behaviors.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/controlpanel.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/preview.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/preview_adapter/adapter.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/browser/pt/visualization_view.pt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/controlpanel.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/deserializer/blocks.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/deserializer/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/deserializer/dxcontent.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/deserializer/dxfields.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/interfaces.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/io_csv.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/io_json.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/bg/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/bg/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/cs/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/cs/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/da/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/da/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/de/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/de/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/eea.pot +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/el/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/el/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/en/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/en/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/es/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/es/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/et/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/et/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/eu/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/eu/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/fi/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/fi/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/fr/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/fr/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/hr/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/hr/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/hu/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/hu/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/is/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/is/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/it/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/it/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/kl/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/kl/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/lt/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/lt/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/lv/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/lv/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/mt/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/mt/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/nl/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/nl/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/no/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/no/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pl/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pl/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/plone-manual.pot +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pt/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pt/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pt_BR/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/pt_BR/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/ro/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/ro/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/ru/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/ru/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sk/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sk/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sl/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sl/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sv/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/sv/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/tr/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/tr/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/update.sh +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/zh_TW/LC_MESSAGES/eea.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/locales/zh_TW/LC_MESSAGES/plone.po +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/permissions.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/browserlayer.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/controlpanel.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/metadata.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/registry.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/rolemap.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/types/visualization.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/default/types.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/uninstall/browserlayer.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/uninstall/controlpanel.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles/uninstall/registry.xml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/profiles.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/controlpanel/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/controlpanel/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/controlpanel/get.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/controlpanel/reset.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/visualization/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/restapi/visualization/get.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/serializer/blocks.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/serializer/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/serializer/dxfields.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/serializer/utils.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/setuphandlers.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/tests/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/tests/base.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/tests/test_doctests.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/upgrades/__init__.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/upgrades/configure.zcml +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea/plotly/utils.py +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/SOURCES.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/dependency_links.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/entry_points.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/namespace_packages.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/not-zip-safe +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/requires.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/eea.plotly.egg-info/top_level.txt +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/setup.cfg +0 -0
- {eea_plotly-1.6 → eea_plotly-1.8}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eea.plotly
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8
|
|
4
4
|
Summary: volto-plotlycharts backend support
|
|
5
5
|
Home-page: https://github.com/eea/eea.plotly
|
|
6
6
|
Author: European Environment Agency: IDM2 A-Team
|
|
@@ -145,6 +145,16 @@ EEA_ - European Environment Agency (EU)
|
|
|
145
145
|
Changelog
|
|
146
146
|
=========
|
|
147
147
|
|
|
148
|
+
1.8 - (2025-08-20)
|
|
149
|
+
---------------------------
|
|
150
|
+
* Change: fix 'no data provided' soer indicator
|
|
151
|
+
[razvanMiu]
|
|
152
|
+
|
|
153
|
+
1.7 - (2025-07-06)
|
|
154
|
+
---------------------------
|
|
155
|
+
* Change: soer_miniature improved logic
|
|
156
|
+
[razvanMiu]
|
|
157
|
+
|
|
148
158
|
1.6 - (2025-06-24)
|
|
149
159
|
---------------------------
|
|
150
160
|
* Change: pin kaleido version to 0.2.1
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
1.8 - (2025-08-20)
|
|
5
|
+
---------------------------
|
|
6
|
+
* Change: fix 'no data provided' soer indicator
|
|
7
|
+
[razvanMiu]
|
|
8
|
+
|
|
9
|
+
1.7 - (2025-07-06)
|
|
10
|
+
---------------------------
|
|
11
|
+
* Change: soer_miniature improved logic
|
|
12
|
+
[razvanMiu]
|
|
13
|
+
|
|
4
14
|
1.6 - (2025-06-24)
|
|
5
15
|
---------------------------
|
|
6
16
|
* Change: pin kaleido version to 0.2.1
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
""" SOER miniature theme for Plotly visualizations. """
|
|
2
2
|
import math
|
|
3
3
|
|
|
4
|
+
SOER_TRACES_COUNT = 5
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
def nice_step(vmin, vmax, target_ticks=5):
|
|
6
8
|
"""Calculate a 'nice' step size for axis ticks, similar to Plotly/D3."""
|
|
@@ -12,7 +14,6 @@ def nice_step(vmin, vmax, target_ticks=5):
|
|
|
12
14
|
magnitude = 10 ** math.floor(math.log10(raw_step))
|
|
13
15
|
residual = raw_step / magnitude
|
|
14
16
|
|
|
15
|
-
# D3/Plotly uses [1, 2, 2.5, 5, 10]
|
|
16
17
|
if residual <= 1:
|
|
17
18
|
nice_multiplier = 1
|
|
18
19
|
elif residual <= 2:
|
|
@@ -34,14 +35,22 @@ def exact_step(vmin, vmax, target_ticks=5):
|
|
|
34
35
|
return abs(vmax - vmin) / (target_ticks - 1)
|
|
35
36
|
|
|
36
37
|
|
|
38
|
+
def toFloat(v):
|
|
39
|
+
""" Convert value to float """
|
|
40
|
+
try:
|
|
41
|
+
return float(v)
|
|
42
|
+
except ValueError:
|
|
43
|
+
return 0
|
|
44
|
+
|
|
45
|
+
|
|
37
46
|
def getMin(arr):
|
|
38
47
|
""" Get minimum value from array """
|
|
39
|
-
return min(
|
|
48
|
+
return min(toFloat(v) for v in arr if v is not None)
|
|
40
49
|
|
|
41
50
|
|
|
42
51
|
def getMax(arr):
|
|
43
52
|
""" Get maximum value from array """
|
|
44
|
-
return max(
|
|
53
|
+
return max(toFloat(v) for v in arr if v is not None)
|
|
45
54
|
|
|
46
55
|
|
|
47
56
|
def serialize(context):
|
|
@@ -51,50 +60,107 @@ def serialize(context):
|
|
|
51
60
|
|
|
52
61
|
data = context.visualization["data"]
|
|
53
62
|
layout = context.visualization["layout"]
|
|
54
|
-
min_year = float("inf")
|
|
55
|
-
max_year = float("-inf")
|
|
56
|
-
first_val = None
|
|
57
|
-
new_x = []
|
|
58
|
-
new_y = []
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
top = (
|
|
65
|
+
layout.get("margin", {}).get("t") or
|
|
66
|
+
layout.get("template", {}).get("margin", {}).get("t")
|
|
67
|
+
) or 0
|
|
68
|
+
nticks = max(int((context.height - top) / 100), 2)
|
|
69
|
+
|
|
70
|
+
if len(data) < SOER_TRACES_COUNT:
|
|
61
71
|
layout["xaxis"]["showticklabels"] = False
|
|
72
|
+
layout["xaxis"]["showgrid"] = False
|
|
73
|
+
layout["xaxis"]["autorange"] = False
|
|
74
|
+
layout["xaxis"]["range"] = [0, 1]
|
|
75
|
+
layout["xaxis"]["tickmode"] = "auto"
|
|
76
|
+
layout["xaxis"]["gridwidth"] = 4
|
|
77
|
+
|
|
78
|
+
layout["yaxis"]["showticklabels"] = False
|
|
79
|
+
layout["yaxis"]["showgrid"] = True
|
|
80
|
+
layout["yaxis"]["autorange"] = False
|
|
81
|
+
layout["yaxis"]["range"] = [0, nticks]
|
|
82
|
+
layout["yaxis"]["tickmode"] = "linear"
|
|
83
|
+
layout["yaxis"]["automargin"] = True
|
|
84
|
+
layout["yaxis"]["gridwidth"] = 4
|
|
85
|
+
|
|
86
|
+
del layout["template"]["layout"]["annotationdefaults"]
|
|
87
|
+
del layout["template"]["layout"]["yaxis"]["rangemode"]
|
|
88
|
+
|
|
89
|
+
layout["template"]["layout"]["annotationdefaults"] = {
|
|
90
|
+
"showarrow": False,
|
|
91
|
+
"xref": "paper",
|
|
92
|
+
"yref": "paper"
|
|
93
|
+
}
|
|
62
94
|
return False
|
|
63
95
|
|
|
64
|
-
|
|
96
|
+
min_year = toFloat("inf")
|
|
97
|
+
max_year = toFloat("-inf")
|
|
98
|
+
first_val = None
|
|
99
|
+
new_x = []
|
|
100
|
+
new_y = []
|
|
101
|
+
new_text = []
|
|
102
|
+
dotted_trace = None
|
|
103
|
+
|
|
104
|
+
# Custom dotted trace
|
|
105
|
+
trace_6 = None
|
|
106
|
+
if len(data) > 5:
|
|
107
|
+
trace_6 = data[5]
|
|
108
|
+
|
|
109
|
+
if trace_6 and trace_6.get("id") == "country_trend_dotted":
|
|
110
|
+
trace_6["mode"] = "lines"
|
|
111
|
+
dotted_trace = trace_6
|
|
112
|
+
elif trace_6:
|
|
113
|
+
trace_6["visible"] = False
|
|
114
|
+
trace_6["x"] = None
|
|
115
|
+
trace_6["y"] = None
|
|
116
|
+
|
|
117
|
+
if data[0].get("x") is not None and data[0].get("y") is not None:
|
|
118
|
+
x_len = len(data[0].get("x") or [])
|
|
119
|
+
y_len = len(data[0].get("y") or [])
|
|
120
|
+
text_len = len(data[0].get("text") or [])
|
|
121
|
+
|
|
122
|
+
if y_len < x_len:
|
|
123
|
+
data[0]["y"] = data[0]["y"] + [None] * (x_len - y_len)
|
|
124
|
+
|
|
65
125
|
for index, val in enumerate(data[0]["y"]):
|
|
66
126
|
if val and not first_val:
|
|
67
127
|
first_val = val
|
|
68
128
|
if not first_val:
|
|
69
129
|
continue
|
|
70
|
-
year = data[0]["x"][index]
|
|
130
|
+
year = toFloat(data[0]["x"][index]) if index < x_len else None
|
|
131
|
+
text = data[0]["text"][index] if index < text_len else None
|
|
71
132
|
new_x.append(year)
|
|
72
133
|
new_y.append(val)
|
|
134
|
+
new_text.append(text)
|
|
73
135
|
if val and year > max_year:
|
|
74
136
|
max_year = year
|
|
75
137
|
if val and year < min_year:
|
|
76
138
|
min_year = year
|
|
77
139
|
|
|
78
|
-
|
|
140
|
+
if dotted_trace:
|
|
141
|
+
first_year = toFloat(dotted_trace["x"][0])
|
|
142
|
+
if first_year < min_year:
|
|
143
|
+
min_year = first_year
|
|
144
|
+
|
|
79
145
|
data[0]["x"] = new_x
|
|
80
146
|
data[0]["y"] = new_y
|
|
81
|
-
data[0]["text"] =
|
|
147
|
+
data[0]["text"] = new_text
|
|
148
|
+
y_len = len(data[0]["y"])
|
|
149
|
+
y4_len = len(data[4].get("y") or [])
|
|
82
150
|
|
|
83
|
-
if
|
|
84
|
-
y_len = len(data[0]["y"])
|
|
85
|
-
y4_len = len(data[4]["y"])
|
|
151
|
+
if y4_len >= y_len:
|
|
86
152
|
data[4]["x"] = new_x
|
|
87
153
|
data[4]["y"] = data[4]["y"][y4_len - y_len:y4_len + 1]
|
|
88
|
-
|
|
154
|
+
elif data[4].get("x") is None or data[4].get("y") is None:
|
|
89
155
|
data[4] = {
|
|
90
156
|
"type": "scatter",
|
|
91
157
|
"x": new_x,
|
|
92
158
|
"y": [None] * len(new_y),
|
|
93
159
|
"visible": True,
|
|
94
160
|
"marker": {
|
|
95
|
-
"color": "rgba(0, 0, 0,
|
|
161
|
+
"color": "rgba(0, 0, 0, 1)",
|
|
96
162
|
"line": {
|
|
97
|
-
"color": "rgba(0, 0, 0,
|
|
163
|
+
"color": "rgba(0, 0, 0, 1)"
|
|
98
164
|
}
|
|
99
165
|
}
|
|
100
166
|
}
|
|
@@ -103,25 +169,23 @@ def serialize(context):
|
|
|
103
169
|
layout["xaxis"]["tickmode"] = "array"
|
|
104
170
|
layout["xaxis"]["tickvals"] = [min_year, max_year, 2030]
|
|
105
171
|
layout["xaxis"]["range"] = [
|
|
106
|
-
min_year -
|
|
172
|
+
min_year - 2, 2032]
|
|
107
173
|
layout["xaxis"]["autorange"] = True
|
|
108
174
|
|
|
109
175
|
y_values = (
|
|
110
176
|
(data[0].get("y") or []) +
|
|
111
177
|
(data[1].get("y") or []) +
|
|
112
|
-
(data[4].get("y") or [])
|
|
178
|
+
(data[4].get("y") or []) +
|
|
179
|
+
((trace_6.get("y") or []) if trace_6 else [])
|
|
113
180
|
)
|
|
114
181
|
|
|
115
182
|
if y_values:
|
|
116
|
-
top = layout["margin"]["t"] or layout["template"]["margin"]["t"]
|
|
117
183
|
min_y = getMin(y_values)
|
|
118
184
|
max_y = getMax(y_values)
|
|
119
185
|
|
|
120
186
|
min_y = min_y if min_y < 0 else 0
|
|
121
187
|
max_y = max_y if max_y > 0 else 0
|
|
122
188
|
|
|
123
|
-
nticks = max(int((context.height - top) / 100), 2)
|
|
124
|
-
|
|
125
189
|
step = exact_step(min_y, max_y, nticks)
|
|
126
190
|
|
|
127
191
|
layout["yaxis"]["tickmode"] = "linear"
|