flet-charts 0.2.0.dev35__py3-none-any.whl → 0.70.0.dev6555__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.

Potentially problematic release.


This version of flet-charts might be problematic. Click here for more details.

Files changed (46) hide show
  1. flet_charts/__init__.py +59 -17
  2. flet_charts/bar_chart.py +87 -30
  3. flet_charts/bar_chart_group.py +1 -2
  4. flet_charts/bar_chart_rod.py +36 -5
  5. flet_charts/candlestick_chart.py +269 -0
  6. flet_charts/candlestick_chart_spot.py +98 -0
  7. flet_charts/chart_axis.py +29 -9
  8. flet_charts/line_chart.py +76 -14
  9. flet_charts/line_chart_data.py +30 -5
  10. flet_charts/line_chart_data_point.py +33 -4
  11. flet_charts/matplotlib_backends/backend_flet_agg.py +16 -0
  12. flet_charts/matplotlib_chart.py +396 -36
  13. flet_charts/matplotlib_chart_with_toolbar.py +125 -0
  14. flet_charts/pie_chart.py +3 -6
  15. flet_charts/pie_chart_section.py +29 -18
  16. flet_charts/plotly_chart.py +17 -6
  17. flet_charts/radar_chart.py +214 -0
  18. flet_charts/radar_data_set.py +66 -0
  19. flet_charts/scatter_chart.py +75 -29
  20. flet_charts/scatter_chart_spot.py +44 -6
  21. flet_charts/types.py +159 -16
  22. flet_charts-0.70.0.dev6555.dist-info/METADATA +67 -0
  23. flet_charts-0.70.0.dev6555.dist-info/RECORD +47 -0
  24. flutter/flet_charts/CHANGELOG.md +1 -1
  25. flutter/flet_charts/LICENSE +1 -1
  26. flutter/flet_charts/analysis_options.yaml +1 -1
  27. flutter/flet_charts/lib/src/bar_chart.dart +2 -0
  28. flutter/flet_charts/lib/src/candlestick_chart.dart +129 -0
  29. flutter/flet_charts/lib/src/extension.dart +6 -0
  30. flutter/flet_charts/lib/src/radar_chart.dart +104 -0
  31. flutter/flet_charts/lib/src/scatter_chart.dart +22 -21
  32. flutter/flet_charts/lib/src/utils/bar_chart.dart +137 -73
  33. flutter/flet_charts/lib/src/utils/candlestick_chart.dart +118 -0
  34. flutter/flet_charts/lib/src/utils/charts.dart +12 -0
  35. flutter/flet_charts/lib/src/utils/line_chart.dart +15 -3
  36. flutter/flet_charts/lib/src/utils/pie_chart.dart +2 -1
  37. flutter/flet_charts/lib/src/utils/radar_chart.dart +90 -0
  38. flutter/flet_charts/lib/src/utils/scatter_chart.dart +22 -21
  39. flutter/flet_charts/pubspec.lock +85 -71
  40. flutter/flet_charts/pubspec.yaml +10 -9
  41. flet_charts-0.2.0.dev35.dist-info/METADATA +0 -69
  42. flet_charts-0.2.0.dev35.dist-info/RECORD +0 -38
  43. flutter/flet_charts/README.md +0 -3
  44. {flet_charts-0.2.0.dev35.dist-info → flet_charts-0.70.0.dev6555.dist-info}/WHEEL +0 -0
  45. {flet_charts-0.2.0.dev35.dist-info → flet_charts-0.70.0.dev6555.dist-info}/licenses/LICENSE +0 -0
  46. {flet_charts-0.2.0.dev35.dist-info → flet_charts-0.70.0.dev6555.dist-info}/top_level.txt +0 -0
flet_charts/types.py CHANGED
@@ -10,10 +10,10 @@ __all__ = [
10
10
  "ChartDataPointTooltip",
11
11
  "ChartEventType",
12
12
  "ChartGridLines",
13
- "ChartHorizontalAlignment",
14
13
  "ChartPointLine",
15
14
  "ChartPointShape",
16
15
  "ChartSquarePoint",
16
+ "HorizontalAlignment",
17
17
  ]
18
18
 
19
19
 
@@ -45,6 +45,26 @@ class ChartGridLines:
45
45
  followed by blank spaces 10 pixels long. By default, a solid line is drawn.
