flet-charts 0.2.0.dev40__tar.gz → 0.2.0.dev504__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.
- {flet_charts-0.2.0.dev40/src/flet_charts.egg-info → flet_charts-0.2.0.dev504}/PKG-INFO +8 -9
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/README.md +7 -1
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/pyproject.toml +6 -6
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/__init__.py +24 -17
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/bar_chart.py +44 -23
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/bar_chart_group.py +1 -1
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/bar_chart_rod.py +5 -3
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/chart_axis.py +29 -9
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/line_chart.py +20 -13
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/line_chart_data.py +30 -4
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/line_chart_data_point.py +4 -2
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/pie_chart.py +3 -3
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/pie_chart_section.py +5 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/scatter_chart.py +34 -29
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/scatter_chart_spot.py +15 -4
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/types.py +43 -22
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504/src/flet_charts.egg-info}/PKG-INFO +8 -9
- flet_charts-0.2.0.dev504/src/flet_charts.egg-info/requires.txt +1 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/bar_chart.dart +2 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/scatter_chart.dart +22 -21
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/utils/bar_chart.dart +23 -7
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/utils/charts.dart +12 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/utils/line_chart.dart +12 -1
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/utils/pie_chart.dart +1 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/utils/scatter_chart.dart +19 -19
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/pubspec.lock +58 -42
- flet_charts-0.2.0.dev40/src/flet_charts.egg-info/requires.txt +0 -11
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/LICENSE +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/setup.cfg +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/bar_chart_rod_stack_item.py +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/matplotlib_chart.py +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/plotly_chart.py +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts.egg-info/SOURCES.txt +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts.egg-info/dependency_links.txt +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts.egg-info/top_level.txt +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/CHANGELOG.md +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/LICENSE +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/README.md +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/analysis_options.yaml +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/flet_charts.dart +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/extension.dart +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/line_chart.dart +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/lib/src/pie_chart.dart +0 -0
- {flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flutter/flet_charts/pubspec.yaml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flet-charts
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev504
|
|
4
4
|
Summary: A Flet extension for creating interactive charts and graphs.
|
|
5
5
|
Author-email: Flet contributors <hello@flet.dev>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -12,13 +12,6 @@ Requires-Python: >=3.10
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: flet>=0.70.0.dev0
|
|
15
|
-
Provides-Extra: all
|
|
16
|
-
Requires-Dist: plotly>=6.0.1; extra == "all"
|
|
17
|
-
Requires-Dist: matplotlib>=3.10.1; extra == "all"
|
|
18
|
-
Provides-Extra: plotly
|
|
19
|
-
Requires-Dist: plotly>=6.0.1; extra == "plotly"
|
|
20
|
-
Provides-Extra: matplotlib
|
|
21
|
-
Requires-Dist: matplotlib>=3.10.1; extra == "matplotlib"
|
|
22
15
|
Dynamic: license-file
|
|
23
16
|
|
|
24
17
|
# flet-charts
|
|
@@ -48,7 +41,9 @@ This package supports the following platforms:
|
|
|
48
41
|
| Android | ✅ |
|
|
49
42
|
| Web | ✅ |
|
|
50
43
|
|
|
51
|
-
##
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
52
47
|
|
|
53
48
|
To install the `flet-charts` package and add it to your project dependencies:
|
|
54
49
|
|
|
@@ -67,3 +62,7 @@ To install the `flet-charts` package and add it to your project dependencies:
|
|
|
67
62
|
```bash
|
|
68
63
|
poetry add flet-charts
|
|
69
64
|
```
|
|
65
|
+
|
|
66
|
+
### Examples
|
|
67
|
+
|
|
68
|
+
For examples, see [these](./examples).
|
|
@@ -25,7 +25,9 @@ This package supports the following platforms:
|
|
|
25
25
|
| Android | ✅ |
|
|
26
26
|
| Web | ✅ |
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Installation
|
|
29
31
|
|
|
30
32
|
To install the `flet-charts` package and add it to your project dependencies:
|
|
31
33
|
|
|
@@ -44,3 +46,7 @@ To install the `flet-charts` package and add it to your project dependencies:
|
|
|
44
46
|
```bash
|
|
45
47
|
poetry add flet-charts
|
|
46
48
|
```
|
|
49
|
+
|
|
50
|
+
### Examples
|
|
51
|
+
|
|
52
|
+
For examples, see [these](./examples).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "flet-charts"
|
|
3
|
-
version = "0.2.0.
|
|
3
|
+
version = "0.2.0.dev504"
|
|
4
4
|
description = "A Flet extension for creating interactive charts and graphs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
|
|
@@ -19,11 +19,6 @@ Issues = "https://github.com/flet-dev/flet-charts/issues"
|
|
|
19
19
|
[tool.setuptools.package-data]
|
|
20
20
|
"flutter.flet_charts" = ["**/*"]
|
|
21
21
|
|
|
22
|
-
[project.optional-dependencies]
|
|
23
|
-
all = ["plotly>=6.0.1", "matplotlib>=3.10.1"]
|
|
24
|
-
plotly = ["plotly>=6.0.1"]
|
|
25
|
-
matplotlib = ["matplotlib>=3.10.1"]
|
|
26
|
-
|
|
27
22
|
[dependency-groups]
|
|
28
23
|
test = [
|
|
29
24
|
"pytest >=7.2.0",
|
|
@@ -57,6 +52,7 @@ docs = [
|
|
|
57
52
|
"markdown-exec[ansi] >=1.11.0",
|
|
58
53
|
"pydocstyle >=6.3.0",
|
|
59
54
|
"linkcheckmd >=1.4.0",
|
|
55
|
+
"mkdocs-external-images",
|
|
60
56
|
{ include-group = 'docs-coverage' },
|
|
61
57
|
]
|
|
62
58
|
all = [
|
|
@@ -64,6 +60,10 @@ all = [
|
|
|
64
60
|
{ include-group = 'docs' },
|
|
65
61
|
]
|
|
66
62
|
|
|
63
|
+
[tool.uv.sources]
|
|
64
|
+
mkdocs-external-images = { git = "https://github.com/flet-dev/mkdocs-external-images", tag = "v0.2.0" }
|
|
65
|
+
|
|
66
|
+
|
|
67
67
|
[tool.ruff]
|
|
68
68
|
line-length = 88
|
|
69
69
|
target-version = "py39"
|
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
from .bar_chart import (
|
|
1
|
+
from flet_charts.bar_chart import (
|
|
2
2
|
BarChart,
|
|
3
3
|
BarChartEvent,
|
|
4
4
|
BarChartTooltip,
|
|
5
5
|
BarChartTooltipDirection,
|
|
6
6
|
)
|
|
7
|
-
from .bar_chart_group import BarChartGroup
|
|
8
|
-
from .bar_chart_rod import BarChartRod, BarChartRodTooltip
|
|
9
|
-
from .bar_chart_rod_stack_item import BarChartRodStackItem
|
|
10
|
-
from .chart_axis import ChartAxis, ChartAxisLabel
|
|
11
|
-
from .line_chart import (
|
|
7
|
+
from flet_charts.bar_chart_group import BarChartGroup
|
|
8
|
+
from flet_charts.bar_chart_rod import BarChartRod, BarChartRodTooltip
|
|
9
|
+
from flet_charts.bar_chart_rod_stack_item import BarChartRodStackItem
|
|
10
|
+
from flet_charts.chart_axis import ChartAxis, ChartAxisLabel
|
|
11
|
+
from flet_charts.line_chart import (
|
|
12
12
|
LineChart,
|
|
13
13
|
LineChartEvent,
|
|
14
14
|
LineChartEventSpot,
|
|
15
15
|
LineChartTooltip,
|
|
16
16
|
)
|
|
17
|
-
from .line_chart_data import LineChartData
|
|
18
|
-
from .line_chart_data_point import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from .
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
25
|
-
from .
|
|
17
|
+
from flet_charts.line_chart_data import LineChartData
|
|
18
|
+
from flet_charts.line_chart_data_point import (
|
|
19
|
+
LineChartDataPoint,
|
|
20
|
+
LineChartDataPointTooltip,
|
|
21
|
+
)
|
|
22
|
+
from flet_charts.matplotlib_chart import MatplotlibChart
|
|
23
|
+
from flet_charts.pie_chart import PieChart, PieChartEvent
|
|
24
|
+
from flet_charts.pie_chart_section import PieChartSection
|
|
25
|
+
from flet_charts.plotly_chart import PlotlyChart
|
|
26
|
+
from flet_charts.scatter_chart import (
|
|
27
|
+
ScatterChart,
|
|
28
|
+
ScatterChartEvent,
|
|
29
|
+
ScatterChartTooltip,
|
|
30
|
+
)
|
|
31
|
+
from flet_charts.scatter_chart_spot import ScatterChartSpot, ScatterChartSpotTooltip
|
|
32
|
+
from flet_charts.types import (
|
|
26
33
|
ChartCirclePoint,
|
|
27
34
|
ChartCrossPoint,
|
|
28
35
|
ChartDataPointTooltip,
|
|
29
36
|
ChartEventType,
|
|
30
37
|
ChartGridLines,
|
|
31
|
-
ChartHorizontalAlignment,
|
|
32
38
|
ChartPointLine,
|
|
33
39
|
ChartPointShape,
|
|
34
40
|
ChartSquarePoint,
|
|
41
|
+
HorizontalAlignment,
|
|
35
42
|
)
|
|
36
43
|
|
|
37
44
|
__all__ = [
|
|
@@ -50,10 +57,10 @@ __all__ = [
|
|
|
50
57
|
"ChartDataPointTooltip",
|
|
51
58
|
"ChartEventType",
|
|
52
59
|
"ChartGridLines",
|
|
53
|
-
"ChartHorizontalAlignment",
|
|
54
60
|
"ChartPointLine",
|
|
55
61
|
"ChartPointShape",
|
|
56
62
|
"ChartSquarePoint",
|
|
63
|
+
"HorizontalAlignment",
|
|
57
64
|
"LineChart",
|
|
58
65
|
"LineChartData",
|
|
59
66
|
"LineChartDataPoint",
|
|
@@ -4,9 +4,9 @@ from typing import Any, Optional
|
|
|
4
4
|
|
|
5
5
|
import flet as ft
|
|
6
6
|
|
|
7
|
-
from .bar_chart_group import BarChartGroup
|
|
8
|
-
from .chart_axis import ChartAxis
|
|
9
|
-
from .types import ChartEventType, ChartGridLines
|
|
7
|
+
from flet_charts.bar_chart_group import BarChartGroup
|
|
8
|
+
from flet_charts.chart_axis import ChartAxis
|
|
9
|
+
from flet_charts.types import ChartEventType, ChartGridLines, HorizontalAlignment
|
|
10
10
|
|
|
11
11
|
__all__ = [
|
|
12
12
|
"BarChart",
|
|
@@ -43,12 +43,14 @@ class BarChartTooltip:
|
|
|
43
43
|
The border radius of the tooltip.
|
|
44
44
|
"""
|
|
45
45
|
|
|
46
|
-
margin:
|
|
46
|
+
margin: ft.Number = 16
|
|
47
47
|
"""
|
|
48
48
|
Applies a bottom margin for showing tooltip on top of rods.
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
|
-
padding:
|
|
51
|
+
padding: ft.PaddingValue = field(
|
|
52
|
+
default_factory=lambda: ft.Padding.symmetric(vertical=8, horizontal=16)
|
|
53
|
+
)
|
|
52
54
|
"""
|
|
53
55
|
Applies a padding for showing contents inside the tooltip.
|
|
54
56
|
"""
|
|
@@ -58,14 +60,14 @@ class BarChartTooltip:
|
|
|
58
60
|
Restricts the tooltip's width.
|
|
59
61
|
"""
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
rotation: ft.Number = 0.0
|
|
62
64
|
"""
|
|
63
65
|
The rotation angle of the tooltip.
|
|
64
66
|
"""
|
|
65
67
|
|
|
66
|
-
horizontal_offset:
|
|
68
|
+
horizontal_offset: ft.Number = 0.0
|
|
67
69
|
"""
|
|
68
|
-
|
|
70
|
+
The horizontal offset of this tooltip.
|
|
69
71
|
"""
|
|
70
72
|
|
|
71
73
|
border_side: Optional[ft.BorderSide] = None
|
|
@@ -73,22 +75,27 @@ class BarChartTooltip:
|
|
|
73
75
|
The tooltip border side.
|
|
74
76
|
"""
|
|
75
77
|
|
|
76
|
-
fit_inside_horizontally:
|
|
78
|
+
fit_inside_horizontally: bool = False
|
|
77
79
|
"""
|
|
78
80
|
Forces the tooltip to shift horizontally inside the chart, if overflow happens.
|
|
79
81
|
"""
|
|
80
82
|
|
|
81
|
-
fit_inside_vertically:
|
|
83
|
+
fit_inside_vertically: bool = False
|
|
82
84
|
"""
|
|
83
85
|
Forces the tooltip to shift vertically inside the chart, if overflow happens.
|
|
84
86
|
"""
|
|
85
87
|
|
|
86
|
-
direction:
|
|
88
|
+
direction: BarChartTooltipDirection = BarChartTooltipDirection.AUTO
|
|
87
89
|
"""
|
|
88
|
-
|
|
90
|
+
Defines the direction of this tooltip.
|
|
89
91
|
"""
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
horizontal_alignment: HorizontalAlignment = HorizontalAlignment.CENTER
|
|
94
|
+
"""
|
|
95
|
+
Defines the horizontal alignment of this tooltip.
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
def copy(
|
|
92
99
|
self,
|
|
93
100
|
*,
|
|
94
101
|
bgcolor: Optional[ft.ColorValue] = None,
|
|
@@ -96,12 +103,13 @@ class BarChartTooltip:
|
|
|
96
103
|
margin: Optional[ft.Number] = None,
|
|
97
104
|
padding: Optional[ft.PaddingValue] = None,
|
|
98
105
|
max_width: Optional[ft.Number] = None,
|
|
99
|
-
|
|
106
|
+
rotation: Optional[ft.Number] = None,
|
|
100
107
|
horizontal_offset: Optional[ft.Number] = None,
|
|
101
108
|
border_side: Optional[ft.BorderSide] = None,
|
|
102
109
|
fit_inside_horizontally: Optional[bool] = None,
|
|
103
110
|
fit_inside_vertically: Optional[bool] = None,
|
|
104
111
|
direction: Optional[BarChartTooltipDirection] = None,
|
|
112
|
+
horizontal_alignment: Optional[HorizontalAlignment] = None,
|
|
105
113
|
) -> "BarChartTooltip":
|
|
106
114
|
"""
|
|
107
115
|
Returns a copy of this object with the specified properties overridden.
|
|
@@ -114,9 +122,7 @@ class BarChartTooltip:
|
|
|
114
122
|
margin=margin if margin is not None else self.margin,
|
|
115
123
|
padding=padding if padding is not None else self.padding,
|
|
116
124
|
max_width=max_width if max_width is not None else self.max_width,
|
|
117
|
-
|
|
118
|
-
if rotate_angle is not None
|
|
119
|
-
else self.rotate_angle,
|
|
125
|
+
rotation=rotation if rotation is not None else self.rotation,
|
|
120
126
|
horizontal_offset=horizontal_offset
|
|
121
127
|
if horizontal_offset is not None
|
|
122
128
|
else self.horizontal_offset,
|
|
@@ -128,6 +134,9 @@ class BarChartTooltip:
|
|
|
128
134
|
if fit_inside_vertically is not None
|
|
129
135
|
else self.fit_inside_vertically,
|
|
130
136
|
direction=direction if direction is not None else self.direction,
|
|
137
|
+
horizontal_alignment=horizontal_alignment
|
|
138
|
+
if horizontal_alignment is not None
|
|
139
|
+
else self.horizontal_alignment,
|
|
131
140
|
)
|
|
132
141
|
|
|
133
142
|
|
|
@@ -159,7 +168,7 @@ class BarChart(ft.ConstrainedControl):
|
|
|
159
168
|
"""
|
|
160
169
|
Draws a bar chart.
|
|
161
170
|
|
|
162
|
-

|
|
163
172
|
"""
|
|
164
173
|
|
|
165
174
|
groups: list[BarChartGroup] = field(default_factory=list)
|
|
@@ -167,9 +176,17 @@ class BarChart(ft.ConstrainedControl):
|
|
|
167
176
|
The list of [`BarChartGroup`][(p).]s to draw.
|
|
168
177
|
"""
|
|
169
178
|
|
|
170
|
-
|
|
179
|
+
group_spacing: ft.Number = 16.0
|
|
180
|
+
"""
|
|
181
|
+
A amount of space between bar [`groups`][..].
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
group_alignment: ft.MainAxisAlignment = ft.MainAxisAlignment.SPACE_EVENLY
|
|
171
185
|
"""
|
|
172
|
-
A
|
|
186
|
+
A alignment of the bar [`groups`][..] within this chart.
|
|
187
|
+
|
|
188
|
+
If set to [`MainAxisAlignment.CENTER`][flet.MainAxisAlignment.CENTER],
|
|
189
|
+
the space between the `groups` can be specified using [`group_spacing`][..].
|
|
173
190
|
"""
|
|
174
191
|
|
|
175
192
|
animation: ft.AnimationValue = field(
|
|
@@ -241,14 +258,18 @@ class BarChart(ft.ConstrainedControl):
|
|
|
241
258
|
The maximum displayed value for Y axis.
|
|
242
259
|
"""
|
|
243
260
|
|
|
244
|
-
tooltip: Optional[BarChartTooltip] =
|
|
261
|
+
tooltip: Optional[BarChartTooltip] = field(
|
|
262
|
+
default_factory=lambda: BarChartTooltip()
|
|
263
|
+
)
|
|
245
264
|
"""
|
|
246
|
-
The tooltip configuration for
|
|
265
|
+
The tooltip configuration for this chart.
|
|
266
|
+
|
|
267
|
+
If set to `None`, tooltips will not shown throughout this chart.
|
|
247
268
|
"""
|
|
248
269
|
|
|
249
270
|
on_event: Optional[ft.EventHandler[BarChartEvent]] = None
|
|
250
271
|
"""
|
|
251
|
-
|
|
272
|
+
Called when an event occurs on this chart, such as a click or hover.
|
|
252
273
|
"""
|
|
253
274
|
|
|
254
275
|
def __post_init__(self, ref: Optional[ft.Ref[Any]]):
|
|
@@ -3,8 +3,8 @@ from typing import Optional, Union
|
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
6
|
-
from .bar_chart_rod_stack_item import BarChartRodStackItem
|
|
7
|
-
from .types import ChartDataPointTooltip
|
|
6
|
+
from flet_charts.bar_chart_rod_stack_item import BarChartRodStackItem
|
|
7
|
+
from flet_charts.types import ChartDataPointTooltip
|
|
8
8
|
|
|
9
9
|
__all__ = ["BarChartRod", "BarChartRodTooltip"]
|
|
10
10
|
|
|
@@ -22,13 +22,14 @@ class BarChartRodTooltip(ChartDataPointTooltip):
|
|
|
22
22
|
When `None`, defaults to [`BarChartRod.to_y`][(p).].
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
|
-
def
|
|
25
|
+
def copy(
|
|
26
26
|
self,
|
|
27
27
|
*,
|
|
28
28
|
text: Optional[str] = None,
|
|
29
29
|
text_style: Optional[ft.TextStyle] = None,
|
|
30
30
|
text_align: Optional[ft.TextAlign] = None,
|
|
31
31
|
text_spans: Optional[list[ft.TextSpan]] = None,
|
|
32
|
+
rtl: Optional[bool] = None,
|
|
32
33
|
) -> "BarChartRodTooltip":
|
|
33
34
|
"""
|
|
34
35
|
Returns a copy of this object with the specified properties overridden.
|
|
@@ -40,6 +41,7 @@ class BarChartRodTooltip(ChartDataPointTooltip):
|
|
|
40
41
|
text_spans=text_spans.copy()
|
|
41
42
|
if text_spans is not None
|
|
42
43
|
else (self.text_spans.copy() if self.text_spans is not None else None),
|
|
44
|
+
rtl=rtl if rtl is not None else self.rtl,
|
|
43
45
|
)
|
|
44
46
|
|
|
45
47
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import field
|
|
2
|
-
from typing import Optional
|
|
2
|
+
from typing import Optional
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
@@ -17,11 +17,9 @@ class ChartAxisLabel(ft.BaseControl):
|
|
|
17
17
|
A value to draw label for.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
label: Optional[
|
|
20
|
+
label: Optional[ft.StrOrControl] = None
|
|
21
21
|
"""
|
|
22
|
-
The label to display for the specified `value
|
|
23
|
-
|
|
24
|
-
Can be a string or a `Control`.
|
|
22
|
+
The label to display for the specified [`value`][..].
|
|
25
23
|
"""
|
|
26
24
|
|
|
27
25
|
|
|
@@ -38,12 +36,12 @@ class ChartAxis(ft.BaseControl):
|
|
|
38
36
|
|
|
39
37
|
title_size: ft.Number = 16
|
|
40
38
|
"""
|
|
41
|
-
|
|
39
|
+
The size of title area.
|
|
42
40
|
"""
|
|
43
41
|
|
|
44
42
|
show_labels: bool = True
|
|
45
43
|
"""
|
|
46
|
-
Whether to display the `labels` along the axis.
|
|
44
|
+
Whether to display the [`labels`][..] along the axis.
|
|
47
45
|
If `labels` is empty then automatic labels are displayed.
|
|
48
46
|
"""
|
|
49
47
|
|
|
@@ -55,10 +53,32 @@ class ChartAxis(ft.BaseControl):
|
|
|
55
53
|
|
|
56
54
|
label_spacing: Optional[ft.Number] = None
|
|
57
55
|
"""
|
|
58
|
-
The interval between
|
|
56
|
+
The spacing/interval between labels.
|
|
57
|
+
|
|
58
|
+
If a value is not set, a suitable value
|
|
59
|
+
will be automatically calculated and used.
|
|
59
60
|
"""
|
|
60
61
|
|
|
61
62
|
label_size: ft.Number = 22
|
|
62
63
|
"""
|
|
63
|
-
|
|
64
|
+
The maximum space for each label in [`labels`][..].
|
|
65
|
+
|
|
66
|
+
Each label will stretch to fit this space.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
show_min: bool = True
|
|
70
|
+
"""
|
|
71
|
+
Whether to display a label for the minimum value
|
|
72
|
+
independent of the sampling interval.
|
|
64
73
|
"""
|
|
74
|
+
|
|
75
|
+
show_max: bool = True
|
|
76
|
+
"""
|
|
77
|
+
Whether to display a label for the maximum value
|
|
78
|
+
independent of the sampling interval.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def before_update(self):
|
|
82
|
+
super().before_update()
|
|
83
|
+
if self.label_spacing == 0:
|
|
84
|
+
raise ValueError("label_spacing cannot be 0")
|
|
@@ -3,9 +3,9 @@ from typing import Any, Optional
|
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
6
|
-
from .chart_axis import ChartAxis
|
|
7
|
-
from .line_chart_data import LineChartData
|
|
8
|
-
from .types import ChartEventType, ChartGridLines
|
|
6
|
+
from flet_charts.chart_axis import ChartAxis
|
|
7
|
+
from flet_charts.line_chart_data import LineChartData
|
|
8
|
+
from flet_charts.types import ChartEventType, ChartGridLines, HorizontalAlignment
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
11
|
"LineChart",
|
|
@@ -27,7 +27,7 @@ class LineChartEventSpot:
|
|
|
27
27
|
The line's point index or `-1` if no point was hovered.
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def copy(
|
|
31
31
|
self,
|
|
32
32
|
*,
|
|
33
33
|
bar_index: Optional[int] = None,
|
|
@@ -86,7 +86,7 @@ class LineChartTooltip:
|
|
|
86
86
|
Restricts the tooltip's width.
|
|
87
87
|
"""
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
rotation: ft.Number = 0.0
|
|
90
90
|
"""
|
|
91
91
|
The tooltip's rotation angle in degrees.
|
|
92
92
|
"""
|
|
@@ -98,7 +98,7 @@ class LineChartTooltip:
|
|
|
98
98
|
|
|
99
99
|
border_side: ft.BorderSide = field(default_factory=lambda: ft.BorderSide.none())
|
|
100
100
|
"""
|
|
101
|
-
|
|
101
|
+
Defines the borders of this tooltip.
|
|
102
102
|
"""
|
|
103
103
|
|
|
104
104
|
fit_inside_horizontally: bool = False
|
|
@@ -116,7 +116,12 @@ class LineChartTooltip:
|
|
|
116
116
|
Whether to force the tooltip container to top of the line.
|
|
117
117
|
"""
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
horizontal_alignment: HorizontalAlignment = HorizontalAlignment.CENTER
|
|
120
|
+
"""
|
|
121
|
+
The horizontal alignment of this tooltip.
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
def copy(
|
|
120
125
|
self,
|
|
121
126
|
*,
|
|
122
127
|
bgcolor: Optional[ft.ColorValue] = None,
|
|
@@ -124,7 +129,7 @@ class LineChartTooltip:
|
|
|
124
129
|
margin: Optional[ft.Number] = None,
|
|
125
130
|
padding: Optional[ft.PaddingValue] = None,
|
|
126
131
|
max_width: Optional[ft.Number] = None,
|
|
127
|
-
|
|
132
|
+
rotation: Optional[ft.Number] = None,
|
|
128
133
|
horizontal_offset: Optional[ft.Number] = None,
|
|
129
134
|
border_side: Optional[ft.BorderSide] = None,
|
|
130
135
|
fit_inside_horizontally: Optional[bool] = None,
|
|
@@ -142,9 +147,7 @@ class LineChartTooltip:
|
|
|
142
147
|
margin=margin if margin is not None else self.margin,
|
|
143
148
|
padding=padding if padding is not None else self.padding,
|
|
144
149
|
max_width=max_width if max_width is not None else self.max_width,
|
|
145
|
-
|
|
146
|
-
if rotate_angle is not None
|
|
147
|
-
else self.rotate_angle,
|
|
150
|
+
rotation=rotation if rotation is not None else self.rotation,
|
|
148
151
|
horizontal_offset=horizontal_offset
|
|
149
152
|
if horizontal_offset is not None
|
|
150
153
|
else self.horizontal_offset,
|
|
@@ -166,7 +169,7 @@ class LineChart(ft.ConstrainedControl):
|
|
|
166
169
|
"""
|
|
167
170
|
Draws a line chart.
|
|
168
171
|
|
|
169
|
-

|
|
170
173
|
"""
|
|
171
174
|
|
|
172
175
|
data_series: list[LineChartData] = field(default_factory=list)
|
|
@@ -273,9 +276,13 @@ class LineChart(ft.ConstrainedControl):
|
|
|
273
276
|
Defines the maximum displayed value for Y axis.
|
|
274
277
|
"""
|
|
275
278
|
|
|
276
|
-
tooltip: LineChartTooltip = field(
|
|
279
|
+
tooltip: Optional[LineChartTooltip] = field(
|
|
280
|
+
default_factory=lambda: LineChartTooltip()
|
|
281
|
+
)
|
|
277
282
|
"""
|
|
278
283
|
The tooltip configuration for this chart.
|
|
284
|
+
|
|
285
|
+
If set to `None`, no tooltips will be shown throughout this chart.
|
|
279
286
|
"""
|
|
280
287
|
|
|
281
288
|
on_event: Optional[ft.EventHandler[LineChartEvent]] = None
|
|
@@ -3,8 +3,8 @@ from typing import Optional, Union
|
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
6
|
-
from .line_chart_data_point import LineChartDataPoint
|
|
7
|
-
from .types import ChartPointLine, ChartPointShape
|
|
6
|
+
from flet_charts.line_chart_data_point import LineChartDataPoint
|
|
7
|
+
from flet_charts.types import ChartPointLine, ChartPointShape
|
|
8
8
|
|
|
9
9
|
__all__ = ["LineChartData"]
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ class LineChartData(ft.BaseControl):
|
|
|
19
19
|
|
|
20
20
|
curved: bool = False
|
|
21
21
|
"""
|
|
22
|
-
|
|
22
|
+
Whether to draw this chart line as a curve.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
color: ft.ColorValue = ft.Colors.CYAN
|
|
@@ -49,7 +49,7 @@ class LineChartData(ft.BaseControl):
|
|
|
49
49
|
|
|
50
50
|
prevent_curve_over_shooting_threshold: ft.Number = 10.0
|
|
51
51
|
"""
|
|
52
|
-
Threshold
|
|
52
|
+
Threshold for [`prevent_curve_over_shooting`][..] algorithm.
|
|
53
53
|
"""
|
|
54
54
|
|
|
55
55
|
dash_pattern: Optional[list[int]] = None
|
|
@@ -128,3 +128,29 @@ class LineChartData(ft.BaseControl):
|
|
|
128
128
|
"""
|
|
129
129
|
Defines the appearance and shape of a selected line point.
|
|
130
130
|
"""
|
|
131
|
+
|
|
132
|
+
curve_smoothness: ft.Number = 0.35
|
|
133
|
+
"""
|
|
134
|
+
Defines the smoothness of a curve line,
|
|
135
|
+
when [`curved`][..] is set to `True`.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
rounded_stroke_join: bool = False
|
|
139
|
+
"""
|
|
140
|
+
Whether to draw rounded line joins.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
step_direction: Optional[ft.Number] = None
|
|
144
|
+
"""
|
|
145
|
+
Determines the direction of each step.
|
|
146
|
+
|
|
147
|
+
If not `None`, this chart will be drawn as a
|
|
148
|
+
[Step Line Chart](https://docs.anychart.com/Basic_Charts/Step_Line_Chart).
|
|
149
|
+
|
|
150
|
+
Below are some typical values:
|
|
151
|
+
|
|
152
|
+
- `0.0`: Go to the next spot directly, with the current point's y value.
|
|
153
|
+
- `0.5`: Go to the half with the current spot y, and with the next spot y
|
|
154
|
+
for the rest.
|
|
155
|
+
- `1.0`: Go to the next spot y and direct line to the next spot.
|
|
156
|
+
"""
|
{flet_charts-0.2.0.dev40 → flet_charts-0.2.0.dev504}/src/flet_charts/line_chart_data_point.py
RENAMED
|
@@ -3,7 +3,7 @@ from typing import Optional, Union
|
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
6
|
-
from .types import ChartDataPointTooltip, ChartPointLine, ChartPointShape
|
|
6
|
+
from flet_charts.types import ChartDataPointTooltip, ChartPointLine, ChartPointShape
|
|
7
7
|
|
|
8
8
|
__all__ = ["LineChartDataPoint", "LineChartDataPointTooltip"]
|
|
9
9
|
|
|
@@ -19,13 +19,14 @@ class LineChartDataPointTooltip(ChartDataPointTooltip):
|
|
|
19
19
|
When `None`, defaults to [`LineChartDataPoint.y`][(p).].
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
def
|
|
22
|
+
def copy(
|
|
23
23
|
self,
|
|
24
24
|
*,
|
|
25
25
|
text: Optional[str] = None,
|
|
26
26
|
text_style: Optional[ft.TextStyle] = None,
|
|
27
27
|
text_align: Optional[ft.TextAlign] = None,
|
|
28
28
|
text_spans: Optional[list[ft.TextSpan]] = None,
|
|
29
|
+
rtl: Optional[bool] = None,
|
|
29
30
|
) -> "LineChartDataPointTooltip":
|
|
30
31
|
"""
|
|
31
32
|
Returns a copy of this object with the specified properties overridden.
|
|
@@ -37,6 +38,7 @@ class LineChartDataPointTooltip(ChartDataPointTooltip):
|
|
|
37
38
|
text_spans=text_spans.copy()
|
|
38
39
|
if text_spans is not None
|
|
39
40
|
else (self.text_spans.copy() if self.text_spans is not None else None),
|
|
41
|
+
rtl=rtl if rtl is not None else self.rtl,
|
|
40
42
|
)
|
|
41
43
|
|
|
42
44
|
|
|
@@ -3,8 +3,8 @@ from typing import Optional
|
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
6
|
-
from .pie_chart_section import PieChartSection
|
|
7
|
-
from .types import ChartEventType
|
|
6
|
+
from flet_charts.pie_chart_section import PieChartSection
|
|
7
|
+
from flet_charts.types import ChartEventType
|
|
8
8
|
|
|
9
9
|
__all__ = ["PieChart", "PieChartEvent"]
|
|
10
10
|
|
|
@@ -37,7 +37,7 @@ class PieChart(ft.ConstrainedControl):
|
|
|
37
37
|
"""
|
|
38
38
|
A pie chart control displaying multiple sections as slices of a circle.
|
|
39
39
|
|
|
40
|
-

|
|
41
41
|
"""
|
|
42
42
|
|
|
43
43
|
sections: list[PieChartSection] = field(default_factory=list)
|
|
@@ -74,6 +74,11 @@ class PieChartSection(ft.BaseControl):
|
|
|
74
74
|
and `1.0`(near the outside of the chart) inclusive.
|
|
75
75
|
"""
|
|
76
76
|
|
|
77
|
+
gradient: Optional[ft.Gradient] = None
|
|
78
|
+
"""
|
|
79
|
+
Defines the gradient of section. If specified, overrides the color setting.
|
|
80
|
+
"""
|
|
81
|
+
|
|
77
82
|
def before_update(self):
|
|
78
83
|
super().before_update()
|
|
79
84
|
assert self.title_position is None or (0.0 <= self.title_position <= 1.0), (
|