Skip to content

Commit 0022f5b

Browse files
Docs: improves bar chart overlap documentation and fixes image source paths
1 parent 302682f commit 0022f5b

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

docs/images/chart_bar_overlap.png

37.9 KB
Loading

docs/usage/shapes/chart.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $chartShape = $slide->createChartShape();
1414

1515
You can define how blank values are displayed with the method `setDisplayBlankAs`.
1616

17-
![Slideshow type](/images/libreoffice_chart_displayblankas.png)
17+
![Slideshow type](../../images/libreoffice_chart_displayblankas.png)
1818

1919
Differents types are available:
2020

@@ -321,10 +321,10 @@ TODO
321321

322322
#### Gap Width
323323

324-
You can define the gap width between bar or columns clusters. It is defined in percent.
324+
You can define the gap width between bar or columns clusters. It is relatively defined as percentage of a bars width.
325325
The default value is 150%. The value must be defined between 0 and 500.
326326

327-
``` php
327+
```php
328328
<?php
329329

330330
$barChart = new Bar();
@@ -333,18 +333,25 @@ $barChart->setGapWidthPercent(250);
333333

334334
#### Overlap
335335

336-
You can define the bar overlap within bars or columns clusters. It is defined in percent.
337-
The default value is `100%` for stacked and `0%` for grouped bar charts. The value must be defined between -100 and 100.
338-
339-
When defining the bar grouping type, the default overlap values will be set. Any changes to the overlap must be made after setting the bar grouping type through `setBarGrouping`.
336+
You can define the bar overlap within bar or column clusters. It is relatively defined as percentage of a bars width.
337+
The default value is `100%` for stacked and `0%` for grouped bar charts. The value must be defined between `-100` and `100`.
340338

341-
``` php
342-
<?php
339+
When setting the bar grouping type, the default overlap values will be set. Any change to the overlap must be made after setting the bar grouping type through `setBarGrouping`.
343340

341+
```php
344342
$barChart = new Bar();
345-
$barChart->setOverlapWidthPercent(-10);
343+
// will set the overlap to the default value for grouped bars: 0
344+
$barChart->setBarGrouping(Bar::GROUPING_CLUSTERED);
345+
346+
// a positive value will result in an overlapping
347+
$barChart->setOverlapWidthPercent(25);
348+
349+
// a negative value will result in a gap
350+
$barChart->setOverlapWidthPercent(-25);
346351
```
347352

353+
![Bar Overlap](../../images/chart_bar_overlap.png)
354+
348355
#### Stacking
349356

350357
You can stack multiples series in a same chart. After adding multiples series, you can define the bar grouping with `setBarGrouping` method of AbstractTypeBar.
@@ -363,18 +370,11 @@ $barChart->setBarGrouping(Bar::GROUPING_STACKED);
363370
$barChart->setBarGrouping(Bar::GROUPING_PERCENTSTACKED);
364371
```
365372

366-
- Bar::GROUPING_CLUSTERED
367-
368-
![Bar::GROUPING_CLUSTERED](/images/chart_columns_52x60.png)
369-
370-
- Bar::GROUPING_STACKED
371-
372-
![Bar::GROUPING_STACKED](/images/chart_columnstack_52x60.png)
373-
374-
- Bar::GROUPING_PERCENTSTACKED
375-
376-
![Bar::GROUPING_PERCENTSTACKED](/images/chart_columnpercent_52x60.png)
377-
373+
| | Type | Constant |
374+
| --------------------------------------------------------------------------- | ------------ | ---------------------------- |
375+
| ![Bar::GROUPING_CLUSTERED](../../images/chart_columns_52x60.png) | Grouped Bars | Bar::GROUPING_CLUSTERED |
376+
| ![Bar::GROUPING_STACKED](../../images/chart_columnstack_52x60.png) | Stacked Bars | Bar::GROUPING_STACKED |
377+
| ![Bar::GROUPING_PERCENTSTACKED](../../images/chart_columnpercent_52x60.png) | Grouped Bars | Bar::GROUPING_PERCENTSTACKED |
378378

379379
### Line
380380

0 commit comments

Comments
 (0)