maidr 1.4.8__py3-none-any.whl → 1.4.9__py3-none-any.whl

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.
maidr/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "1.4.8"
1
+ __version__ = "1.4.9"
2
2
 
3
3
  from .api import close, render, save_html, show, stacked
4
4
  from .core import Maidr
@@ -131,20 +131,11 @@ class CandlestickPlot(MaidrPlot):
131
131
 
132
132
  def render(self) -> dict:
133
133
  """Initialize the MAIDR schema dictionary with basic plot information."""
134
- title = "Candlestick Chart"
135
-
136
- # Extract the plot data
137
- plot_data = self._extract_plot_data()
138
-
139
- maidr_schema = {
140
- MaidrKey.TYPE: self.type,
141
- MaidrKey.TITLE: title,
142
- MaidrKey.AXES: self._extract_axes_data(),
143
- MaidrKey.DATA: plot_data,
144
- }
145
-
134
+ base_schema = super().render()
135
+ base_schema[MaidrKey.TITLE] = "Candlestick Chart"
136
+ base_schema[MaidrKey.AXES] = self._extract_axes_data()
137
+ base_schema[MaidrKey.DATA] = self._extract_plot_data()
146
138
  # Include selector only if the plot supports highlighting.
147
139
  if self._support_highlighting:
148
- maidr_schema[MaidrKey.SELECTOR] = self._get_selector()
149
-
150
- return maidr_schema
140
+ base_schema[MaidrKey.SELECTOR] = self._get_selector()
141
+ return base_schema
@@ -5,6 +5,8 @@ from abc import ABC, abstractmethod
5
5
  from matplotlib.axes import Axes
6
6
 
7
7
  from maidr.core.enum import MaidrKey, PlotType
8
+ # uuid is used to generate unique identifiers for each plot layer in the MAIDR schema.
9
+ import uuid
8
10
 
9
11
 
10
12
  class MaidrPlot(ABC):
@@ -55,8 +57,13 @@ class MaidrPlot(ABC):
55
57
  self._schema = {}
56
58
 
57
59
  def render(self) -> dict:
