-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathPieGraphWidgetData.php
More file actions
39 lines (34 loc) · 1.1 KB
/
PieGraphWidgetData.php
File metadata and controls
39 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace Code16\Sharp\Data\Dashboard\Widgets;
use Code16\Sharp\Dashboard\Widgets\Graph\NumberFormatOptions;
use Code16\Sharp\Data\Data;
use Code16\Sharp\Enums\GraphWidgetDisplay;
use Code16\Sharp\Enums\WidgetType;
use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType;
use Spatie\TypeScriptTransformer\Attributes\Optional;
/**
* @internal
*/
final class PieGraphWidgetData extends Data
{
#[Optional]
public GraphWidgetValueData $value;
public function __construct(
public string $key,
#[LiteralTypeScriptType('"'.WidgetType::Graph->value.'"')]
public WidgetType $type,
#[LiteralTypeScriptType('"'.GraphWidgetDisplay::Pie->value.'"')]
public GraphWidgetDisplay $display,
public ?string $title,
public bool $showLegend,
public bool $minimal,
public ?int $ratioX = null,
public ?int $ratioY = null,
public ?int $height = null,
public ?NumberFormatOptions $formatOptions = null,
) {}
public static function from(array $widget): self
{
return new self(...$widget);
}
}