Files
firefly-iii/app/Generator/Chart/Basic/GeneratorInterface.php

92 lines
2.5 KiB
PHP
Raw Normal View History

2016-12-11 16:02:04 +01:00
<?php
/**
* GeneratorInterface.php
2017-10-21 08:40:00 +02:00
* Copyright (c) 2017 thegrumpydictator@gmail.com
2016-12-11 16:02:04 +01:00
*
2017-10-21 08:40:00 +02:00
* This file is part of Firefly III.
2016-12-11 16:02:04 +01:00
*
2017-10-21 08:40:00 +02:00
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
2016-12-11 16:02:04 +01:00
*/
declare(strict_types=1);
2016-12-11 16:02:04 +01:00
namespace FireflyIII\Generator\Chart\Basic;
/**
* Interface GeneratorInterface
*
* @package FireflyIII\Generator\Chart\Basic
*/
interface GeneratorInterface
{
2016-12-11 17:05:48 +01:00
2016-12-11 16:02:04 +01:00
/**
2017-06-02 12:59:27 +02:00
* Will generate a Chart JS compatible array from the given input. Expects this format
*
* Will take labels for all from first set.
2016-12-11 16:02:04 +01:00
*
* 0: [
* 'label' => 'label of set',
2017-06-02 12:59:27 +02:00
* 'type' => bar or line, optional
* 'yAxisID' => ID of yAxis, optional, will not be included when unused.
* 'fill' => if to fill a line? optional, will not be included when unused.
2016-12-11 16:02:04 +01:00
* 'entries' =>
* [
* 'label-of-entry' => 'value'
* ]
* ]
* 1: [
* 'label' => 'label of another set',
2017-06-02 12:59:27 +02:00
* 'type' => bar or line, optional
* 'yAxisID' => ID of yAxis, optional, will not be included when unused.
* 'fill' => if to fill a line? optional, will not be included when unused.
2016-12-11 16:02:04 +01:00
* 'entries' =>
* [
* 'label-of-entry' => 'value'
* ]
* ]
*
2017-06-02 12:59:27 +02:00
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
2016-12-11 16:02:04 +01:00
*
* @param array $data
*
* @return array
*/
public function multiSet(array $data): array;
2016-12-14 18:59:12 +01:00
/**
* Expects data as:
*
* key => value
*
* @param array $data
*
* @return array
*/
public function pieChart(array $data): array;
2016-12-11 16:25:25 +01:00
/**
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
*
* 'label-of-entry' => value
* 'label-of-entry' => value
*
* @param string $setLabel
* @param array $data
*
* @return array
*/
public function singleSet(string $setLabel, array $data): array;
}