Friday, 1 November 2019

highcharts map responsive (ionic)

So i am trying to use Highcharts map in my ionic app and after a while i actually made it work. However there are still some issues with the responsiveness:

enter image description here

it seems that it is pushed out to the edge of the screen instead of being in the center

Here is the html:

    <ion-row>
    <ion-grid>
        <ion-col>
            <h2>Danmark</h2>
            <highcharts-chart
                    [Highcharts]="Highcharts"
                    [constructorType]="'mapChart'"
                    [options]="chartMap"

            ></highcharts-chart>
        </ion-col>
    </ion-grid>
</ion-row>

And here is my js

    chartMap: Highcharts.Options = {
        chart: {
            map: mapWorld
        },
        title: {
            text: ''
        },
        mapNavigation: {
            enabled: true,
            enableButtons: false
        },
        legend: {
            enabled: true
        },
        colorAxis: {
            min: 0
        },
        responsive: {
            rules: [{
                condition: {
                    maxWidth: 200
                },
                chartOptions: {
                    legend: {
                        enabled: false
                    }
                }
            }]
        },
        series: [{
            name: 'Random data',
            states: {
                hover: {
                    color: '#BADA55'
                }
            },
            dataLabels: {
                enabled: true,
                format: '{point.name}'
            },
            allAreas: false,
            data: [
                ['dk-6326', 0],
                ['dk-3564', 1],
                ['dk-3568', 2],
                ['dk-6325', 3],
                ['dk-3563', 4]
            ]

        } as Highcharts.SeriesMapOptions]
    };

Can anyone help me out making this responsive?



from highcharts map responsive (ionic)

No comments:

Post a Comment