简体   繁体   中英

Highcharts Zoom in Logarithmic Scale

I was toying around with the Logarithmic Scale in Highcharts. Noticed that the zoom behaves in a weird manner when close to minValue.

The fiddle here is a slightly modified example of the original fiddle that Highcharts had for demonstrating a line chart over log scale.

Here is the code in full for a column chart that utilizes a log scale.

$(function () {
    $('#container').highcharts({
        chart: {
            type:'column',
            zoomType:'xy'
        },
        title: {
            text: 'Logarithmic axis demo'
        },
        xAxis: {
            tickInterval: 1
        },
        yAxis: {
            type: 'logarithmic',
            minorTickInterval: 0.1
        },
        tooltip: {
            headerFormat: '<b>{series.name}</b><br />',
            pointFormat: 'x = {point.x}, y = {point.y}'
        },
        series: [{            
            data: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
            pointStart: 1
        }]
    });
});

Try zooming between .1 and 1 and you'll see that everything disappears but the chart seems to have zoomed somewhere.

Is there an explanation for this behavior?

You need to set minRange parameter

yAxis: {
            type: 'logarithmic',
            minRange:0.1,
            minorTickInterval: 0.1
},

http://jsfiddle.net/G6ALa/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM