krzysztof-gzocha/simple-data-visualization — pull request #5 by krzysztof-gzocha (2014-06-06 17:42:59+00:00)
Title: Chart model

This code is closed into SubjectChartFactory:
```php
$chartFactory = new ChartFactory();
$series = [
[
'activeQuery' => Measurement::find()
->select([self::VALUE_PARAM_NAME, 'dateTime'])
->where(['subject' => $id])
->orderBy('dateTime asc'),
'valueParamName' => self::VALUE_PARAM_NAME,
'argumentParamName' => 'dateTime',
'name' => sprintf('Measurements from subject %d', $id),
],
];
$chart = $chartFactory->build('Wykres testowy', 'Czas', 'Wartosc', $series);
```

Usage now:
```php
$chart = (new SubjectChartFactory())->buildChart(Subject::findOne($id));
```
You can pass additional subject to render multiple series on one chart.
I know its not so pretty :(