58
- """Initialize the MAIDR schema dictionary with basic plot information."""
60
+ """
61
+ Generate the MAIDR schema for this plot layer, including a unique id for layer identification.
62
+ """
63
+ # Generate a unique UUID for this layer to ensure each plot layer can be distinctly identified
64
+ # in the MAIDR frontend. This supports robust layer switching.
59
65
  maidr_schema = {
66
+ MaidrKey.ID: str(uuid.uuid4()),
60
67
  MaidrKey.TYPE: self.type,
61
68
  MaidrKey.TITLE: self.ax.get_title(),
62
69
  MaidrKey.AXES: self._extract_axes_data(),
@@ -12,6 +12,7 @@ from maidr.util.mixin import (
12
12
  LevelExtractorMixin,
13
13
  )
14
14
  from maidr.util.mplfinance_utils import MplfinanceDataExtractor
15
+ from maidr.core.enum.maidr_key import MaidrKey
15
16
 
16
17
 
17
18
  class MplfinanceBarPlot(
@@ -122,20 +123,10 @@ class MplfinanceBarPlot(
122
123
  return "g[maidr='true'] > path"
123
124
 
124
125
  def render(self) -> dict:
125
- """Initialize the MAIDR schema dictionary with basic plot information."""
126
- from maidr.core.enum.maidr_key import MaidrKey
127
-
128
- title = "Volume Bar Plot"
129
-
130
- maidr_schema = {
131
- MaidrKey.TYPE: self.type,
132
- MaidrKey.TITLE: title,
133
- MaidrKey.AXES: self._extract_axes_data(),
134
- MaidrKey.DATA: self._extract_plot_data(),
135
- }
136
-
137
- # Include selector only if the plot supports highlighting.
126
+ base_schema = super().render()
127
+ base_schema[MaidrKey.TITLE] = "Volume Bar Plot"
128
+ base_schema[MaidrKey.AXES] = self._extract_axes_data()
129
+ base_schema[MaidrKey.DATA] = self._extract_plot_data()
138
130
  if self._support_highlighting:
139
- maidr_schema[MaidrKey.SELECTOR] = self._get_selector()
140
-
141
- return maidr_schema
131
+ base_schema[MaidrKey.SELECTOR] = self._get_selector()
132
+ return base_schema
@@ -179,18 +179,10 @@ class MplfinanceLinePlot(MaidrPlot, LineExtractorMixin):
179
179
  return periods[0] if periods else ""
180
180
 
181
181
  def render(self) -> dict:
182
- """Initialize the MAIDR schema dictionary with basic plot information."""
183
- title = "Moving Average Line Plot"
184
-
185
- maidr_schema = {
186
- MaidrKey.TYPE: self.type,
187
- MaidrKey.TITLE: title,
188
- MaidrKey.AXES: self._extract_axes_data(),
189
- MaidrKey.DATA: self._extract_plot_data(),
190
- }
191
-
192
- # Include selector only if the plot supports highlighting.
182
+ base_schema = super().render()
183
+ base_schema[MaidrKey.TITLE] = "Moving Average Line Plot"
184
+ base_schema[MaidrKey.AXES] = self._extract_axes_data()
185
+ base_schema[MaidrKey.DATA] = self._extract_plot_data()
193
186
  if self._support_highlighting:
194
- maidr_schema[MaidrKey.SELECTOR] = self._get_selector()
195
-
196
- return maidr_schema
187
+ base_schema[MaidrKey.SELECTOR] = self._get_selector()
188
+ return base_schema
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maidr
3
- Version: 1.4.8
3
+ Version: 1.4.9
4
4
  Summary: Multimodal Access and Interactive Data Representations
5
5
  Project-URL: Homepage, https://xability.github.io/py-maidr
6
6
  Project-URL: Repository, https://github.com/xability/py-maidr
@@ -1,4 +1,4 @@
1
- maidr/__init__.py,sha256=L1N9chRSdVzT_lTD4NWEy8u_PJZvtXiORg0Yx4sGQpA,415
1
+ maidr/__init__.py,sha256=0AzqrF7BlIACgUS2NE93eN-kMBN7WBLWnIz8--a4QhY,415
2
2
  maidr/api.py,sha256=F43mXWsxc7tHdlZqbRlEWkc-RjJVo_zgxCn3NiLBY58,1764
3
3
  maidr/core/__init__.py,sha256=WgxLpSEYMc4k3OyEOf1shOxfEq0ASzppEIZYmE91ThQ,25
4
4
  maidr/core/context_manager.py,sha256=6cT7ZGOApSpC-SLD2XZWWU_H08i-nfv-JUlzXOtvWYw,3374
@@ -12,15 +12,15 @@ maidr/core/enum/smooth_keywords.py,sha256=z2kVZZ-mETWWh5reWu_hj9WkJD6WFj7_2-6s1e
12
12
  maidr/core/plot/__init__.py,sha256=xDIpRGM-4DfaSSL3nKcXrjdMecCHJ6en4K4nA_fPefQ,83
13
13
  maidr/core/plot/barplot.py,sha256=0hBgp__putezvxXc9G3qmaktmAzze3cN8pQMD9iqktE,2116
14
14
  maidr/core/plot/boxplot.py,sha256=i11GdNuz_c-hilmhydu3ah-bzyVdFoBkNvRi5lpMrrY,9946
15
- maidr/core/plot/candlestick.py,sha256=0yKeuchDd-BdepKcKo8Dsi6Kl3FoAUqgP7ggMCitsRY,5460
15
+ maidr/core/plot/candlestick.py,sha256=dk1MCU5zqGA2CFLT1_1tGrsB6kYNhsUFLPLNaEi9e04,5363
16
16
  maidr/core/plot/grouped_barplot.py,sha256=_zn4XMeEnSiDHtf6t4-z9ErBqg_CijhAS2CCtlHgYIQ,2077
17
17
  maidr/core/plot/heatmap.py,sha256=yMS-31tS2GW4peds9LtZesMxmmTV_YfqYO5M_t5KasQ,2521
18
18
  maidr/core/plot/histogram.py,sha256=QV5W-6ZJQQcZsrM91JJBX-ONktJzH7yg_et5_bBPfQQ,1525
19
19
  maidr/core/plot/lineplot.py,sha256=48aEkx8rjZ9lYEZSHWCJcSzdVblKwcdJZDZK0vnxmPo,4291
20
- maidr/core/plot/maidr_plot.py,sha256=DN4TTRNt_SCqGa_mbkHrnpCk-eUQm71HoFRqs3bB6xk,3868
20
+ maidr/core/plot/maidr_plot.py,sha256=9T0boWaonM99jggEed97-rCy_cufRMWXrXo-CbmPudE,4230
21
21
  maidr/core/plot/maidr_plot_factory.py,sha256=NW2iFScswgXbAC9rAOo4iMkAFsjY43DAvFioGr0yzx4,2732
22
- maidr/core/plot/mplfinance_barplot.py,sha256=GPjjxdXVvfW0_xBhRZMmgmDNqSKrWLvL6yuonOdfTZk,5208
23
- maidr/core/plot/mplfinance_lineplot.py,sha256=JYuZP-kVEfEC62tMNtzcsy24j57nZuhKT_4_VOnAAB8,6933
22
+ maidr/core/plot/mplfinance_barplot.py,sha256=8H9fKxkLIRiTDMoSjtf87hjFPuP1WCo_mdsyEWBsLjQ,5016
23
+ maidr/core/plot/mplfinance_lineplot.py,sha256=3UP701S8Rz8vjuC5WIEVHnsZMJCo3AoSUrbQG3CBqkM,6750
24
24
  maidr/core/plot/regplot.py,sha256=b7u6bGTz1IxKahplNUrfwIr_OGSwMJ2BuLgFAVjL0s0,2744
25
25
  maidr/core/plot/scatterplot.py,sha256=o0i0uS-wXK9ZrENxneoHbh3-u-2goRONp19Yu9QLsaY,1257
26
26
  maidr/exception/__init__.py,sha256=PzaXoYBhyZxMDcJkuxJugDx7jZeseI0El6LpxIwXyG4,46
@@ -51,7 +51,7 @@ maidr/util/mixin/extractor_mixin.py,sha256=oHtwpmS5kARvaLrSO3DKTPQxyFUw9nOcKN7rz
51
51
  maidr/util/mixin/merger_mixin.py,sha256=V0qLw_6DUB7X6CQ3BCMpsCQX_ZuwAhoSTm_E4xAJFKM,712
52
52
  maidr/widget/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  maidr/widget/shiny.py,sha256=wrrw2KAIpE_A6CNQGBtNHauR1DjenA_n47qlFXX9_rk,745
54
- maidr-1.4.8.dist-info/METADATA,sha256=k2BDw4pB46XBISkX40QpD60gI2cF6_l1lxP97uxNhMQ,3094
55
- maidr-1.4.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- maidr-1.4.8.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
57
- maidr-1.4.8.dist-info/RECORD,,
54
+ maidr-1.4.9.dist-info/METADATA,sha256=9R65faA9dvYv3s83nu0t9lUNF3eVCYRpnaU0y8bVpF8,3094
55
+ maidr-1.4.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
+ maidr-1.4.9.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
57
+ maidr-1.4.9.dist-info/RECORD,,
File without changes