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
+52-15Lines changed: 52 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,77 @@
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:
14
+
15
+
### `setShowDots(bool $showDots = true)`
16
+
17
+
Display dots on the graph lines.
8
18
9
-
### Line graph
19
+
### `setCurvedLines(bool $curvedLines = true)`
20
+
21
+
Display lines with curved angles. Default is `true`.
10
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:
31
+
32
+
### `setCurvedLines(bool $curvedLines = true)`
33
+
34
+
Display lines with curved angles. Default is `true`.
35
+
36
+
### `setOpacity(float $opacity)`
37
+
38
+
Change the opacity of the filled areas. Default is `0.4`.
18
39
40
+
### `setShowGradient(bool $showGradient = true)`
41
+
42
+
Display a gradient on top of the filled areas.
43
+
44
+
### `setStacked(bool $stacked = true)`
45
+
46
+
Stack areas on top of each other. Useful for comparing two or more series. The order of `->addGraphDataSet()` calls defines the stacking order.
**(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`.
94
+
**(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`.
54
95
55
-
### `setCurvedLines(bool $curvedLines = true)`
56
-
57
-
**(Line only)** Display lines with curved angles. Default is `true`.
**(Bar only)**Display horizontal bars instead of vertical ones. Default is `false`.
98
+
**(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