flet-charts 0.2.0.dev534__tar.gz → 0.70.0.dev6551__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.
Files changed (56) hide show
  1. {flet_charts-0.2.0.dev534/src/flet_charts.egg-info → flet_charts-0.70.0.dev6551}/PKG-INFO +20 -11
  2. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/README.md +14 -5
  3. flet_charts-0.70.0.dev6551/pyproject.toml +24 -0
  4. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/__init__.py +30 -3
  5. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/bar_chart.py +7 -8
  6. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/bar_chart_group.py +0 -1
  7. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/bar_chart_rod.py +0 -1
  8. flet_charts-0.70.0.dev6551/src/flet_charts/candlestick_chart.py +269 -0
  9. flet_charts-0.70.0.dev6551/src/flet_charts/candlestick_chart_spot.py +98 -0
  10. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/chart_axis.py +3 -3
  11. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/line_chart.py +4 -5
  12. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/line_chart_data.py +2 -3
  13. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/line_chart_data_point.py +1 -2
  14. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/matplotlib_chart.py +54 -12
  15. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/matplotlib_chart_with_toolbar.py +18 -3
  16. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/pie_chart.py +0 -1
  17. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/pie_chart_section.py +20 -18
  18. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/plotly_chart.py +15 -5
  19. flet_charts-0.70.0.dev6551/src/flet_charts/radar_chart.py +214 -0
  20. flet_charts-0.70.0.dev6551/src/flet_charts/radar_data_set.py +66 -0
  21. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/scatter_chart.py +4 -5
  22. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/scatter_chart_spot.py +1 -2
  23. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551/src/flet_charts.egg-info}/PKG-INFO +20 -11
  24. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts.egg-info/SOURCES.txt +8 -1
  25. flet_charts-0.70.0.dev6551/src/flet_charts.egg-info/requires.txt +1 -0
  26. flet_charts-0.70.0.dev6551/src/flutter/flet_charts/CHANGELOG.md +3 -0
  27. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/LICENSE +1 -1
  28. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/analysis_options.yaml +1 -1
  29. flet_charts-0.70.0.dev6551/src/flutter/flet_charts/lib/src/candlestick_chart.dart +129 -0
  30. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/extension.dart +6 -0
  31. flet_charts-0.70.0.dev6551/src/flutter/flet_charts/lib/src/radar_chart.dart +104 -0
  32. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/utils/bar_chart.dart +121 -74
  33. flet_charts-0.70.0.dev6551/src/flutter/flet_charts/lib/src/utils/candlestick_chart.dart +118 -0
  34. flet_charts-0.70.0.dev6551/src/flutter/flet_charts/lib/src/utils/radar_chart.dart +90 -0
  35. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/pubspec.lock +37 -39
  36. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/pubspec.yaml +10 -9
  37. flet_charts-0.2.0.dev534/pyproject.toml +0 -99
  38. flet_charts-0.2.0.dev534/src/flet_charts.egg-info/requires.txt +0 -1
  39. flet_charts-0.2.0.dev534/src/flutter/flet_charts/CHANGELOG.md +0 -3
  40. flet_charts-0.2.0.dev534/src/flutter/flet_charts/README.md +0 -3
  41. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/LICENSE +0 -0
  42. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/setup.cfg +0 -0
  43. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/bar_chart_rod_stack_item.py +0 -0
  44. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/matplotlib_backends/backend_flet_agg.py +0 -0
  45. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts/types.py +0 -0
  46. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts.egg-info/dependency_links.txt +0 -0
  47. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flet_charts.egg-info/top_level.txt +0 -0
  48. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/flet_charts.dart +0 -0
  49. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/bar_chart.dart +0 -0
  50. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/line_chart.dart +0 -0
  51. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/pie_chart.dart +0 -0
  52. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/scatter_chart.dart +0 -0
  53. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/utils/charts.dart +0 -0
  54. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/utils/line_chart.dart +0 -0
  55. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/utils/pie_chart.dart +0 -0
  56. {flet_charts-0.2.0.dev534 → flet_charts-0.70.0.dev6551}/src/flutter/flet_charts/lib/src/utils/scatter_chart.dart +0 -0
