Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit eec147a

Browse files
committed
Update README.md
1 parent 202647c commit eec147a

File tree

5 files changed

+39
-33
lines changed

5 files changed

+39
-33
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All Notable changes to `Period Visualizer` will be documented in this file
44

5-
## 0.6.0 - 2019-09-13
5+
## 0.6.0 - 2019-09-20
66

77
- The `OutputWriter` is now a property of `GanttChartConfig`
88
- Renamed `Graph` to `Chart`

README.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ $dataset = new Dataset([
8585
results:
8686

8787
~~~bash
88-
A [------------------------------------------------------------------------------)
89-
B [------------------------------------------)
88+
A [----------------------------------------------)
89+
B [-------------------------)
9090
~~~
9191

9292
### Appending items to display
@@ -115,9 +115,9 @@ $dataset->append('GAPS', $sequence->gaps());
115115
results:
116116

117117
~~~bash
118-
A [---------------------)
119-
B [---------------------------------)
120-
GAPS [----------------------)
118+
A [-------------)
119+
B [----------------)
120+
GAPS [------------)
121121
~~~
122122

123123
The `Dataset` implements the `Countable` and the `IteratorAggregate` interface. It also exposes the following methods:
@@ -172,8 +172,8 @@ $dataset = Dataset::fromSequence(
172172
results:
173173

174174
~~~bash
175-
aa [------------------------------------------------------------------------------)
176-
ab [-----------------------------------)
175+
aa [-----------------------------------)
176+
ab [----------)
177177
~~~
178178

179179
The `LatinLetter` also exposes the following methods:
@@ -208,8 +208,8 @@ $dataset = Dataset::fromSequence(
208208
results:
209209

210210
~~~bash
211-
42 [------------------------------------------------------------------------------)
212-
43 [-----------------------------------)
211+
42 [-----------------------------------)
212+
43 [----------)
213213
~~~
214214

215215
The `DecimalNumber` also exposes the following methods:
@@ -247,8 +247,8 @@ $dataset = Dataset::fromSequence(
247247
results:
248248

249249
~~~bash
250-
v [------------------------------------------------------------------------------)
251-
vi [-----------------------------------)
250+
v [-----------------------------------)
251+
vi [----------)
252252
~~~
253253

254254
The `RomanNumber` also exposes the following methods:
@@ -294,8 +294,8 @@ $dataset = Dataset::fromSequence(
294294
results:
295295

296296
~~~bash
297-
* v .) [----------------------------------------------------------)
298-
* vi .) [--------------------------)
297+
* v .) [-----------------------------------)
298+
* vi .) [----------)
299299
~~~
300300

301301
The `AffixLabel` also exposes the following methods:
@@ -340,8 +340,8 @@ $dataset = Dataset::fromSequence(
340340
results:
341341

342342
~~~bash
343-
vi. [------------------------------------------------------------------------------)
344-
v. [-----------------------------------)
343+
vi. [-----------------------------------)
344+
v. [----------)
345345
~~~
346346

347347
### Custom LabelGenerator
@@ -381,15 +381,15 @@ $dataset = Dataset::fromSequence(
381381
results:
382382

383383
~~~bash
384-
foobar. [------------------------------------------------------------------------------)
385384
foobar. [-----------------------------------)
385+
foobar. [----------)
386386
~~~
387387

388388
## Displaying the Dataset
389389

390390
The `GanttChart` class is responsible for generating the graph from the `Dataset` by implementing the `Graph` interface for the console.
391391

392-
The `GanttChart::display` methods expects a `Dataset` object as its unique argument.
392+
The `GanttChart::stroke` methods expects a `Dataset` object as its unique argument.
393393

394394
If you wish to present the graph on another medium like a web browser or an image, you will need to implement the interface for your implementation.
395395

@@ -410,24 +410,23 @@ $graph->stroke(new Dataset([
410410
results:
411411

412412
~~~bash
413-
first [----------------------------------------------------)
414-
last [----------------------------------------------------)
413+
first [---------------------------)
414+
last [------------------------------)
415415
~~~
416416

417417
### Customized the graph looks
418418

419-
The `GanttChart` class can be customized by:
420-
421-
- providing a `GanttChartConfig` which defines:
422-
- the graph settings (How the intervals will be created)
423-
- sets single characters to represent the boundary types
424-
- sets single characters to represent the body and space
425-
- the console output settings. (How the intervals will be displayed)
426-
- sets the graph width
427-
- sets the graph colors
428-
- sets the gap between the labels and the rows
429-
- sets the label alignment
430-
- the console output via a `OutputWriter` implementing class.
419+
The `GanttChart` class can be customized by providing a `GanttChartConfig` which defines:
420+
421+
- the output medium via a `OutputWriter` implementing class.
422+
- the graph settings. (How the intervals will be stroked)
423+
- sets the graph width
424+
- sets the graph colors
425+
- sets the gap between the labels and the rows
426+
- sets the label alignment
427+
- the output settings (How the intervals will be created)
428+
- sets single characters to represent the boundary types
429+
- sets single characters to represent the body and space
431430

432431
You can easily create a `OutputWriter` implementing class with libraries like `League CLImate` or `Symfony Console`
433432
to output the resulting graph. If you don't, the package ships with a minimal `ConsoleOutput` class which is used
@@ -437,6 +436,7 @@ to output the resulting graph. If you don't, the package ships with a minimal `C
437436
<?php
438437
439438
use Bakame\Period\Visualizer\AffixLabel;
439+
use Bakame\Period\Visualizer\ConsoleOutput;
440440
use Bakame\Period\Visualizer\Dataset;
441441
use Bakame\Period\Visualizer\DecimalNumber;
442442
use Bakame\Period\Visualizer\GanttChart;
@@ -448,6 +448,7 @@ use League\Period\Period;
448448
use League\Period\Sequence;
449449
450450
$config = GanttChartConfig::createFromRainbow()
451+
->withOutput(new ConsoleOutput(STDOUT))
451452
->withStartExcluded('🍕')
452453
->withStartIncluded('🍅')
453454
->withEndExcluded('🎾')

src/Dataset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ public function getIterator(): \Iterator
162162
}
163163
}
164164

165+
/**
166+
* @var array<int, array{label:string, item:Sequence}>.
167+
*/
165168
public function jsonSerialize(): array
166169
{
167170
return array_map(function (array $pair) {

src/LabelGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ interface LabelGenerator
1717
{
1818
/**
1919
* Returns the labels to associate with all items.
20+
*
21+
* @return string[]
2022
*/
2123
public function generate(int $nbLabels): array;
2224

src/OutputWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface OutputWriter
2929
OutputWriter::COLOR_BLACK,
3030
OutputWriter::COLOR_RED,
3131
OutputWriter::COLOR_GREEN,
32-
OutputWriter::COLOR_YELLOW ,
32+
OutputWriter::COLOR_YELLOW,
3333
OutputWriter::COLOR_BLUE,
3434
OutputWriter::COLOR_MAGENTA,
3535
OutputWriter::COLOR_CYAN,

0 commit comments

Comments
 (0)