46
46
  """
47
47
 
48
+ def copy(
49
+ self,
50
+ *,
51
+ interval: Optional[ft.Number] = None,
52
+ color: Optional[ft.ColorValue] = None,
53
+ width: Optional[ft.Number] = None,
54
+ dash_pattern: Optional[list[int]] = None,
55
+ ) -> "ChartGridLines":
56
+ """
57
+ Returns a copy of this object with the specified properties overridden.
58
+ """
59
+ return ChartGridLines(
60
+ interval=interval if interval is not None else self.interval,
61
+ color=color if color is not None else self.color,
62
+ width=width if width is not None else self.width,
63
+ dash_pattern=dash_pattern.copy()
64
+ if dash_pattern is not None
65
+ else (self.dash_pattern.copy() if self.dash_pattern is not None else None),
66
+ )
67
+
48
68
 
49
69
  @dataclass
50
70
  class ChartPointShape:
@@ -88,6 +108,28 @@ class ChartCirclePoint(ChartPointShape):
88
108
  def __post_init__(self):
89
109
  self._type = "ChartCirclePoint"
90
110
 
111
+ def copy(
112
+ self,
113
+ *,
114
+ color: Optional[ft.ColorValue] = None,
115
+ radius: Optional[ft.Number] = None,
116
+ stroke_color: Optional[ft.ColorValue] = None,
117
+ stroke_width: Optional[ft.Number] = None,
118
+ ) -> "ChartCirclePoint":
119
+ """
120
+ Returns a copy of this object with the specified properties overridden.
121
+ """
122
+ return ChartCirclePoint(
123
+ color=color if color is not None else self.color,
124
+ radius=radius if radius is not None else self.radius,
125
+ stroke_color=stroke_color
126
+ if stroke_color is not None
127
+ else self.stroke_color,
128
+ stroke_width=stroke_width
129
+ if stroke_width is not None
130
+ else self.stroke_width,
131
+ )
132
+
91
133
 
92
134
  @dataclass
93
135
  class ChartSquarePoint(ChartPointShape):
@@ -116,10 +158,32 @@ class ChartSquarePoint(ChartPointShape):
116
158
  def __post_init__(self):
117
159
  self._type = "ChartSquarePoint"
118
160
 
161
+ def copy(
162
+ self,
163
+ *,
164
+ color: Optional[ft.ColorValue] = None,
165
+ size: Optional[ft.Number] = None,
166
+ stroke_color: Optional[ft.ColorValue] = None,
167
+ stroke_width: Optional[ft.Number] = None,
168
+ ) -> "ChartSquarePoint":
169
+ """
170
+ Returns a copy of this object with the specified properties overridden.
171
+ """
172
+ return ChartSquarePoint(
173
+ color=color if color is not None else self.color,
174
+ size=size if size is not None else self.size,
175
+ stroke_color=stroke_color
176
+ if stroke_color is not None
177
+ else self.stroke_color,
178
+ stroke_width=stroke_width
179
+ if stroke_width is not None
180
+ else self.stroke_width,
181
+ )
182
+
119
183
 
120
184
  @dataclass
121
185
  class ChartCrossPoint(ChartPointShape):
122
- """Draws a cross-mark(X)."""
186
+ """Draws a cross-mark (X)."""
123
187
 
124
188
  color: Optional[ft.ColorValue] = None
125
189
  """
@@ -140,10 +204,26 @@ class ChartCrossPoint(ChartPointShape):
140
204
  def __post_init__(self):
141
205
  self._type = "ChartCrossPoint"
142
206
 
207
+ def copy(
208
+ self,
209
+ *,
210
+ color: Optional[ft.ColorValue] = None,
211
+ size: Optional[ft.Number] = None,
212
+ width: Optional[ft.Number] = None,
213
+ ) -> "ChartCrossPoint":
214
+ """
215
+ Returns a copy of this object with the specified properties overridden.
216
+ """
217
+ return ChartCrossPoint(
218
+ color=color if color is not None else self.color,
219
+ size=size if size is not None else self.size,
220
+ width=width if width is not None else self.width,
221
+ )
222
+
143
223
 
144
224
  @dataclass
145
225
  class ChartPointLine:
146
- """"""
226
+ """Defines style of a line."""
147
227
 
148
228
  color: Optional[ft.ColorValue] = None
149
229
  """
@@ -160,6 +240,33 @@ class ChartPointLine:
160
240
  The line's dash pattern.
161
241
  """
162
242
 