@@ -1,24 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-charts
3
- Version: 0.2.0.dev534
4
- Summary: A Flet extension for creating interactive charts and graphs.
3
+ Version: 0.70.0.dev6551
4
+ Summary: Interactive chart controls for Flet apps.
5
5
  Author-email: Flet contributors <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://flet.dev
8
- Project-URL: Documentation, https://flet-dev.github.io/flet-charts
9
- Project-URL: Repository, https://github.com/flet-dev/flet-charts
10
- Project-URL: Issues, https://github.com/flet-dev/flet-charts/issues
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
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: flet
14
+ Requires-Dist: flet==0.70.0.dev6551
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-charts
18
18
 
19
19
  [![pypi](https://img.shields.io/pypi/v/flet-charts.svg)](https://pypi.python.org/pypi/flet-charts)
20
20
  [![downloads](https://static.pepy.tech/badge/flet-charts/month)](https://pepy.tech/project/flet-charts)
21
- [![license](https://img.shields.io/github/license/flet-dev/flet-charts.svg)](https://github.com/flet-dev/flet-charts/blob/main/LICENSE)
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
22
 
23
23
  A [Flet](https://flet.dev) extension for creating interactive charts and graphs.
24
24
 
@@ -26,12 +26,10 @@ It is based on the [fl_chart](https://pub.dev/packages/fl_chart) Flutter package
26
26
 
27
27
  ## Documentation
28
28
 
29
- Detailed documentation to this package can be found [here](https://flet-charts.docs.flet.dev/).
29
+ Detailed documentation to this package can be found [here](https://docs.flet.dev/charts/).
30
30
 
31
31
  ## Platform Support
32
32
 
33
- This package supports the following platforms:
34
-
35
33
  | Platform | Windows | macOS | Linux | iOS | Android | Web |
36
34
  |----------|---------|-------|-------|-----|---------|-----|
37
35
  | Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -55,4 +53,15 @@ To install the `flet-charts` package and add it to your project dependencies:
55
53
 
56
54
  ### Examples
57
55
 
58
- For examples, see [these](./examples).
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/)
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![pypi](https://img.shields.io/pypi/v/flet-charts.svg)](https://pypi.python.org/pypi/flet-charts)
4
4
  [![downloads](https://static.pepy.tech/badge/flet-charts/month)](https://pepy.tech/project/flet-charts)
5
- [![license](https://img.shields.io/github/license/flet-dev/flet-charts.svg)](https://github.com/flet-dev/flet-charts/blob/main/LICENSE)
5
+ [![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)
6
6
 
7
7
  A [Flet](https://flet.dev) extension for creating interactive charts and graphs.
8
8
 
@@ -10,12 +10,10 @@ It is based on the [fl_chart](https://pub.dev/packages/fl_chart) Flutter package
10
10
 
11
11
  ## Documentation
12
12
 
13
- Detailed documentation to this package can be found [here](https://flet-charts.docs.flet.dev/).
13
+ Detailed documentation to this package can be found [here](https://docs.flet.dev/charts/).
14
14
 
15
15
  ## Platform Support
16
16
 
17
- This package supports the following platforms:
18
-
19
17
  | Platform | Windows | macOS | Linux | iOS | Android | Web |
20
18
  |----------|---------|-------|-------|-----|---------|-----|
21
19
  | Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -39,4 +37,15 @@ To install the `flet-charts` package and add it to your project dependencies:
39
37
 
40
38
  ### Examples
41
39
 
42
- For examples, see [these](./examples).
40
+ For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/charts).
41
+
42
+ ### Available charts
43
+
44
+ - [`BarChart`](https://docs.flet.dev/charts/bar_chart/)
45
+ - [`CandlestickChart`](https://docs.flet.dev/charts/candlestick_chart/)
46
+ - [`LineChart`](https://docs.flet.dev/charts/line_chart/)
47
+ - [`MatplotlibChart`](https://docs.flet.dev/charts/matplotlib_chart/)
48
+ - [`PieChart`](https://docs.flet.dev/charts/pie_chart/)
49
+ - [`PlotlyChart`](https://docs.flet.dev/charts/plotly_chart/)
50
+ - [`RadarChart`](https://docs.flet.dev/charts/radar_chart/)
51
+ - [`ScatterChart`](https://docs.flet.dev/charts/scatter_chart/)
@@ -0,0 +1,24 @@
1
+ [project]
2
+ name = "flet-charts"
3
+ version = "0.70.0.dev6551"
4
+ description = "Interactive chart controls for Flet apps."
5
+ readme = "README.md"
6
+ authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
7
+ license = "Apache-2.0"
8
+ requires-python = ">=3.10"
9
+ dependencies = [
10
+ "flet==0.70.0.dev6551",
11
+ ]
12
+
13
+ [project.urls]
14
+ Homepage = "https://flet.dev"
15
+ Documentation = "https://docs.flet.dev/charts"
16
+ Repository = "https://github.com/flet-dev/flet/tree/main/sdk/python/packages/flet-charts"
17
+ Issues = "https://github.com/flet-dev/flet/issues"
18
+
19
+ [tool.setuptools.package-data]
20
+ "flutter.flet_charts" = ["**/*"]
21
+
22
+ [build-system]
23
+ requires = ["setuptools"]
24
+ build-backend = "setuptools.build_meta"
@@ -7,6 +7,15 @@ from flet_charts.bar_chart import (
7
7
  from flet_charts.bar_chart_group import BarChartGroup
8
8
  from flet_charts.bar_chart_rod import BarChartRod, BarChartRodTooltip
9
9
  from flet_charts.bar_chart_rod_stack_item import BarChartRodStackItem
10
+ from flet_charts.candlestick_chart import (
11
+ CandlestickChart,
12
+ CandlestickChartEvent,
13
+ CandlestickChartTooltip,
14
+ )
15
+ from flet_charts.candlestick_chart_spot import (
16
+ CandlestickChartSpot,
17
+ CandlestickChartSpotTooltip,
18
+ )
10
19
  from flet_charts.chart_axis import ChartAxis, ChartAxisLabel
11
20
  from flet_charts.line_chart import (
12
21
  LineChart,
@@ -28,6 +37,13 @@ from flet_charts.matplotlib_chart_with_toolbar import MatplotlibChartWithToolbar
28
37
  from flet_charts.pie_chart import PieChart, PieChartEvent
29
38
  from flet_charts.pie_chart_section import PieChartSection
30
39
  from flet_charts.plotly_chart import PlotlyChart
40
+ from flet_charts.radar_chart import (
41
+ RadarChart,
42
+ RadarChartEvent,
43
+ RadarChartTitle,
44
+ RadarShape,
45
+ )
46
+ from flet_charts.radar_data_set import RadarDataSet, RadarDataSetEntry
31
47
  from flet_charts.scatter_chart import (
32
48
  ScatterChart,
33
49
  ScatterChartEvent,
@@ -55,6 +71,11 @@ __all__ = [
55
71
  "BarChartRodTooltip",
56
72
  "BarChartTooltip",
57
73
  "BarChartTooltipDirection",
74
+ "CandlestickChart",
75
+ "CandlestickChartEvent",
76
+ "CandlestickChartSpot",
77
+ "CandlestickChartSpotTooltip",
78
+ "CandlestickChartTooltip",
58
79
  "ChartAxis",
59
80
  "ChartAxisLabel",
60
81
  "ChartCirclePoint",
@@ -74,16 +95,22 @@ __all__ = [
74
95
  "LineChartEventSpot",
75
96
  "LineChartTooltip",
76
97
  "MatplotlibChart",
98
+ "MatplotlibChartMessageEvent",
99
+ "MatplotlibChartToolbarButtonsUpdateEvent",
100
+ "MatplotlibChartWithToolbar",
77
101
  "PieChart",
78
102
  "PieChartEvent",
79
103
  "PieChartSection",
80
104
  "PlotlyChart",
105
+ "RadarChart",
106
+ "RadarChartEvent",
107
+ "RadarChartTitle",
108
+ "RadarDataSet",
109
+ "RadarDataSetEntry",
110
+ "RadarShape",
81
111
  "ScatterChart",
82
112
  "ScatterChartEvent",
83
113
  "ScatterChartSpot",
84
114
  "ScatterChartSpotTooltip",
85
115
  "ScatterChartTooltip",
86
- "MatplotlibChartMessageEvent",
87
- "MatplotlibChartToolbarButtonsUpdateEvent",
88
- "MatplotlibChartWithToolbar",
89
116
  ]
@@ -3,7 +3,6 @@ from enum import Enum
3
3
  from typing import Any, Optional
4
4
 
5
5
  import flet as ft
6
-
7
6
  from flet_charts.bar_chart_group import BarChartGroup
8
7
  from flet_charts.chart_axis import ChartAxis
9
8
  from flet_charts.types import ChartEventType, ChartGridLines, HorizontalAlignment
@@ -176,15 +175,15 @@ class BarChart(ft.LayoutControl):
176
175
 
177
176
  group_spacing: ft.Number = 16.0
178
177
  """
179
- A amount of space between bar [`groups`][..].
178
+ An amount of space between bar [`groups`][(c).].
180
179
  """
181
180
 
182
181
  group_alignment: ft.MainAxisAlignment = ft.MainAxisAlignment.SPACE_EVENLY
183
182
  """
184
- A alignment of the bar [`groups`][..] within this chart.
183
+ The alignment of the bar [`groups`][(c).] within this chart.
185
184
 
186
185
  If set to [`MainAxisAlignment.CENTER`][flet.MainAxisAlignment.CENTER],
187
- the space between the `groups` can be specified using [`group_spacing`][..].
186
+ the space between the `groups` can be specified using [`group_spacing`][(c).].
188
187
  """
189
188
 
190
189
  animation: ft.AnimationValue = field(
@@ -221,22 +220,22 @@ class BarChart(ft.LayoutControl):
221
220
  Controls drawing of chart's vertical lines.
222
221
  """
223
222
 
224
- left_axis: ChartAxis = field(default_factory=lambda: ChartAxis(label_size=44))
223
+ left_axis: Optional[ChartAxis] = None
225
224
  """
226
225
  The appearance of the left axis, its title and labels.
227
226
  """
228
227
 
229
- top_axis: ChartAxis = field(default_factory=lambda: ChartAxis(label_size=30))
228
+ top_axis: Optional[ChartAxis] = None
230
229
  """
231
230
  The appearance of the top axis, its title and labels.
232
231
  """
233
232
 
234
- right_axis: ChartAxis = field(default_factory=lambda: ChartAxis(label_size=44))
233
+ right_axis: Optional[ChartAxis] = None
235
234
  """
236
235
  The appearance of the right axis, its title and labels.
237
236
  """
238
237
 
239
- bottom_axis: ChartAxis = field(default_factory=lambda: ChartAxis(label_size=30))
238
+ bottom_axis: Optional[ChartAxis] = None
240
239
  """
241
240
  The appearance of the bottom axis, its title and labels.
242
241
  """
@@ -2,7 +2,6 @@ from dataclasses import field
2
2
  from typing import Optional
3
3
 
4
4
  import flet as ft
5
-
6
5
  from flet_charts.bar_chart_rod import BarChartRod
7
6
 
8
7
  __all__ = ["BarChartGroup"]
@@ -2,7 +2,6 @@ from dataclasses import dataclass, field
2
2
  from typing import Optional, Union
3
3
 
4
4
  import flet as ft
5
-
6
5
  from flet_charts.bar_chart_rod_stack_item import BarChartRodStackItem
7
6
  from flet_charts.types import ChartDataPointTooltip
8
7
 
@@ -0,0 +1,269 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Any, Optional
3
+
4
+ import flet as ft
5
+ from flet_charts.candlestick_chart_spot import CandlestickChartSpot
6
+ from flet_charts.chart_axis import ChartAxis
7
+ from flet_charts.types import ChartEventType, ChartGridLines, HorizontalAlignment
8
+
9
+ __all__ = [
10
+ "CandlestickChart",
11
+ "CandlestickChartEvent",
12
+ "CandlestickChartTooltip",
13
+ ]
14
+
15
+
16
+ @dataclass
17
+ class CandlestickChartTooltip:
18
+ """Configuration of the tooltip for [`CandlestickChart`][(p).]s."""
19
+
20
+ bgcolor: ft.ColorValue = "#FFFFECEF"
21
+ """
22
+ Background color applied to the tooltip bubble.
23
+ """
24
+
25
+ border_radius: ft.BorderRadiusValue = field(
26
+ default_factory=lambda: ft.BorderRadius.all(4)
27
+ )
28
+ """
29
+ Corner radius of the tooltip bubble.
30
+ """
31
+
32
+ padding: ft.PaddingValue = field(
33
+ default_factory=lambda: ft.Padding.symmetric(vertical=8, horizontal=16)
34
+ )
35
+ """
36
+ Padding inside the tooltip bubble.
37
+ """
38
+
39
+ max_width: ft.Number = 120
40
+ """
41
+ Maximum width of the tooltip bubble.
42
+ """
43
+
44
+ rotation: ft.Number = 0.0
45
+ """
46
+ Rotation angle (in degrees) applied to the tooltip bubble.
47
+ """
48
+
49
+ horizontal_offset: ft.Number = 0
50
+ """
51
+ Horizontal offset applied to the tooltip bubble.
52
+ """
53
+
54
+ horizontal_alignment: HorizontalAlignment = HorizontalAlignment.CENTER
55
+ """
56
+ Horizontal alignment of the tooltip relative to the tapped candlestick.
57
+ """
58
+
59
+ border_side: ft.BorderSide = field(default_factory=lambda: ft.BorderSide.none())
60
+ """
61
+ The tooltip bubble border.
62
+ """
63
+
64
+ fit_inside_horizontally: bool = False
65
+ """
66
+ Forces the tooltip bubble to remain inside the chart horizontally.
67
+ """
68
+
69
+ fit_inside_vertically: bool = False
70
+ """
71
+ Forces the tooltip bubble to remain inside the chart vertically.
72
+ """
73
+
74
+ show_on_top_of_chart_box_area: bool = False
75
+ """
76
+ When set to `True`, the tooltip is drawn at the top of the chart box.
77
+ """
78
+
79
+ def copy(
80
+ self,
81
+ *,
82
+ bgcolor: Optional[ft.ColorValue] = None,
83
+ border_radius: Optional[ft.BorderRadiusValue] = None,
84
+ padding: Optional[ft.PaddingValue] = None,
85
+ max_width: Optional[ft.Number] = None,
86
+ rotation: Optional[ft.Number] = None,
87
+ horizontal_offset: Optional[ft.Number] = None,
88
+ horizontal_alignment: Optional[HorizontalAlignment] = None,
89
+ border_side: Optional[ft.BorderSide] = None,
90
+ fit_inside_horizontally: Optional[bool] = None,
91
+ fit_inside_vertically: Optional[bool] = None,
92
+ show_on_top_of_chart_box_area: Optional[bool] = None,
93
+ ) -> "CandlestickChartTooltip":
94
+ """
95
+ Returns a copy of this object with the specified properties overridden.
96
+ """
97
+ return CandlestickChartTooltip(
98
+ bgcolor=bgcolor if bgcolor is not None else self.bgcolor,
99
+ border_radius=border_radius
100
+ if border_radius is not None
101
+ else self.border_radius,
102
+ padding=padding if padding is not None else self.padding,
103
+ max_width=max_width if max_width is not None else self.max_width,
104
+ rotation=rotation if rotation is not None else self.rotation,
105
+ horizontal_offset=horizontal_offset
106
+ if horizontal_offset is not None
107
+ else self.horizontal_offset,
108
+ horizontal_alignment=horizontal_alignment
109
+ if horizontal_alignment is not None
110
+ else self.horizontal_alignment,
111
+ border_side=border_side if border_side is not None else self.border_side,
112
+ fit_inside_horizontally=fit_inside_horizontally
113
+ if fit_inside_horizontally is not None
114
+ else self.fit_inside_horizontally,
115
+ fit_inside_vertically=fit_inside_vertically
116
+ if fit_inside_vertically is not None
117
+ else self.fit_inside_vertically,
118
+ show_on_top_of_chart_box_area=show_on_top_of_chart_box_area
119
+ if show_on_top_of_chart_box_area is not None
120
+ else self.show_on_top_of_chart_box_area,
121
+ )
122
+
123
+
124
+ @dataclass
125
+ class CandlestickChartEvent(ft.Event["CandlestickChart"]):
126
+ """Event raised for interactions with a [`CandlestickChart`][(p).]."""
127
+
128
+ type: ChartEventType
129
+ """
130
+ Type of pointer gesture that triggered the event.
131
+ """
132
+
133
+ spot_index: Optional[int] = None
134
+ """
135
+ Index of the candlestick that was interacted with; `None` if none.
136
+ """
137
+
138
+
139
+ @ft.control("CandlestickChart")
140
+ class CandlestickChart(ft.LayoutControl):
141
+ """
142
+ Draws a candlestick chart representing OHLC values.
143
+ """
144
+
145
+ spots: list[CandlestickChartSpot] = field(default_factory=list)
146
+ """
147
+ Candlesticks to display on the chart.
148
+ """
149
+
150
+ animation: ft.AnimationValue = field(
151
+ default_factory=lambda: ft.Animation(
152
+ duration=ft.Duration(milliseconds=150), curve=ft.AnimationCurve.LINEAR
153
+ )
154
+ )
155
+ """
156
+ Controls chart implicit animations.
157
+ """
158
+
159
+ interactive: bool = True
160
+ """
161
+ Enables automatic tooltips and highlighting when hovering the chart.
162
+ """
163
+
164
+ show_tooltips_for_selected_spots_only: bool = False
165
+ """
166
+ Whether to permanently and only show the tooltips of spots with their
167
+ [`selected`][(p).CandlestickChartSpot.selected] property set to `True`.
168
+ """
169
+
170
+ long_press_duration: Optional[ft.DurationValue] = None
171
+ """
172
+ The duration of a long press on the chart.
173
+ """
174
+
175
+ touch_spot_threshold: ft.Number = 4
176
+ """
177
+ The distance threshold to consider a touch near a candlestick.
178
+ """
179
+
180
+ bgcolor: Optional[ft.ColorValue] = None
181
+ """
182
+ Background color of the chart.
183
+ """
184
+
185
+ border: Optional[ft.Border] = None
186
+ """
187
+ Border drawn around the chart.
188
+ """
189
+
190
+ horizontal_grid_lines: Optional[ChartGridLines] = None
191
+ """
192
+ Horizontal grid lines configuration.
193
+ """
194
+
195
+ vertical_grid_lines: Optional[ChartGridLines] = None
196
+ """
197
+ Vertical grid lines configuration.
198
+ """
199
+
200
+ left_axis: Optional[ChartAxis] = None
201
+ """
202
+ Appearance of the left axis, its title and labels.
203
+ """
204
+
205
+ top_axis: Optional[ChartAxis] = None
206
+ """
207
+ Appearance of the top axis, its title and labels.
208
+ """
209
+
210
+ right_axis: Optional[ChartAxis] = None
211
+ """
212
+ Appearance of the right axis, its title and labels.
213
+ """
214
+
215
+ bottom_axis: Optional[ChartAxis] = None
216
+ """
217
+ Appearance of the bottom axis, its title and labels.
218
+ """
219
+
220
+ baseline_x: Optional[ft.Number] = None
221
+ """
222
+ Baseline value on the X axis.
223
+ """
224
+
225
+ min_x: Optional[ft.Number] = None
226
+ """
227
+ Minimum value displayed on the X axis.
228
+ """
229
+
230
+ max_x: Optional[ft.Number] = None
231
+ """
232
+ Maximum value displayed on the X axis.
233
+ """
234
+
235
+ baseline_y: Optional[ft.Number] = None
236
+ """
237
+ Baseline value on the Y axis.
238
+ """
239
+
240
+ min_y: Optional[ft.Number] = None
241
+ """
242
+ Minimum value displayed on the Y axis.
243
+ """
244
+
245
+ max_y: Optional[ft.Number] = None
246
+ """
247
+ Maximum value displayed on the Y axis.
248
+ """
249
+
250
+ rotation_quarter_turns: ft.Number = 0
251
+ """
252
+ Number of quarter turns (90-degree increments) to rotate the chart.
253
+ """
254
+
255
+ tooltip: Optional[CandlestickChartTooltip] = field(
256
+ default_factory=lambda: CandlestickChartTooltip()
257
+ )
258
+ """
259
+ Tooltip configuration for the chart.
260
+ """
261
+
262
+ on_event: Optional[ft.EventHandler[CandlestickChartEvent]] = None
263
+ """
264
+ Called when an event occurs on this chart.
265
+ """
266
+
267
+ def __post_init__(self, ref: Optional[ft.Ref[Any]]):
268
+ super().__post_init__(ref)
269
+ self._internals["skip_properties"] = ["tooltip"]
@@ -0,0 +1,98 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Optional, Union
3
+
4
+ import flet as ft
5
+ from flet_charts.types import ChartDataPointTooltip
6
+
7
+ __all__ = ["CandlestickChartSpot", "CandlestickChartSpotTooltip"]
8
+
9
+
10
+ @dataclass
11
+ class CandlestickChartSpotTooltip(ChartDataPointTooltip):
12
+ """Tooltip configuration for the [`CandlestickChartSpot`][(p).]."""
13
+
14
+ bottom_margin: ft.Number = 8
15
+ """
16
+ Space between the tooltip bubble and the candlestick.
17
+ """
18
+
19
+ def copy(
20
+ self,
21
+ *,
22
+ text: Optional[str] = None,
23
+ text_style: Optional[ft.TextStyle] = None,
24
+ text_align: Optional[ft.TextAlign] = None,
25
+ text_spans: Optional[list[ft.TextSpan]] = None,
26
+ rtl: Optional[bool] = None,
27
+ bottom_margin: Optional[ft.Number] = None,
28
+ ) -> "CandlestickChartSpotTooltip":
29
+ """
30
+ Returns a copy of this object with the specified properties overridden.
31
+ """
32
+ return CandlestickChartSpotTooltip(
33
+ text=text if text is not None else self.text,
34
+ text_style=text_style if text_style is not None else self.text_style,
35
+ text_align=text_align if text_align is not None else self.text_align,
36
+ text_spans=text_spans.copy()
37
+ if text_spans is not None
38
+ else (self.text_spans.copy() if self.text_spans is not None else None),
39
+ rtl=rtl if rtl is not None else self.rtl,
40
+ bottom_margin=bottom_margin
41
+ if bottom_margin is not None
42
+ else self.bottom_margin,
43
+ )
44
+
45
+
46
+ @ft.control("CandlestickChartSpot")
47
+ class CandlestickChartSpot(ft.BaseControl):
48
+ """Represents a candlestick rendered on a [`CandlestickChart`][(p).]."""
49
+
50
+ x: ft.Number
51
+ """
52
+ The position of the candlestick on the X axis.
53
+ """
54
+
55
+ open: ft.Number
56
+ """
57
+ The open value of the candlestick.
58
+ """
59
+
60
+ high: ft.Number
61
+ """
62
+ The high value of the candlestick.
63
+ """
64
+
65
+ low: ft.Number
66
+ """
67
+ The low value of the candlestick.
68
+ """
69
+
70
+ close: ft.Number
71
+ """
72
+ The close value of the candlestick.
73
+ """
74
+
75
+ selected: bool = False
76
+ """
77
+ Whether to treat this candlestick as selected.
78
+ """
79
+
80
+ tooltip: Union[CandlestickChartSpotTooltip, str] = field(
81
+ default_factory=lambda: CandlestickChartSpotTooltip()
82
+ )
83
+ """
84
+ Tooltip configuration for this candlestick.
85
+ """
86
+
87
+ show_tooltip: bool = True
88
+ """
89
+ Whether the tooltip should be shown when this candlestick is highlighted.
90
+ """
91
+
92
+ def before_update(self):
93
+ super().before_update()
94
+ self._internals["tooltip"] = (
95
+ CandlestickChartSpotTooltip(text=self.tooltip)
96
+ if isinstance(self.tooltip, str)
97
+ else self.tooltip
98
+ )
@@ -19,7 +19,7 @@ class ChartAxisLabel(ft.BaseControl):
19
19
 
20
20
  label: Optional[ft.StrOrControl] = None
21
21
  """
22
- The label to display for the specified [`value`][..].
22
+ The label to display for the specified [`value`][(c).].
23
23
  """
24
24
 
25
25
 
@@ -41,7 +41,7 @@ class ChartAxis(ft.BaseControl):
41
41
 
42
42
  show_labels: bool = True
43
43
  """
44
- Whether to display the [`labels`][..] along the axis.
44
+ Whether to display the [`labels`][(c).] along the axis.
45
45
  If `labels` is empty then automatic labels are displayed.
46
46
  """
47
47
 
@@ -61,7 +61,7 @@ class ChartAxis(ft.BaseControl):
61
61
 
62
62
  label_size: ft.Number = 22
63
63
  """
64
- The maximum space for each label in [`labels`][..].
64
+ The maximum space for each label in [`labels`][(c).].
65
65
 
66
66
  Each label will stretch to fit this space.
67
67
  """