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

@push('scripts')
    <script type="text/javascript">
        $(document).ready(function () {
            const EChartPocetKontrolPodlaSubjektuFakturacie = echarts.init(document.getElementById('EChartPocetKontrolPodlaSubjektuFakturacie'), 'macarons');
            EChartPocetKontrolPodlaSubjektuFakturacie.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: 'Názov subjektu',
                            },
                            {
                                name: 'pocet',
                                type: 'int',
                                displayName: 'Počet',
                            },
                        ],
                        source: @json($PocetKontrolAObratuPodlaSubjektuFakturacieEChartSource ?? []),
                    },
                    {
                        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,
                    },
                ],
            });
        });
    </script>
@endpush
