Seth McClaine
Seth McClaine

Reputation: 10040

How to increase series data label in highcharts packed bubble

Using the sample provided by highcharts (less some data for easier visability) https://jsfiddle.net/mevbg82z/2/

I'm trying to make the bubble labels ('USA', 'Canada', 'Mexico', 'Brazil') bigger.

I've looked at the series API for packedbubble but haven't found a way to increase the size of the text in the bubbles through options https://api.highcharts.com/highcharts/series.packedbubble

The only way I've found to do this is to write css, which doesn't handle scaling, doesn't center up, and generally seems hacky...

.highcharts-data-label text tspan {
    font-size: 24px
}

Whats the correct way to increase the size of these labels?

Upvotes: 0

Views: 307

Answers (1)

Seth McClaine
Seth McClaine

Reputation: 10040

Looks like you can set fontSize inside plotOptions.packedbubble.dataLabels

plotOptions: {
    packedbubble: {
        minSize: '20%',
        maxSize: '100%',
        zMin: 0,
        zMax: 1000,
        layoutAlgorithm: {
            gravitationalConstant: 0.05,
            splitSeries: true,
            seriesInteraction: false,
            dragBetweenSeries: true,
            parentNodeLimit: true
        },
        dataLabels: {
            enabled: true,
            format: '{point.name}',
            filter: {
                property: 'y',
                operator: '>',
                value: 250
            },
            style: {
                color: 'black',
                textOutline: 'none',
                fontWeight: 'normal',
                fontSize: '24px'
            }
        }
    }
},

Upvotes: 1

Related Questions