<div id="EChartPocetKontrolPodlaHodnotenia" style="height:400px"></div>

@push('scripts')
    <script type="text/javascript">
        $(document).ready(function () {
            const EChartPocetKontrolPodlaHodnotenia = echarts.init(document.getElementById('EChartPocetKontrolPodlaHodnotenia'), 'macarons');
            EChartPocetKontrolPodlaHodnotenia.setOption({
                backgroundColor: 'transparent',
                grid: {
                    height: 200,
                    width: '90%',
                    left: '5%',
                    right: 1,
                },
                legend: {
                    show: true,
                    type: 'plain',
                    zlevel: 100,
                },
                tooltip: {
                    'trigger': 'item',
                },
                dataset: [
                    {
                        dimensions: [
                            {
                                name: 'label',
                                type: 'ordinal',
                                displayName: 'Druh kontroly',
                            },
                            {
                                name: 'SPOSOBILE',
                                type: 'int',
                                displayName: 'Spôsobilé',
                            },
                            {
                                name: 'NESPOSOBILE',
                                type: 'int',
                                displayName: 'Nespôsobilé',
                            },
                            {
                                name: 'DOCASNE_SPOSOBILE',
                                type: 'int',
                                displayName: 'Dočasne spôsobilé',
                            },
                            {
                                name: 'NEHODNOTENE',
                                type: 'int',
                                displayName: 'Nehodnotené',
                            }
                        ],
                        source: @json($PocetKontrolPodlaDruhuAHodnoteniaEChartSource ?? []),
                    },
                    {
                        transform: [
                            {
                                type: 'sort',
                                config: {
                                    dimension: 'label',
                                    order: 'asc'
                                }
                            }
                        ]
                    }
                ],
                xAxis: {
                    type: 'category',
                    axisLabel: {
                        rotate: -15,
                        margin: 15,
                        overflow: 'truncate',
                    },
                },
                yAxis: {
                    type: null,
                    minInterval: 1
                },
                series: [
                    {
                        type: 'bar',
                        datasetIndex: 1,
                    },
                    {
                        type: 'bar',
                        datasetIndex: 1,
                    },
                    {
                        type: 'bar',
                        datasetIndex: 1,
                    },
                    {
                        type: 'bar',
                        datasetIndex: 1,
                    },
                ],
            });
        });
    </script>
@endpush
