Highcharts - 2个小数位不起作用的工具提示标题格式

时间:2016-09-12 23:47:32

标签: javascript angularjs charts highcharts highcharts-ng

我正在尝试配置工具提示,使其仅显示2个小数位,但是headerformat似乎没有显示,并且它会一直显示整个小数位。

这里出了什么问题?

   {  
       "chart":{  
          "type":"line",
          "height":40,
          "width":40
       },
       "title":{  
          "text":null
       },
       "subtitle":{  
          "text":null
       },
       "xAxis":{  
          "categories":[  

          ]
       },
       "yAxis":{  
          "title":{  
             "enabled":true,
             "text":"Amount (Dollars)",
             "style":{  
                "fontWeight":"normal"
             }
          },
          "plotLines":[  
             {  
                "value":0,
                "width":1,
                "color":"#808080"
             }
          ]
       },
       "options":{  
          "legend":{  
             "enabled":false
          }
       },
       "plotOptions":{  

       },
       "series":[  
          {  
             "name":"Total",
             "data":[  
                {  
                   "name":"Apr'2016",
                   "y":1372406438.2385998
                },
                {  
                   "name":"May'2016",
                   "y":5301389724.7499
                },

            {  
               "name":"Jun'2016",
               "y":549467904.6918
            },
            {  
               "name":"July'2016",
               "y":549040695.1202999
            },
            {  
               "name":"Aug'2016",
               "y":1160837116.1138
            },
            {  
               "name":"Sep'2016",
               "y":22.7612
            }
         ],
         "color":"#008CE6",
         "marker":{  
            "enabled":false
         },
         "id":"series-3"
      },
      {  
         "name":"Toal Timely",
         "data":[  
            {  
               "name":"Apr'2016",
               "y":427101358.1748,
               "month":"Apr"
            },
            {  
               "name":"May'2016",
               "y":5191919648.9571,
               "month":"May"
            },
            {  
               "name":"Jun'2016",
               "y":288691855.262,
               "month":"Jun"
            },
            {  
               "name":"July'2016",
               "y":264281732.18769997,
               "month":"July"
            },
            {  
               "name":"Aug'2016",
               "y":853641906.2942,
               "month":"Aug"
            },
            {  
               "name":"Sep'2016",
               "y":0,
               "month":"Sep"
            }
         ],
         "color":"#4ca977",
         "marker":{  
            "enabled":false
         },
         "id":"series-4"
      },
      {  
         "name":"Total Untimely",
         "data":[  
            {  
               "name":"Apr'2016",
               "y":945305080.0637999,
               "month":"Apr"
            },
            {  
               "name":"May'2016",
               "y":109470075.79279998,
               "month":"May"
            },
            {  
               "name":"Jun'2016",
               "y":260776049.4298,
               "month":"Jun"
            },
            {  
               "name":"July'2016",
               "y":284758962.93259996,
               "month":"July"
            },
            {  
               "name":"Aug'2016",
               "y":307195209.8196,
               "month":"Aug"
            },
            {  
               "name":"Sep'2016",
               "y":22.7612,
               "month":"Sep"
            }
         ],
         "color":"#e54343",
         "marker":{  
            "enabled":false
         },
         "id":"series-5"
      }
   ],
   "tooltip":{  
      "pointFormat":"<b>{point.y}</b>",
      "shared":true
   }
}

1 个答案:

答案 0 :(得分:0)

将小数添加到point.y值。

"pointFormat": "<b>{point.y:.2f}</b><br>",

示例: