Skip to content

Commit 5ab5bbd

Browse files
committed
wip
1 parent 08722b1 commit 5ab5bbd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@ composer require brendt/php-sparkline
2020
$sparkLine = SparkLine::new($days);
2121

2222
$total = $sparkLine->getTotal();
23-
$period = $sparkLine->getPeriod();
23+
$period = $sparkLine->getPeriod(); // Spatie\Period
2424
$svg = $sparkLine->make();
2525
```
2626

2727
![](./.github/img/0.png)
2828

29-
---
29+
### Customization
30+
31+
This package offers some methods to customize the sparkline. First off, you can pick any amount of colors and the sparkline will automatically generate a gradient from them:
3032

3133
```php
3234
$sparkLine = SparkLine::new($days)->withColors('#4285F4', '#31ACF2', '#2BC9F4');
3335
```
3436

3537
![](./.github/img/1.png)
3638

37-
---
39+
Next, you can configure a bunch of numbers:
3840

3941
```php
4042
$sparkLine = SparkLine::new($days)
@@ -46,6 +48,11 @@ $sparkLine = SparkLine::new($days)
4648

4749
![](./.github/img/2.png)
4850

51+
- **`withStrokeWidth`** will determine the stroke's width
52+
- **`withDimensions`** will determine the width and height of the rendered SVG
53+
- **`withMaxItemAmount`** will determine how many days will be shown. If you originally passed on more days than this max, then the oldest ones will be omitted. If the max amount is set to a number that's _higher_ than the current amount of days, then the sparkline will contain empty days. By default, the amount of given days will be used.
54+
- **`withMaxValue``** will set the maximum value of the sparkline. This is useful if you have multiple sparklines that should all have the same scale. By default, the maximum value is determined based on the given days.
55+
4956
## Testing
5057

5158
```bash

0 commit comments

Comments
 (0)