|
1 | 1 | @use('Brick\Math\BigDecimal') |
2 | 2 | @use('Brick\Money\Money') |
3 | | -@use('PhpOffice\PhpSpreadsheet\Cell\DataType') |
| 3 | +@use('Illuminate\Support\Carbon') |
4 | 4 | @use('Carbon\CarbonInterval') |
5 | 5 | @inject('colorService', 'App\Service\ColorService') |
6 | 6 | <!DOCTYPE html> |
7 | 7 | <html lang="en"> |
8 | 8 | <head> |
9 | | - <meta charset="utf-8" /> |
| 9 | + <meta charset="utf-8"/> |
10 | 10 | <title>Report</title> |
11 | 11 | <style> |
12 | 12 | html, body, div, span, applet, object, iframe, |
|
130 | 130 |
|
131 | 131 | @if($debug) |
132 | 132 | <link rel="preconnect" href="https://fonts.bunny.net"> |
133 | | - <link href="https://fonts.bunny.net/css?family=outfit:200,300,400,500,600,700,800" rel="stylesheet" /> |
| 133 | + <link href="https://fonts.bunny.net/css?family=outfit:200,300,400,500,600,700,800" rel="stylesheet"/> |
134 | 134 | @endif |
135 | 135 |
|
136 | 136 | </head> |
|
356 | 356 | animation: false, |
357 | 357 | tooltip: {}, |
358 | 358 | xAxis: { |
359 | | - data: ['{!! collect($dataHistoryChart['grouped_data'])->pluck('key')->implode("', '") !!}'], |
| 359 | + data: {!! |
| 360 | + json_encode(collect($dataHistoryChart['grouped_data']) |
| 361 | + ->pluck('key') |
| 362 | + ->map(fn($value) => $localization->formatDate(Carbon::parse($value))) |
| 363 | + ->toArray()) |
| 364 | + !!}, |
360 | 365 | axisLabel: { |
361 | 366 | fontSize: 10, |
362 | 367 | fontWeight: 400, |
|
381 | 386 | axisLabel: { |
382 | 387 | show: false, |
383 | 388 | inside: true, |
384 | | - formatter: function(value, index) { |
385 | | - let totalSeconds = value; |
386 | | - let hours = Math.floor(totalSeconds / 3600); |
387 | | - if (hours < 10) { |
388 | | - hours = "0" + hours; |
389 | | - } |
390 | | - totalSeconds %= 3600; |
391 | | - let minutes = Math.floor(totalSeconds / 60); |
392 | | - if (minutes < 10) { |
393 | | - minutes = "0" + minutes; |
394 | | - } |
395 | | - return hours + ":" + minutes; |
396 | | - } |
397 | 389 | } |
398 | 390 | }, |
399 | 391 | series: [ |
400 | 392 | { |
401 | 393 | name: "time", |
402 | 394 | type: "bar", |
403 | | - data: [{!! collect($dataHistoryChart['grouped_data'])->pluck('seconds')->implode(', ') !!}], |
| 395 | + data: {!! json_encode(collect($dataHistoryChart['grouped_data'])->map(fn($value) => (object) [ |
| 396 | + 'value' => $value['seconds'], |
| 397 | + 'name' => ((int) $value['seconds']) === 0 ? '' : $localization->formatInterval(CarbonInterval::seconds((int) $value['seconds'])) |
| 398 | + ])->toArray()) !!}, |
404 | 399 | itemStyle: { |
405 | 400 | borderColor: "#7dd3fc", |
406 | 401 | color: "#7dd3fc" |
|
413 | 408 | @endif |
414 | 409 | fontSize: 10, |
415 | 410 | position: "top", |
416 | | - formatter: function(params) { |
417 | | - let value = params.value; |
418 | | - if (value === 0) { |
419 | | - return ""; |
420 | | - } |
421 | | - let totalSeconds = value; |
422 | | - let hours = Math.floor(totalSeconds / 3600); |
423 | | - if (hours < 10) { |
424 | | - hours = "0" + hours; |
425 | | - } |
426 | | - totalSeconds %= 3600; |
427 | | - let minutes = Math.floor(totalSeconds / 60); |
428 | | - if (minutes < 10) { |
429 | | - minutes = "0" + minutes; |
430 | | - } |
431 | | - return hours + ":" + minutes; |
| 411 | + formatter: function (params) { |
| 412 | + return params.name; |
432 | 413 | } |
433 | 414 | } |
434 | 415 | } |
|
0 commit comments