243
+ gradient: Optional[ft.Gradient] = None
244
+ """
245
+ The line's gradient.
246
+ """
247
+
248
+ def copy(
249
+ self,
250
+ *,
251
+ color: Optional[ft.ColorValue] = None,
252
+ width: Optional[ft.Number] = None,
253
+ dash_pattern: Optional[list[int]] = None,
254
+ gradient: Optional[ft.Gradient] = None,
255
+ ) -> "ChartPointLine":
256
+ """
257
+ Returns a copy of this object with the specified properties overridden.
258
+ """
259
+ return ChartPointLine(
260
+ color=color if color is not None else self.color,
261
+ width=width if width is not None else self.width,
262
+ dash_pattern=dash_pattern.copy()
263
+ if dash_pattern is not None
264
+ else self.dash_pattern.copy()
265
+ if self.dash_pattern is not None
266
+ else None,
267
+ gradient=gradient if gradient is not None else self.gradient,
268
+ )
269
+
163
270
 
164
271
  class ChartEventType(Enum):
165
272
  """The type of event that occurred on the chart."""
@@ -200,47 +307,54 @@ class ChartEventType(Enum):
200
307
 
201
308
  POINTER_ENTER = "pointerEnter"
202
309
  """
203
-
310
+ The pointer has moved with respect to the device while the pointer is or is
311
+ not in contact with the device, and it has entered our chart.
204
312
  """
205
313
 
206
314
  POINTER_HOVER = "pointerHover"
207
315
  """
208
-
316
+ The pointer has moved with respect to the device while the pointer is not
317
+ in contact with the device.
209
318
  """
210
319
 
211
320
  PAN_DOWN = "panDown"
212
321
  """
213
-
322
+ When a pointer has contacted the screen and might begin to move
214
323
  """
215
324
 
216
325
  PAN_START = "panStart"
217
326
  """
218
-
327
+ When a pointer has contacted the screen and has begun to move.
219
328
  """
220
329
 
221
330
  PAN_UPDATE = "panUpdate"
222
331
  """
223
-
332
+ When a pointer that is in contact with the screen and moving
333
+ has moved again.
224
334
  """
225
335
 
226
336
  LONG_PRESS_MOVE_UPDATE = "longPressMoveUpdate"
227
337
  """
228
-
338
+ When a pointer is moving after being held in contact at the same
339
+ location for a long period of time. Reports the new position and its offset
340
+ from the original down position.
229
341
  """
230
342
 
231
343
  LONG_PRESS_START = "longPressStart"
232
344
  """
233
-
345
+ When a pointer has remained in contact with the screen at the
346
+ same location for a long period of time.
234
347
  """
235
348
 
236
349
  TAP_DOWN = "tapDown"
237
350
  """
238
-
351
+ When a pointer that might cause a tap has contacted the
352
+ screen.
239
353
  """
240
354
 
241
355
  UNDEFINED = "undefined"
242
356
  """
243
-
357
+ An undefined event.
244
358
  """
245
359
 
246
360
 
@@ -252,7 +366,7 @@ class ChartDataPointTooltip:
252
366
 
253
367
  text: Optional[str] = None
254
368
  """
255
- The text to display in the tooltip.
369
+ The text to display in this tooltip.
256
370
  """
257
371
 
258
372
  text_style: ft.TextStyle = field(default_factory=lambda: ft.TextStyle())
@@ -262,16 +376,45 @@ class ChartDataPointTooltip:
262
376
 
263
377
  text_align: ft.TextAlign = ft.TextAlign.CENTER
264
378
  """
265
- An align for the tooltip.
379
+ The text alignment of the tooltip.
266
380
  """
267
381
 
268
382
  text_spans: Optional[list[ft.TextSpan]] = None
269
383
  """
270
- Additional text spans to show on a tooltip.
384
+ Additional text spans to show on this tooltip.
385
+ """
386
+
387
+ rtl: bool = False
271
388
  """
389
+ Whether the text is right-to-left.
390
+ """
391
+
392
+ def copy(
393
+ self,
394
+ *,
395
+ text: Optional[str] = None,
396
+ text_style: Optional[ft.TextStyle] = None,
397
+ text_align: Optional[ft.TextAlign] = None,
398
+ text_spans: Optional[list[ft.TextSpan]] = None,
399
+ rtl: Optional[bool] = None,
400
+ ) -> "ChartDataPointTooltip":
401
+ """
402
+ Returns a copy of this object with the specified properties overridden.
403
+ """
404
+ return ChartDataPointTooltip(
405
+ text=text if text is not None else self.text,
406
+ text_style=text_style if text_style is not None else self.text_style,
407
+ text_align=text_align if text_align is not None else self.text_align,
408
+ text_spans=text_spans.copy()
409
+ if text_spans is not None
410
+ else self.text_spans.copy()
411
+ if self.text_spans is not None
412
+ else None,
413
+ rtl=rtl if rtl is not None else self.rtl,
414
+ )
272
415
 
273
416
 
274
- class ChartHorizontalAlignment(Enum):
417
+ class HorizontalAlignment(Enum):
275
418
  """Defines an element's horizontal alignment to given point."""
