值的格式设置工具提示& gt; 1000 [英] Formatting Tooltip of Values >1000

查看:248
本文介绍了值的格式设置工具提示& gt; 1000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用了ohlc高库存图表.我的值是4-5位数字.例如

I am using an ohlc highstock chart in my project. I have values in 4-5 digits. For example

Open     : 2717.35
High     : 2719.5
Low      : 2709.18
Close    : 2712.97
SMA(50)  : 2677.4904
SMA(200) : 2627.7230
Volume   : 3368690000

在图表的工具提示中,我想要这些值(加逗号)

In the tooltip of the chart, I want these values like this (added comma)

Open     : 2,717.35
High     : 2,719.5
Low      : 2,709.18
Close    : 2,712.97
SMA(50)  : 2,677.4904
SMA(200) : 2,627.7230
Volume   : 3,368,690,000

但是对于4位数的值,工具提示看起来像这样

But in the case of 4 digit values, tooltip looks like this

4位数字值中有一个空格.有什么办法格式化它,使其像我上面提到的那样来?图表中我也有一些SMA系列和体积系列.有没有办法使用它来格式化值?

There's a space in the 4-digit values. Is there any way to format it so that it should come like I mentioned above? I also have some SMA series and a volume series in the chart. Is there any way to use that to format the values?

我的高价期权

{
          colors:Global.colors,
          rangeSelector: {
            selected: 1
          },
          title: {
            text: ''
          },
          xAxis: {
            crosshair: true
          },
          yAxis: [
            {
              labels: {
                align: 'right',
                x: -3
              },
              height: '60%',
              lineWidth: 2,
              resize: {
                enabled: true
              },
            }, {
              labels: {
                align: 'right',
                x: -3
              },
              top: '65%',
              height: '35%',
              offset: 0,
              lineWidth: 2
            }],
            tooltip: {
              split: true,
              distance: 50,
              padding: 2,
            },
          credits: {
            enabled: false
          },
          legend: {
            enabled: false
          },
          plotOptions: {
            series: {
              marker: {
                enabled: false
              }
            },
          }
        }

注意:我正在从服务器获取数据,因此我将在http调用完成后在系列中设置数据.

Note: I am getting data from the server so I am setting data in the series after the completion of the http call.

推荐答案

您需要设置千位分隔符.像这样:

Highcharts.setOptions({lang: {thousandsSep: ','}})

工作中的JSFiddle示例: https://jsfiddle.net/ewolden/72xr9qvL/5

这篇关于值的格式设置工具提示& gt; 1000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