You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/dashboard-widgets/graph.md
+36-15Lines changed: 36 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,61 @@
1
1
# Graph widget
2
2
3
-
This widget intends to display a graph visualization of any data.
3
+
This widget intends to display a graph visualization of any data. There are four graph types, and they mostly share the same API. To choose one or the other, use its dedicated class:
4
4
5
-
## Types
5
+
## Line
6
6
7
-
There are three graph types, and they mostly share the same API. To choose one or the other, use its dedicated class:
7
+
```php
8
+
$widgetsContainer->addWidget(
9
+
SharpLineGraphWidget::make('sales')
10
+
);
11
+
```
12
+
13
+
Along with the [common configuration](#common-configuration), the following methods are available:
8
14
9
-
### Line graph
15
+
### `setShowDots(bool $showDots = true)`
10
16
17
+
Display dots on the graph lines.
18
+
19
+
### `setCurvedLines(bool $curvedLines = true)`
20
+
21
+
Display lines with curved angles. Default is `true`.
22
+
23
+
## Area
11
24
```php
12
25
$widgetsContainer->addWidget(
13
-
SharpLineGraphWidget::make('sales')
26
+
SharpAreaGraphWidget::make('sales')
14
27
);
15
28
```
16
29
17
-
### Bar graph
30
+
Along with the [common configuration](#common-configuration), the following methods are available:
18
31
32
+
### `setCurvedLines(bool $curvedLines = true)`
33
+
34
+
Display lines with curved angles. Default is `true`.
35
+
36
+
## Bar
19
37
```php
20
38
$widgetsContainer->addWidget(
21
39
SharpBarGraphWidget::make('sales')
22
40
);
23
41
```
24
42
25
-
### Pie graph
43
+
Along with the [common configuration](#common-configuration), the following methods are available:
44
+
45
+
### `setHorizontal(bool $horizontal = true)`
46
+
47
+
Display horizontal bars instead of vertical ones. Default is `false`.
48
+
49
+
50
+
## Pie
26
51
27
52
```php
28
53
$widgetsContainer->addWidget(
29
54
SharpPieGraphWidget::make('sales')
30
55
);
31
56
```
32
57
33
-
## Attributes (setters)
58
+
## Common configuration
34
59
35
60
### `setRatio(string $ratio)`
36
61
@@ -50,15 +75,11 @@ If true, legend and axis are hidden. Default is `false`.
**(Line and Bar)** If true, and if X axis values are valid dates, the graph will create a timeline repartition of dates, creating visual gaps between dates. Default is `false`.
54
-
55
-
### `setCurvedLines(bool $curvedLines = true)`
78
+
**(Line, Area, Bar)** If true, and if X axis values are valid dates, the graph will create a timeline repartition of dates, creating visual gaps between dates. Default is `false`.
56
79
57
-
**(Line only)** Display lines with curved angles. Default is `true`.
**(Bar only)**Display horizontal bars instead of vertical ones. Default is `false`.
82
+
**(Line, Area, Bar)**If true, only some labels will be displayed depending on available space. It prevents label rotation. This method has no impact when `setDisplayHorizontalAxisAsTimeline()` is called. Default is `false`.
0 commit comments