276
419
 
277
420
  LEFT = "left"
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-charts
3
+ Version: 0.70.0.dev6555
4
+ Summary: Interactive chart controls for Flet apps.
5
+ Author-email: Flet contributors <hello@flet.dev>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://flet.dev
8
+ Project-URL: Documentation, https://docs.flet.dev/charts
9
+ Project-URL: Repository, https://github.com/flet-dev/flet/tree/main/sdk/python/packages/flet-charts
10
+ Project-URL: Issues, https://github.com/flet-dev/flet/issues
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: flet==0.70.0.dev6555
15
+ Dynamic: license-file
16
+
17
+ # flet-charts
18
+
19
+ [![pypi](https://img.shields.io/pypi/v/flet-charts.svg)](https://pypi.python.org/pypi/flet-charts)
20
+ [![downloads](https://static.pepy.tech/badge/flet-charts/month)](https://pepy.tech/project/flet-charts)
21
+ [![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-charts/LICENSE)
22
+
23
+ A [Flet](https://flet.dev) extension for creating interactive charts and graphs.
24
+
25
+ It is based on the [fl_chart](https://pub.dev/packages/fl_chart) Flutter package.
26
+
27
+ ## Documentation
28
+
29
+ Detailed documentation to this package can be found [here](https://docs.flet.dev/charts/).
30
+
31
+ ## Platform Support
32
+
33
+ | Platform | Windows | macOS | Linux | iOS | Android | Web |
34
+ |----------|---------|-------|-------|-----|---------|-----|
35
+ | Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
36
+
37
+ ## Usage
38
+
39
+ ### Installation
40
+
41
+ To install the `flet-charts` package and add it to your project dependencies:
42
+
43
+ - Using `uv`:
44
+ ```bash
45
+ uv add flet-charts
46
+ ```
47
+
48
+ - Using `pip`:
49
+ ```bash
50
+ pip install flet-charts
51
+ ```
52
+ After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
53
+
54
+ ### Examples
55
+
56
+ For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/charts).
57
+
58
+ ### Available charts
59
+
60
+ - [`BarChart`](https://docs.flet.dev/charts/bar_chart/)
61
+ - [`CandlestickChart`](https://docs.flet.dev/charts/candlestick_chart/)
62
+ - [`LineChart`](https://docs.flet.dev/charts/line_chart/)
63
+ - [`MatplotlibChart`](https://docs.flet.dev/charts/matplotlib_chart/)
64
+ - [`PieChart`](https://docs.flet.dev/charts/pie_chart/)
65
+ - [`PlotlyChart`](https://docs.flet.dev/charts/plotly_chart/)
66
+ - [`RadarChart`](https://docs.flet.dev/charts/radar_chart/)
67
+ - [`ScatterChart`](https://docs.flet.dev/charts/scatter_chart/)
@@ -0,0 +1,47 @@
1
+ flet_charts/__init__.py,sha256=9dO2t_hyMgmUsuFberHjdKd0_RDAK856w4lwmWZab4I,3136
2
+ flet_charts/bar_chart.py,sha256=0HQq_FDNYq4X_vWUmEALUqpidmJZo5kxIEWa4QGVQb0,7650
3
+ flet_charts/bar_chart_group.py,sha256=g8JGjaxQMDFGozE1BTQXBaiCynFYTTOVlB1kTzGvB8I,701
4
+ flet_charts/bar_chart_rod.py,sha256=hBMPwprgJWZhryKTFHaOwbHIiKq2uQzPyCKG7-mS8go,3574
5
+ flet_charts/bar_chart_rod_stack_item.py,sha256=XPLRpHdScmdde2UAau47OLSSL-AuQUbLpT1g7pNS9kI,623
6
+ flet_charts/candlestick_chart.py,sha256=j-mziQRijZKvrzk1dhsgyM7khoYQCwQ8XAbCw8rRUEM,7588
7
+ flet_charts/candlestick_chart_spot.py,sha256=ti4R_IgQb2zyU64aeHx3s2uADI-INl0_J7sGohZaIPY,2749
8
+ flet_charts/chart_axis.py,sha256=VHA9XjmFkpKoq03U3N6xmzzrAtNldBhCegv41JpBcYo,1875
9
+ flet_charts/line_chart.py,sha256=A7Y0LqHFw-iLiFtATZLIGXOpvvueiGFiSdf3fLfHtIA,7979
10
+ flet_charts/line_chart_data.py,sha256=fjMDsT4cx-XNQUcG_r2CBov5eOV6IgtNZ7defqFyJxM,4165
11
+ flet_charts/line_chart_data_point.py,sha256=Qn9Wk72blqg45c31vQzTeH1_Q-Eq1jIPYJGdXg6Dl0o,3254
12
+ flet_charts/matplotlib_chart.py,sha256=KR3YtNz8D8OXYtNZs_xUQEkCWl3o77oFe7dnVaePog0,14396
13
+ flet_charts/matplotlib_chart_with_toolbar.py,sha256=6djycLXdKRyOjpUOSuu9iFYGwUVf0SowOfbJ-rooMa4,3955
14
+ flet_charts/pie_chart.py,sha256=boJ01MiDN1lWYFQIW497P5MNdih53ZdWcB7ce734dvQ,1963
15
+ flet_charts/pie_chart_section.py,sha256=z8d0QLYy2VWYgRByBkcMRBOAPvE2Bh14takcg4oQ9PM,2592
16
+ flet_charts/plotly_chart.py,sha256=qbbKh1W60XgpE702f9o2TsrE1iLL-oSJ_xTkTemplyU,2028
17
+ flet_charts/radar_chart.py,sha256=FtTNRVFFuvSk5aO2vbd3jnGHTVbCykbvIh2K6yHHkTg,5568
18
+ flet_charts/radar_data_set.py,sha256=SL-cHto0wJIgC8-x8xMIczST_ZOmho7yDAQd7kdg400,1479
19
+ flet_charts/scatter_chart.py,sha256=q_YY0AZwI_xXQye53HWEmedjTI33kSfITf-6xsC4XXQ,7040
20
+ flet_charts/scatter_chart_spot.py,sha256=4iqndp_G1eNiH2IUtW7PCIc_XPxEDm04fDqqPwQxOiY,3698
21
+ flet_charts/types.py,sha256=0VNeobnKFjM5F164yqH81qGJVbtewhJEGAygMWy7SCs,11121
22
+ flet_charts/matplotlib_backends/backend_flet_agg.py,sha256=1imjpVpAexu02v96_jWlTPHhXdHMztPllTvHjnxDT78,483
23
+ flet_charts-0.70.0.dev6555.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ flutter/flet_charts/CHANGELOG.md,sha256=tLc4Pl32-dWgzs4OPKaUerLsnLo1u3yVWKU9qjyazf0,41
25
+ flutter/flet_charts/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
+ flutter/flet_charts/analysis_options.yaml,sha256=x4UkoVEHV7h6exoZk7csc1_nfwEhkWpL7L8itHPuwLY,155
27
+ flutter/flet_charts/pubspec.lock,sha256=F6Vcfv0_aWx1G_780Vlq-LN8t2_FD08uq7kENT5XYGE,23426
28
+ flutter/flet_charts/pubspec.yaml,sha256=N5gRkctY8H17u1ZLU8i0IkUnLC4GkodZ8Bdw5hnG6xM,419
29
+ flutter/flet_charts/lib/flet_charts.dart,sha256=66hr4Shizat1MIyu957NiJI_xXYOSeOJbFI489qw7ok,70
30
+ flutter/flet_charts/lib/src/bar_chart.dart,sha256=6K_WPR4NzI_C9dor0eblESZi5hdf6PpKGD6xTml9KDI,3683
31
+ flutter/flet_charts/lib/src/candlestick_chart.dart,sha256=kS9Bp2O109J6-yXHiSpmmG3EtKHR8TkDINu3NVQeWNw,4723
32
+ flutter/flet_charts/lib/src/extension.dart,sha256=ggbe5hADBtKCRHvub3eFM8IXE7vCRwAAthXlaCFk-VY,948
33
+ flutter/flet_charts/lib/src/line_chart.dart,sha256=iij6QsZG0PgSCnZoK9YHQTwH7nJnM1_pNrb2zt-Mtk8,8733
34
+ flutter/flet_charts/lib/src/pie_chart.dart,sha256=WQWrUcPjTj2ywUtA2ZwAwRmzv1mouS17Hj-uSOJtD-c,2384
35
+ flutter/flet_charts/lib/src/radar_chart.dart,sha256=5kO5UZKbBHku398NNXO7RpT5o2rs7tq_OY7AyuYLH6U,3962
36
+ flutter/flet_charts/lib/src/scatter_chart.dart,sha256=CVdnTNlXmQZxonjs2e0jXAGGMs1LT1e4iujTEkopTII,5541
37
+ flutter/flet_charts/lib/src/utils/bar_chart.dart,sha256=_rbR4HgB02_vVpD2qLwCm5ixUgQXlWMvcxvc_fAJZQU,7156
38
+ flutter/flet_charts/lib/src/utils/candlestick_chart.dart,sha256=lQU7efQNF_XA8_X1B9SZUyKUuwcQ_Pd9kiwCdNaTONg,3686
39
+ flutter/flet_charts/lib/src/utils/charts.dart,sha256=5Umt7NIzHp9UBDdIQ_8YQCxn8vQs8nC1NtpKzJ7aC64,6479
40
+ flutter/flet_charts/lib/src/utils/line_chart.dart,sha256=s_9iokaUFHNipu_YVw6OSJcmD8JctWCoImrIyuxB688,8633
41
+ flutter/flet_charts/lib/src/utils/pie_chart.dart,sha256=vSVKViXv7zFIb-As5I0ZxFNTA9L1whKilDbAbqOZQ1w,1842
42
+ flutter/flet_charts/lib/src/utils/radar_chart.dart,sha256=AK4aVdE0rRqq7R1q7scPa_mi0XXoV-GpNYXjCAi038E,2833
43
+ flutter/flet_charts/lib/src/utils/scatter_chart.dart,sha256=KqJxvpl8jIZkQw132Ab4x4nhHTyiUw8M2NExgRCXf1k,3323
44
+ flet_charts-0.70.0.dev6555.dist-info/METADATA,sha256=N4hH3Jn_I2BMotmNLta-XPi99LmcwDHiIgMi_RphMco,2443
45
+ flet_charts-0.70.0.dev6555.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ flet_charts-0.70.0.dev6555.dist-info/top_level.txt,sha256=CVHmtljbPFTyfCiru5bxX1vvWL8L6rtUbV9bqqkSxFE,20
47
+ flet_charts-0.70.0.dev6555.dist-info/RECORD,,
@@ -1,3 +1,3 @@
1
1
  # 0.2.0
2
2
 
3
- Initial release of the package.
3
+ Initial release of the package.
@@ -198,4 +198,4 @@
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
199
199
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
  See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
@@ -2,4 +2,4 @@ include: package:flutter_lints/flutter.yaml
2
2
 
3
3
 
4
4
  # Additional information about this file can be found at
5
- # https://dart.dev/guides/language/analysis-options
5
+ # https://dart.dev/guides/language/analysis-options
@@ -57,6 +57,8 @@ class _BarChartControlState extends State<BarChartControl> {
57
57
  bottomTitles: bottomTitles,
58
58
  ),
59
59
  borderData: FlBorderData(show: border != null, border: border),
60
+ alignment: parseBarChartAlignment(
61
+ widget.control.getMainAxisAlignment("group_alignment")?.name),
60
62
  gridData: parseChartGridData(
61
63
  widget.control.get("horizontal_grid_lines"),
62
64
  widget.control.get("vertical_grid_lines"),
@@ -0,0 +1,129 @@
1
+ import 'package:fl_chart/fl_chart.dart';
2
+ import 'package:flet/flet.dart';
3
+ import 'package:flutter/material.dart';
4
+
5
+ import 'utils/candlestick_chart.dart';
6
+ import 'utils/charts.dart';
7
+
8
+ class CandlestickChartControl extends StatefulWidget {
9
+ final Control control;
10
+
11
+ CandlestickChartControl({Key? key, required this.control})
12
+ : super(key: ValueKey("control_${control.id}"));
13
+
14
+ @override
15
+ State<CandlestickChartControl> createState() =>
16
+ _CandlestickChartControlState();
17
+ }
18
+
19
+ class _CandlestickChartControlState extends State<CandlestickChartControl> {
20
+ CandlestickChartEventData? _eventData;
21
+
22
+ @override
23
+ Widget build(BuildContext context) {
24
+ debugPrint("CandlestickChart build: ${widget.control.id}");
25
+
26
+ final theme = Theme.of(context);
27
+ final animation = widget.control.getAnimation(
28
+ "animation",
29
+ ImplicitAnimationDetails(
30
+ duration: const Duration(milliseconds: 150),
31
+ curve: Curves.linear))!;
32
+ final border = widget.control.getBorder("border", theme);
33
+
34
+ final leftTitles = parseAxisTitles(widget.control.child("left_axis"));
35
+ final topTitles = parseAxisTitles(widget.control.child("top_axis"));
36
+ final rightTitles = parseAxisTitles(widget.control.child("right_axis"));
37
+ final bottomTitles = parseAxisTitles(widget.control.child("bottom_axis"));
38
+
39
+ final interactive = widget.control.getBool("interactive", true)!;
40
+
41
+ final spotControls = widget.control.children("spots");
42
+ final candlestickSpots = spotControls.map((spot) {
43
+ spot.notifyParent = true;
44
+ return CandlestickSpot(
45
+ x: spot.getDouble("x", 0)!,
46
+ open: spot.getDouble("open", 0)!,
47
+ high: spot.getDouble("high", 0)!,
48
+ low: spot.getDouble("low", 0)!,
49
+ close: spot.getDouble("close", 0)!,
50
+ show: spot.visible,
51
+ );
52
+ }).toList();
53
+
54
+ final candlestickTouchData = CandlestickTouchData(
55
+ enabled: interactive && !widget.control.disabled,
56
+ handleBuiltInTouches: !widget.control
57
+ .getBool("show_tooltips_for_selected_spots_only", false)!,
58
+ longPressDuration: widget.control.getDuration("long_press_duration"),
59
+ touchSpotThreshold: widget.control.getDouble("touch_spot_threshold", 4)!,
60
+ touchTooltipData: parseCandlestickTouchTooltipData(
61
+ context,
62
+ widget.control,
63
+ spotControls,
64
+ ),
65
+ touchCallback: widget.control.getBool("on_event", false)!
66
+ ? (event, response) {
67
+ final eventData =
68
+ CandlestickChartEventData.fromDetails(event, response);
69
+ if (eventData != _eventData) {
70
+ _eventData = eventData;
71
+ widget.control.triggerEvent("event", eventData.toMap());
72
+ }
73
+ }
74
+ : null,
75
+ );
76
+
77
+ final chart = CandlestickChart(
78
+ CandlestickChartData(
79
+ candlestickSpots: candlestickSpots,
80
+ backgroundColor: widget.control.getColor("bgcolor", context),
81
+ minX: widget.control.getDouble("min_x"),
82
+ maxX: widget.control.getDouble("max_x"),
83
+ baselineX: widget.control.getDouble("baseline_x"),
84
+ minY: widget.control.getDouble("min_y"),
85
+ maxY: widget.control.getDouble("max_y"),
86
+ baselineY: widget.control.getDouble("baseline_y"),
87
+ titlesData: FlTitlesData(
88
+ show: (leftTitles.sideTitles.showTitles ||
89
+ topTitles.sideTitles.showTitles ||
90
+ rightTitles.sideTitles.showTitles ||
91
+ bottomTitles.sideTitles.showTitles),
92
+ leftTitles: leftTitles,
93
+ topTitles: topTitles,
94
+ rightTitles: rightTitles,
95
+ bottomTitles: bottomTitles,
96
+ ),
97
+ borderData: FlBorderData(show: border != null, border: border),
98
+ gridData: parseChartGridData(
99
+ widget.control.get("horizontal_grid_lines"),
100
+ widget.control.get("vertical_grid_lines"),
101
+ theme),
102
+ candlestickTouchData: candlestickTouchData,
103
+ showingTooltipIndicators: spotControls
104
+ .asMap()
105
+ .entries
106
+ .where((e) => e.value.getBool("selected", false)!)
107
+ .map((e) => e.key)
108
+ .toList(),
109
+ rotationQuarterTurns:
110
+ widget.control.getInt("rotation_quarter_turns", 0)!,
111
+ ),
112
+ duration: animation.duration,
113
+ curve: animation.curve,
114
+ );
115
+
116
+ return ConstrainedControl(
117
+ control: widget.control,
118
+ child: LayoutBuilder(
119
+ builder: (BuildContext context, BoxConstraints constraints) {
120
+ return (constraints.maxHeight == double.infinity)
121
+ ? ConstrainedBox(
122
+ constraints: const BoxConstraints(maxHeight: 300),
123
+ child: chart,
124
+ )
125
+ : chart;
126
+ }),
127
+ );
128
+ }
129
+ }
@@ -2,7 +2,9 @@ import 'package:flet/flet.dart';
2
2
  import 'package:flutter/material.dart';
3
3
 
4
4
  import 'bar_chart.dart';
5
+ import 'candlestick_chart.dart';
5
6
  import 'line_chart.dart';
7
+ import 'radar_chart.dart';
6
8
  import 'pie_chart.dart';
7
9
  import 'scatter_chart.dart';
8
10
 
@@ -12,8 +14,12 @@ class Extension extends FletExtension {
12
14
  switch (control.type) {
13
15
  case "BarChart":
14
16
  return BarChartControl(key: key, control: control);
17
+ case "CandlestickChart":
18
+ return CandlestickChartControl(key: key, control: control);
15
19
  case "LineChart":
16
20
  return LineChartControl(key: key, control: control);
21
+ case "RadarChart":
22
+ return RadarChartControl(key: key, control: control);
17
23
  case "PieChart":
18
24
  return PieChartControl(key: key, control: control);
19
25
  case "ScatterChart":
@@ -0,0 +1,104 @@
1
+ import 'package:fl_chart/fl_chart.dart';
2
+ import 'package:flet/flet.dart';
3
+ import 'package:flutter/material.dart';
4
+
5
+ import 'utils/radar_chart.dart';
6
+
7
+ class RadarChartControl extends StatefulWidget {
8
+ final Control control;
9
+
10
+ RadarChartControl({Key? key, required this.control})
11
+ : super(key: ValueKey("control_${control.id}"));
12
+
13
+ @override
14
+ State<RadarChartControl> createState() => _RadarChartControlState();
15
+ }
16
+
17
+ class _RadarChartControlState extends State<RadarChartControl> {
18
+ RadarChartEventData? _eventData;
19
+
20
+ @override
21
+ Widget build(BuildContext context) {
22
+ debugPrint("RadarChart build: ${widget.control.id}‚");
23
+
24
+ final theme = Theme.of(context);
25
+ final animation = widget.control.getAnimation(
26
+ "animation",
27
+ ImplicitAnimationDetails(
28
+ duration: const Duration(milliseconds: 150),
29
+ curve: Curves.linear))!;
30
+ final interactive = widget.control.getBool("interactive", true)! &&
31
+ !widget.control.disabled;
32
+ final border = widget.control.getBorder("border", theme);
33
+ final titleControls = widget.control.children("titles", visibleOnly: false);
34
+
35
+ final chart = RadarChart(
36
+ RadarChartData(
37
+ dataSets: widget.control
38
+ .children("data_sets")
39
+ .map((ds) => parseRadarDataSet(ds, theme, context))
40
+ .toList(),
41
+
42
+ // Radar and borders
43
+ radarBackgroundColor: widget.control
44
+ .getColor("radar_bgcolor", context, Colors.transparent)!,
45
+ radarBorderData: widget.control.getBorderSide(
46
+ "radar_border_side", theme,
47
+ defaultValue: const BorderSide(width: 2))!,
48
+ radarShape: parseRadarShape(
49
+ widget.control.get("radar_shape"), RadarShape.polygon)!,
50
+ borderData: FlBorderData(show: border != null, border: border),
51
+ gridBorderData: widget.control.getBorderSide("grid_border_side", theme,
52
+ defaultValue: const BorderSide(width: 2))!,
53
+
54
+ // Titles
55
+ titleTextStyle: widget.control.getTextStyle("title_text_style", theme),
56
+ titlePositionPercentageOffset:
57
+ widget.control.getDouble("title_position_percentage_offset", 0.2)!,
58
+ getTitle: titleControls.isNotEmpty
59
+ ? (int index, double angle) {
60
+ if (index >= titleControls.length) {
61
+ return RadarChartTitle(text: '', angle: angle);
62
+ }
63
+ final ctrl = titleControls[index];
64
+ return parseRadarChartTitle(ctrl, theme, angle);
65
+ }
66
+ : null,
67
+
68
+ // Ticks
69
+ tickCount: widget.control.getInt("tick_count", 1)!,
70
+ ticksTextStyle: widget.control.getTextStyle("ticks_text_style", theme),
71
+ tickBorderData: widget.control.getBorderSide("tick_border_side", theme,
72
+ defaultValue: const BorderSide(width: 2))!,
73
+ isMinValueAtCenter: widget.control.getBool("center_min_value", false)!,
74
+
75
+ // Interaction
76
+ radarTouchData: RadarTouchData(
77
+ enabled: interactive,
78
+ longPressDuration: widget.control.getDuration("long_press_duration"),
79
+ touchSpotThreshold: widget.control.getDouble("touch_spot_threshold"),
80
+ touchCallback: (event, response) {
81
+ final eventData = RadarChartEventData.fromDetails(event, response);
82
+ if (eventData != _eventData) {
83
+ _eventData = eventData;
84
+ widget.control.triggerEvent("event", eventData.toMap());
85
+ }
86
+ },
87
+ ),
88
+ ),
89
+ duration: animation.duration,
90
+ curve: animation.curve,
91
+ );
92
+
93
+ return ConstrainedControl(
94
+ control: widget.control,
95
+ child: LayoutBuilder(
96
+ builder: (BuildContext context, BoxConstraints constraints) {
97
+ return (constraints.maxHeight == double.infinity)
98
+ ? ConstrainedBox(
99
+ constraints: const BoxConstraints(maxHeight: 300),
100
+ child: chart)
101
+ : chart;
102
+ }));
103
+ }
104
+ }