|
1 | 1 | <div wire:ignore>
|
2 |
| - <div style="position: relative; height:40vh;"> |
| 2 | + <div style="position: relative;"> |
3 | 3 | <canvas id="{{ $chart_id }}"></canvas>
|
4 | 4 | </div>
|
5 | 5 | </div>
|
|
20 | 20 | grid: @json($x_grid),
|
21 | 21 | ticks: {
|
22 | 22 | callback: function(value, index, ticks) {
|
23 |
| - let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
24 |
| - return String("{!! $left_x_unit !!}") + formatted + String("{!! $right_x_unit !!}"); |
| 23 | + let formatterName = String("{!! $formatter_name !!}"); |
| 24 | + if(formatterName === 'number') { |
| 25 | + let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
| 26 | + return String("{!! $left_x_unit !!}") + formatted + String("{!! $right_x_unit !!}"); |
| 27 | + } else { |
| 28 | + return String("{!! $left_x_unit !!}") + this.getLabelForValue(value) + String("{!! $right_x_unit !!}"); |
| 29 | + } |
25 | 30 | }
|
26 | 31 | }
|
27 | 32 | },
|
|
32 | 37 | grid: @json($y_grid),
|
33 | 38 | ticks: {
|
34 | 39 | callback: function(value, index, ticks) {
|
35 |
| - let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
36 |
| - return String("{!! $left_y_unit !!}") + formatted + String("{!! $right_y_unit !!}"); |
| 40 | + let formatterName = String("{!! $formatter_name !!}"); |
| 41 | + if(formatterName === 'number') { |
| 42 | + let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
| 43 | + return String("{!! $left_y_unit !!}") + formatted + String("{!! $right_y_unit !!}"); |
| 44 | + } else { |
| 45 | + return String("{!! $left_y_unit !!}") + this.getLabelForValue(value) + String("{!! $right_y_unit !!}"); |
| 46 | + } |
37 | 47 | }
|
38 | 48 | }
|
39 | 49 | },
|
|
43 | 53 | grid: @json($y1_grid),
|
44 | 54 | ticks: {
|
45 | 55 | callback: function(value, index, ticks) {
|
46 |
| - let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
47 |
| - return String("{!! $left_y1_unit !!}") + formatted + String("{!! $right_y1_unit !!}"); |
| 56 | + let formatterName = String("{!! $formatter_name !!}"); |
| 57 | + if(formatterName === 'number') { |
| 58 | + let formatted = Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]); |
| 59 | + return String("{!! $left_y1_unit !!}") + formatted + String("{!! $right_y1_unit !!}"); |
| 60 | + } else { |
| 61 | + return String("{!! $left_y1_unit !!}") + this.getLabelForValue(value) + String("{!! $right_y1_unit !!}"); |
| 62 | + } |
48 | 63 | }
|
49 | 64 | }
|
50 | 65 | }
|
|
0 commit comments