fix metric
This commit is contained in:
parent
cc835b3692
commit
f38719837e
|
@ -48,7 +48,7 @@ abstract class Metric extends Widget
|
||||||
{
|
{
|
||||||
$filter = collect($filters)->firstWhere('value', $this->data['filter'] ?? null) ?? collect($filters)->first();
|
$filter = collect($filters)->firstWhere('value', $this->data['filter'] ?? null) ?? collect($filters)->first();
|
||||||
|
|
||||||
$computed = is_array($filter) ? $filter['callback']($this->data) : [];
|
$computed = is_array($filter) ? $filter['callback']() : [];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'filter' => $filter['value'],
|
'filter' => $filter['value'],
|
||||||
|
@ -74,19 +74,18 @@ abstract class Metric extends Widget
|
||||||
|
|
||||||
public function progress($current, $target)
|
public function progress($current, $target)
|
||||||
{
|
{
|
||||||
return $this->output([
|
return [
|
||||||
'type' => 'progress',
|
'type' => 'progress',
|
||||||
'value' => $current,
|
'value' => $current,
|
||||||
'target' => $target,
|
'target' => $target,
|
||||||
]);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function trend($value, $previous = null)
|
public function trend($values)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type' => 'trend',
|
'type' => 'trend',
|
||||||
'value' => $value,
|
'values' => $values,
|
||||||
'previous' => $previous,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +97,12 @@ abstract class Metric extends Widget
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function value($value)
|
public function value($value, $previous = null)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type' => 'value',
|
'type' => 'value',
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
|
'previous' => $previous,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue