格式化

$(function () {
    var categoryLinks = {
        'Foo': 'http://www.google.com/search?q=foo',
        'Bar': 'http://www.google.com/search?q=foo+bar',
        'Foobar': 'http://www.google.com/serach?q=foobar'
    };
    $('#container').highcharts({
        xAxis: {
            labels: {
                formatter: function () {
                    return this.value ;
                }
            }
        },
        yAxis:{
            labels: {
                formatter: function () {
                    return num2e(this.value) ;
                }
            }
        },
        series: [{
            data: [[10,2900.9],[1201,7100.5],[1030,10600.4]]
        }]
    });
    function num2e(num){
        var p = Math.floor(Math.log(num)/Math.LN10);
        var n = num * Math.pow(10, -p);
        return n + 'e' + p;
    }
});

posted @ 2016-11-07 22:45  goodTOgreat  阅读(129)  评论(0编辑  收藏  举报