flet-charts 0.2.0.dev524__tar.gz → 0.70.0.dev6293__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.
Potentially problematic release.
This version of flet-charts might be problematic. Click here for more details.
- {flet_charts-0.2.0.dev524/src/flet_charts.egg-info → flet_charts-0.70.0.dev6293}/PKG-INFO +19 -11
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/README.md +13 -5
- flet_charts-0.70.0.dev6293/pyproject.toml +24 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/__init__.py +23 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/bar_chart.py +4 -5
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/bar_chart_group.py +0 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/bar_chart_rod.py +0 -1
- flet_charts-0.70.0.dev6293/src/flet_charts/candlestick_chart.py +266 -0
- flet_charts-0.70.0.dev6293/src/flet_charts/candlestick_chart_spot.py +98 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/line_chart.py +4 -5
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/line_chart_data.py +0 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/line_chart_data_point.py +0 -1
- flet_charts-0.70.0.dev6293/src/flet_charts/matplotlib_backends/backend_flet_agg.py +16 -0
- flet_charts-0.70.0.dev6293/src/flet_charts/matplotlib_chart.py +382 -0
- flet_charts-0.70.0.dev6293/src/flet_charts/matplotlib_chart_with_toolbar.py +110 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/pie_chart.py +0 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/plotly_chart.py +1 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/scatter_chart.py +4 -5
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/scatter_chart_spot.py +0 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293/src/flet_charts.egg-info}/PKG-INFO +19 -11
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts.egg-info/SOURCES.txt +6 -2
- flet_charts-0.70.0.dev6293/src/flet_charts.egg-info/requires.txt +1 -0
- flet_charts-0.70.0.dev6293/src/flutter/flet_charts/CHANGELOG.md +3 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/LICENSE +1 -1
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/analysis_options.yaml +1 -1
- flet_charts-0.70.0.dev6293/src/flutter/flet_charts/lib/src/candlestick_chart.dart +136 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/extension.dart +3 -0
- flet_charts-0.70.0.dev6293/src/flutter/flet_charts/lib/src/utils/bar_chart.dart +247 -0
- flet_charts-0.70.0.dev6293/src/flutter/flet_charts/lib/src/utils/candlestick_chart.dart +117 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/pubspec.yaml +10 -9
- flet_charts-0.2.0.dev524/pyproject.toml +0 -99
- flet_charts-0.2.0.dev524/src/flet_charts/matplotlib_chart.py +0 -65
- flet_charts-0.2.0.dev524/src/flet_charts.egg-info/requires.txt +0 -1
- flet_charts-0.2.0.dev524/src/flutter/flet_charts/CHANGELOG.md +0 -3
- flet_charts-0.2.0.dev524/src/flutter/flet_charts/README.md +0 -3
- flet_charts-0.2.0.dev524/src/flutter/flet_charts/lib/src/utils/bar_chart.dart +0 -194
- flet_charts-0.2.0.dev524/src/flutter/flet_charts/pubspec.lock +0 -792
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/LICENSE +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/setup.cfg +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/bar_chart_rod_stack_item.py +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/chart_axis.py +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/pie_chart_section.py +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts/types.py +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts.egg-info/dependency_links.txt +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flet_charts.egg-info/top_level.txt +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/flet_charts.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/bar_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/line_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/pie_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/scatter_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/utils/charts.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/utils/line_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/src/flutter/flet_charts/lib/src/utils/pie_chart.dart +0 -0
- {flet_charts-0.2.0.dev524 → flet_charts-0.70.0.dev6293}/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.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.70.0.dev6293
|
|
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
|
|
9
|
-
Project-URL: Repository, https://github.com/flet-dev/flet-charts
|
|
10
|
-
Project-URL: Issues, https://github.com/flet-dev/flet
|
|
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.dev6293
|
|
15
15
|
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# flet-charts
|
|
18
18
|
|
|
19
19
|
[](https://pypi.python.org/pypi/flet-charts)
|
|
20
20
|
[](https://pepy.tech/project/flet-charts)
|
|
21
|
-
[](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://
|
|
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,14 @@ 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](
|
|
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`
|
|
61
|
+
- `CandlestickChart`
|
|
62
|
+
- `LineChart`
|
|
63
|
+
- `MatplotlibChart`
|
|
64
|
+
- `PieChart`
|
|
65
|
+
- `PlotlyChart`
|
|
66
|
+
- `ScatterChart`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.python.org/pypi/flet-charts)
|
|
4
4
|
[](https://pepy.tech/project/flet-charts)
|
|
5
|
-
[](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://
|
|
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,14 @@ 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](
|
|
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`
|
|
45
|
+
- `CandlestickChart`
|
|
46
|
+
- `LineChart`
|
|
47
|
+
- `MatplotlibChart`
|
|
48
|
+
- `PieChart`
|
|
49
|
+
- `PlotlyChart`
|
|
50
|
+
- `ScatterChart`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flet-charts"
|
|
3
|
+
version = "0.70.0.dev6293"
|
|
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.dev6293",
|
|
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,
|
|
@@ -19,7 +28,12 @@ from flet_charts.line_chart_data_point import (
|
|
|
19
28
|
LineChartDataPoint,
|
|
20
29
|
LineChartDataPointTooltip,
|
|
21
30
|
)
|
|
22
|
-
from flet_charts.matplotlib_chart import
|
|
31
|
+
from flet_charts.matplotlib_chart import (
|
|
32
|
+
MatplotlibChart,
|
|
33
|
+
MatplotlibChartMessageEvent,
|
|
34
|
+
MatplotlibChartToolbarButtonsUpdateEvent,
|
|
35
|
+
)
|
|
36
|
+
from flet_charts.matplotlib_chart_with_toolbar import MatplotlibChartWithToolbar
|
|
23
37
|
from flet_charts.pie_chart import PieChart, PieChartEvent
|
|
24
38
|
from flet_charts.pie_chart_section import PieChartSection
|
|
25
39
|
from flet_charts.plotly_chart import PlotlyChart
|
|
@@ -50,6 +64,11 @@ __all__ = [
|
|
|
50
64
|
"BarChartRodTooltip",
|
|
51
65
|
"BarChartTooltip",
|
|
52
66
|
"BarChartTooltipDirection",
|
|
67
|
+
"CandlestickChart",
|
|
68
|
+
"CandlestickChartEvent",
|
|
69
|
+
"CandlestickChartSpot",
|
|
70
|
+
"CandlestickChartSpotTooltip",
|
|
71
|
+
"CandlestickChartTooltip",
|
|
53
72
|
"ChartAxis",
|
|
54
73
|
"ChartAxisLabel",
|
|
55
74
|
"ChartCirclePoint",
|
|
@@ -69,6 +88,9 @@ __all__ = [
|
|
|
69
88
|
"LineChartEventSpot",
|
|
70
89
|
"LineChartTooltip",
|
|
71
90
|
"MatplotlibChart",
|
|
91
|
+
"MatplotlibChartMessageEvent",
|
|
92
|
+
"MatplotlibChartToolbarButtonsUpdateEvent",
|
|
93
|
+
"MatplotlibChartWithToolbar",
|
|
72
94
|
"PieChart",
|
|
73
95
|
"PieChartEvent",
|
|
74
96
|
"PieChartSection",
|
|
@@ -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
|
|
@@ -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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
238
|
+
bottom_axis: Optional[ChartAxis] = None
|
|
240
239
|
"""
|
|
241
240
|
The appearance of the bottom axis, its title and labels.
|
|
242
241
|
"""
|
|
@@ -0,0 +1,266 @@
|
|
|
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 = "#FF607D8B"
|
|
21
|
+
"""
|
|
22
|
+
Background color applied to the tooltip bubble.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
border_radius: Optional[ft.BorderRadiusValue] = None
|
|
26
|
+
"""
|
|
27
|
+
Corner radius of the tooltip bubble.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
padding: ft.PaddingValue = field(
|
|
31
|
+
default_factory=lambda: ft.Padding.symmetric(vertical=8, horizontal=16)
|
|
32
|
+
)
|
|
33
|
+
"""
|
|
34
|
+
Padding inside the tooltip bubble.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
max_width: ft.Number = 120
|
|
38
|
+
"""
|
|
39
|
+
Maximum width of the tooltip bubble.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
rotation: ft.Number = 0.0
|
|
43
|
+
"""
|
|
44
|
+
Rotation angle (in degrees) applied to the tooltip bubble.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
horizontal_offset: ft.Number = 0
|
|
48
|
+
"""
|
|
49
|
+
Horizontal offset applied to the tooltip bubble.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
horizontal_alignment: HorizontalAlignment = HorizontalAlignment.CENTER
|
|
53
|
+
"""
|
|
54
|
+
Horizontal alignment of the tooltip relative to the tapped candlestick.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
border_side: ft.BorderSide = field(default_factory=lambda: ft.BorderSide.none())
|
|
58
|
+
"""
|
|
59
|
+
The tooltip bubble border.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
fit_inside_horizontally: bool = False
|
|
63
|
+
"""
|
|
64
|
+
Forces the tooltip bubble to remain inside the chart horizontally.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
fit_inside_vertically: bool = False
|
|
68
|
+
"""
|
|
69
|
+
Forces the tooltip bubble to remain inside the chart vertically.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
show_on_top_of_chart_box_area: bool = False
|
|
73
|
+
"""
|
|
74
|
+
When set to `True`, the tooltip is drawn at the top of the chart box.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
def copy(
|
|
78
|
+
self,
|
|
79
|
+
*,
|
|
80
|
+
bgcolor: Optional[ft.ColorValue] = None,
|
|
81
|
+
border_radius: Optional[ft.BorderRadiusValue] = None,
|
|
82
|
+
padding: Optional[ft.PaddingValue] = None,
|
|
83
|
+
max_width: Optional[ft.Number] = None,
|
|
84
|
+
rotation: Optional[ft.Number] = None,
|
|
85
|
+
horizontal_offset: Optional[ft.Number] = None,
|
|
86
|
+
horizontal_alignment: Optional[HorizontalAlignment] = None,
|
|
87
|
+
border_side: Optional[ft.BorderSide] = None,
|
|
88
|
+
fit_inside_horizontally: Optional[bool] = None,
|
|
89
|
+
fit_inside_vertically: Optional[bool] = None,
|
|
90
|
+
show_on_top_of_chart_box_area: Optional[bool] = None,
|
|
91
|
+
) -> "CandlestickChartTooltip":
|
|
92
|
+
"""
|
|
93
|
+
Returns a copy of this object with the specified properties overridden.
|
|
94
|
+
"""
|
|
95
|
+
return CandlestickChartTooltip(
|
|
96
|
+
bgcolor=bgcolor if bgcolor is not None else self.bgcolor,
|
|
97
|
+
border_radius=border_radius
|
|
98
|
+
if border_radius is not None
|
|
99
|
+
else self.border_radius,
|
|
100
|
+
padding=padding if padding is not None else self.padding,
|
|
101
|
+
max_width=max_width if max_width is not None else self.max_width,
|
|
102
|
+
rotation=rotation if rotation is not None else self.rotation,
|
|
103
|
+
horizontal_offset=horizontal_offset
|
|
104
|
+
if horizontal_offset is not None
|
|
105
|
+
else self.horizontal_offset,
|
|
106
|
+
horizontal_alignment=horizontal_alignment
|
|
107
|
+
if horizontal_alignment is not None
|
|
108
|
+
else self.horizontal_alignment,
|
|
109
|
+
border_side=border_side if border_side is not None else self.border_side,
|
|
110
|
+
fit_inside_horizontally=fit_inside_horizontally
|
|
111
|
+
if fit_inside_horizontally is not None
|
|
112
|
+
else self.fit_inside_horizontally,
|
|
113
|
+
fit_inside_vertically=fit_inside_vertically
|
|
114
|
+
if fit_inside_vertically is not None
|
|
115
|
+
else self.fit_inside_vertically,
|
|
116
|
+
show_on_top_of_chart_box_area=show_on_top_of_chart_box_area
|
|
117
|
+
if show_on_top_of_chart_box_area is not None
|
|
118
|
+
else self.show_on_top_of_chart_box_area,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@dataclass
|
|
123
|
+
class CandlestickChartEvent(ft.Event["CandlestickChart"]):
|
|
124
|
+
"""Event raised for interactions with a [`CandlestickChart`][(p).]."""
|
|
125
|
+
|
|
126
|
+
type: ChartEventType
|
|
127
|
+
"""
|
|
128
|
+
Type of pointer gesture that triggered the event.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
spot_index: Optional[int] = None
|
|
132
|
+
"""
|
|
133
|
+
Index of the candlestick that was interacted with; `None` if none.
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@ft.control("CandlestickChart")
|
|
138
|
+
class CandlestickChart(ft.LayoutControl):
|
|
139
|
+
"""
|
|
140
|
+
Draws a candlestick chart representing OHLC values.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
spots: list[CandlestickChartSpot] = field(default_factory=list)
|
|
144
|
+
"""
|
|
145
|
+
Candlesticks to display on the chart.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
animation: ft.AnimationValue = field(
|
|
149
|
+
default_factory=lambda: ft.Animation(
|
|
150
|
+
duration=ft.Duration(milliseconds=150), curve=ft.AnimationCurve.LINEAR
|
|
151
|
+
)
|
|
152
|
+
)
|
|
153
|
+
"""
|
|
154
|
+
Controls chart implicit animations.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
interactive: bool = True
|
|
158
|
+
"""
|
|
159
|
+
Enables automatic tooltips and highlighting when hovering the chart.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
handle_built_in_touches: bool = True
|
|
163
|
+
"""
|
|
164
|
+
Allows the chart to manage tooltip visibility automatically.
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
long_press_duration: Optional[ft.DurationValue] = None
|
|
168
|
+
"""
|
|
169
|
+
The duration of a long press on the chart.
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
touch_spot_threshold: Optional[ft.Number] = None
|
|
173
|
+
"""
|
|
174
|
+
The distance threshold to consider a touch near a candlestick.
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
bgcolor: Optional[ft.ColorValue] = None
|
|
178
|
+
"""
|
|
179
|
+
Background color of the chart.
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
border: Optional[ft.Border] = None
|
|
183
|
+
"""
|
|
184
|
+
Border drawn around the chart.
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
horizontal_grid_lines: Optional[ChartGridLines] = None
|
|
188
|
+
"""
|
|
189
|
+
Horizontal grid lines configuration.
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
vertical_grid_lines: Optional[ChartGridLines] = None
|
|
193
|
+
"""
|
|
194
|
+
Vertical grid lines configuration.
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
left_axis: Optional[ChartAxis] = None
|
|
198
|
+
"""
|
|
199
|
+
Appearance of the left axis, its title and labels.
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
top_axis: Optional[ChartAxis] = None
|
|
203
|
+
"""
|
|
204
|
+
Appearance of the top axis, its title and labels.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
right_axis: Optional[ChartAxis] = None
|
|
208
|
+
"""
|
|
209
|
+
Appearance of the right axis, its title and labels.
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
bottom_axis: Optional[ChartAxis] = None
|
|
213
|
+
"""
|
|
214
|
+
Appearance of the bottom axis, its title and labels.
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
baseline_x: Optional[ft.Number] = None
|
|
218
|
+
"""
|
|
219
|
+
Baseline value on the X axis.
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
min_x: Optional[ft.Number] = None
|
|
223
|
+
"""
|
|
224
|
+
Minimum value displayed on the X axis.
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
max_x: Optional[ft.Number] = None
|
|
228
|
+
"""
|
|
229
|
+
Maximum value displayed on the X axis.
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
baseline_y: Optional[ft.Number] = None
|
|
233
|
+
"""
|
|
234
|
+
Baseline value on the Y axis.
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
min_y: Optional[ft.Number] = None
|
|
238
|
+
"""
|
|
239
|
+
Minimum value displayed on the Y axis.
|
|
240
|
+
"""
|
|
241
|
+
|
|
242
|
+
max_y: Optional[ft.Number] = None
|
|
243
|
+
"""
|
|
244
|
+
Maximum value displayed on the Y axis.
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
rotation_quarter_turns: ft.Number = 0
|
|
248
|
+
"""
|
|
249
|
+
Number of quarter turns (90-degree increments) to rotate the chart.
|
|
250
|
+
"""
|
|
251
|
+
|
|
252
|
+
tooltip: Optional[CandlestickChartTooltip] = field(
|
|
253
|
+
default_factory=lambda: CandlestickChartTooltip()
|
|
254
|
+
)
|
|
255
|
+
"""
|
|
256
|
+
Tooltip configuration for the chart.
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
on_event: Optional[ft.EventHandler[CandlestickChartEvent]] = None
|
|
260
|
+
"""
|
|
261
|
+
Called when an event occurs on this chart.
|
|
262
|
+
"""
|
|
263
|
+
|
|
264
|
+
def __post_init__(self, ref: Optional[ft.Ref[Any]]):
|
|
265
|
+
super().__post_init__(ref)
|
|
266
|
+
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
|
+
)
|
|
@@ -2,7 +2,6 @@ from dataclasses import dataclass, field
|
|
|
2
2
|
from typing import Any, Optional
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
|
-
|
|
6
5
|
from flet_charts.chart_axis import ChartAxis
|
|
7
6
|
from flet_charts.line_chart_data import LineChartData
|
|
8
7
|
from flet_charts.types import ChartEventType, ChartGridLines, HorizontalAlignment
|
|
@@ -224,22 +223,22 @@ class LineChart(ft.LayoutControl):
|
|
|
224
223
|
Controls drawing of chart's vertical lines.
|
|
225
224
|
"""
|
|
226
225
|
|
|
227
|
-
left_axis: ChartAxis =
|
|
226
|
+
left_axis: Optional[ChartAxis] = None
|
|
228
227
|
"""
|
|
229
228
|
Defines the appearance of the left axis, its title and labels.
|
|
230
229
|
"""
|
|
231
230
|
|
|
232
|
-
top_axis: ChartAxis =
|
|
231
|
+
top_axis: Optional[ChartAxis] = None
|
|
233
232
|
"""
|
|
234
233
|
Defines the appearance of the top axis, its title and labels.
|
|
235
234
|
"""
|
|
236
235
|
|
|
237
|
-
right_axis: ChartAxis =
|
|
236
|
+
right_axis: Optional[ChartAxis] = None
|
|
238
237
|
"""
|
|
239
238
|
Defines the appearance of the right axis, its title and labels.
|
|
240
239
|
"""
|
|
241
240
|
|
|
242
|
-
bottom_axis: ChartAxis =
|
|
241
|
+
bottom_axis: Optional[ChartAxis] = None
|
|
243
242
|
"""
|
|
244
243
|
Defines the appearance of the bottom axis, its title and labels.
|
|
245
244
|
"""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from matplotlib import _api
|
|
2
|
+
from matplotlib.backends import backend_webagg_core
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class FigureCanvasFletAgg(backend_webagg_core.FigureCanvasWebAggCore):
|
|
6
|
+
manager_class = _api.classproperty(lambda cls: FigureManagerFletAgg)
|
|
7
|
+
supports_blit = False
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class FigureManagerFletAgg(backend_webagg_core.FigureManagerWebAgg):
|
|
11
|
+
_toolbar2_class = backend_webagg_core.NavigationToolbar2WebAgg
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
FigureCanvas = FigureCanvasFletAgg
|
|
15
|
+
FigureManager = FigureManagerFletAgg
|
|
16
|
+
interactive = True
|