Highcharts - prevent large marker from overflowing axes - my bubbles are escaping =(

可紊 提交于 2019-12-22 17:59:19

问题


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]
        ]
    }]

});


来源:https://stackoverflow.com/questions/15535932/highcharts-prevent-large-marker-from-overflowing-axes-my-bubbles-are-escapin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!