1

列ハイチャートを使用しています。ここで、データの後に % 記号が必要です。たとえば、データ値が 7.18 の場合、7.18% の形式で表示したいとします。これどうやってするの?誰かが何か考えを持っているなら、私と共有してください。

ここに画像の説明を入力

私のコードは以下の通りです:

       $('#cagr2').highcharts({
        chart: {
            type: 'column',
             spacingBottom: -7,
             spacingTop:20
        },
        title: {
            text: ''
        },  exporting: { enabled: false },
         credits: {
      enabled: false
         },
        xAxis: {
            lineColor: 'transparent', 
            categories: ['']
        },
        yAxis: {

   lineWidth: 0,
   minorGridLineWidth: 0,
   minorGridLineWidth: 0,
   gridLineColor: 'transparent',
   lineColor: 'transparent',

   labels: {
       enabled: false
   },
   minorTickLength: 0,
   tickLength: 0,
              min: 0,
             title: {
                text: ''
            },
            stackLabels: {
                enabled: false,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
            }
        },

        legend: {
          enabled: true,
            layout: 'horizontal',
            align: 'center',
            //x: -10,
            verticalAlign: 'top',
            y: -5,
            floating: true,
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
            borderColor: '#ffffff',
            borderWidth: 1,
            shadow: true
        },
        tooltip: {
            headerFormat: '<b>{point.x}</b>',
            pointFormat: '{series.name}: {point.y}',
            valueSuffix: ' %'
        },

        plotOptions: {
           series: {

                animation: {
                    duration: 7000
                }

            },

            column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black',
                        fontSize: '18px'
                    }
                }
            }
        },
        series: [{
            name: 'Rate of return',
            data: [parseFloat(cagr)]
        }]
    });
4

1 に答える 1