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

@push('scripts')
    <script type="text/javascript">
        $(document).ready(function () {
            const EChartPocetKontrolPodlaEmisnehoSystemuVozidla = echarts.init(document.getElementById('EChartPocetKontrolPodlaEmisnehoSystemuVozidla'), 'macarons');
            EChartPocetKontrolPodlaEmisnehoSystemuVozidla.setOption({
                backgroundColor: 'transparent',
                grid: {
                    left: 0,
                },
                legend: {
                    show: true,
                    type: 'plain',
                    align: 'right',
                    right: 0,
                    top: 0,
                    orient: 'vertical',
                    zlevel: 100,
                },
                tooltip: {
                    trigger: 'item',
                },
                series: [{
                    type: 'pie',
                    radius: ['30%', '70%'],
                    center: ['30%', '40%',],
                    itemStyle: {
                        borderRadius: 10,
                        borderColor: '#fff',
                        borderWidth: 2,
                    },
                    startAngle: 15,
                    encode: {
                        itemName: 'label',
                        value: 'pocet',
                    },
                    animation: true,
                    animationType: 'scale',
                    animationEasing: 'elasticOut',
                    animationDelay: function (idx) {
                        return Math.random() * 400;
                    },
                    label: {
                        show: true,
                        position: 'outside',
                        rotate: false,
                    },
                    datasetIndex: 1,
                }],
                dataset: [
                    {
                        dimensions: [
                            {
                                name: 'emisny_system',
                                type: 'ordinal',
                            },
                            {
                                name: 'label',
                                type: 'ordinal',
                            },
                            {
                                name: 'pocet',
                                type: 'number',
                            }
                        ],
                        source: @json($PocetKontrolPodlaEmisnehoSystemuVozidlaEChartSource ?? []),
                    },
                    {
                        transform: [
                            {
                                type: 'sort',
                                config: {
                                    dimension: 'emisny_system',
                                    order: 'asc',
                                },
                            }
                        ],
                    }
                ],
            });
        });
    </script>
@endpush
