Skip to content

Commit 4667e02

Browse files
committed
Update docs
1 parent fba9f62 commit 4667e02

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

docs/guide/dashboard-widgets/graph.md

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,61 @@
11
# Graph widget
22

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:
44

5-
## Types
5+
## Line
66

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:
814

9-
### Line graph
15+
### `setShowDots(bool $showDots = true)`
1016

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
1124
```php
1225
$widgetsContainer->addWidget(
13-
SharpLineGraphWidget::make('sales')
26+
SharpAreaGraphWidget::make('sales')
1427
);
1528
```
1629

17-
### Bar graph
30+
Along with the [common configuration](#common-configuration), the following methods are available:
1831

32+
### `setCurvedLines(bool $curvedLines = true)`
33+
34+
Display lines with curved angles. Default is `true`.
35+
36+
## Bar
1937
```php
2038
$widgetsContainer->addWidget(
2139
SharpBarGraphWidget::make('sales')
2240
);
2341
```
2442

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
2651

2752
```php
2853
$widgetsContainer->addWidget(
2954
SharpPieGraphWidget::make('sales')
3055
);
3156
```
3257

33-
## Attributes (setters)
58+
## Common configuration
3459

3560
### `setRatio(string $ratio)`
3661

@@ -50,15 +75,11 @@ If true, legend and axis are hidden. Default is `false`.
5075

5176
### `setDisplayHorizontalAxisAsTimeline(bool $displayAsTimeline = true)`
5277

53-
**(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`.
5679

57-
**(Line only)** Display lines with curved angles. Default is `true`.
58-
59-
### `setHorizontal(bool $horizontal = true)`
80+
### `setEnableHorizontalAxisLabelSampling(bool $enableLabelSampling = true)`
6081

61-
**(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`.
6283

6384
## Data valuation
6485

0 commit comments

Comments
 (0)