在双轴高图表中将y轴值转换为百万

rji*_*rji 2 javascript jquery datatables highcharts

我正在使用双轴高图.在y轴上,值太大而无法读取.我希望将它们转换为1000K的1K和100000的1.0L以及1000000的1.0M和35869982的35.8M以及3550977的3.5M的快捷方式.

这是我的FIDDLE

 $(function () {
$('#container').highcharts({
    chart: {
        zoomType: 'xy'
    },
    title: {
        text: 'Average Monthly Temperature and Rainfall in Tokyo'
    },
    subtitle: {
        text: 'Source: WorldClimate.com'
    },
    xAxis: [{
        categories: ['MAR-2014', 'APR-2014', 'MAY-2014', 'JUN-2014',
            'JUL-2014', 'AUG-2014', 'SEP-2014', 'OCT-2014', 'NOV-2014', 'DEC-2014'],
        crosshair: true
    }],
    yAxis: [{ // Primary yAxis
        labels: {
            format: '{value}',
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        },
        title: {
            text: 'VOLUME',
            style: {
                color: Highcharts.getOptions().colors[1]
            }
        }
    }, { // Secondary yAxis
        title: {
            text: 'REVENUE',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        labels: {
            format: '{value}',
            style: {
                color: Highcharts.getOptions().colors[0]
            }
        },
        opposite: true
    }],
    tooltip: {
        shared: true
    },
    legend: {
        layout: 'vertical',
        align: 'left',
        x: 120,
        verticalAlign: 'top',
        y: 100,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    },
    series: [{
        name: 'Revenue',
        type: 'column',
        yAxis: 1,
        data: [35869982, 26090976, 26595718, 33914250, 25999278, 36579864, 35843674, 28008920, 27718356, 29014230],
        tooltip: {
            valueSuffix: ' '
        }

    }, {
        name: 'volume',
        type: 'spline',
        data: [3379865, 2373769, 2401815, 3222316, 2459713, 5864469, 5139453, 3341922, 3229963, 3550977],
        tooltip: {
            valueSuffix: ''
        }
      }]
    });
   });
Run Code Online (Sandbox Code Playgroud)

在这里,我想要在下图中进行更改

在此输入图像描述

Mox*_*hah 6

你需要使用formatter:

formatter: function(){
              return this.value/1000000 + "M";
            }
Run Code Online (Sandbox Code Playgroud)

小提琴