Highcharts - prevent large marker from overflowing

2019-05-25 02:30发布

问题:

This picture should say it all. I'm trying to implement a bubble chart with HighCharts (basically a scatter plot with marker size changing based on some metric). Sadly, some of my bubbles are trying to escape the chart, overflowing the axis and making things look messy and hard-to-read. Any way to prevent this? Obviously I could manipulate the range of the axes, but I'd rather just hide the overflowing part of the bubble. Besides, this is not an option if the x-axis is required to start at 0 (for example). Pics:

Overflow (Highcharts):

No Overflow (Chart director). This is what I want:

回答1:

I advice to try to use v3.0 beta release which should solve your problem. Please take look at example:

http://jsfiddle.net/g8JcL/68/

 $('#container').highcharts({

    chart: {
        type: 'bubble',
        plotBorderWidth: 1,
        zoomType: 'xy'
    },

    title: {
        text: 'Highcharts bubbles with radial gradient fill'
    },

    xAxis: {
        minPadding:0,
        gridLineWidth: 1
    },

    yAxis: {
        startOnTick: false,
        endOnTick: false
    },

    series: [ {
        data: [
            [42, 38, 500],
            [6, 18, 1],
            [0, 93, 505],
            [57, 2, 90],
            [80, 76, 22],
            [11, 74, 96],
            [88, 56, 10],
            [30, 47, 49],
            [57, 62, 98],
            [4, 16, 16],
            [46, 10, 11],
            [22, 87, 89],
            [57, 91, 82],
            [45, 15, 98]
        ]
    }]

});


标签: highcharts