为什么对工具提示值进行四舍五入?

时间:2019-03-08 19:17:59

标签: vega-lite altair

由于某种原因,我的工具提示会四舍五入到最接近的整数?

感谢您的帮助。

这是VL编辑器(版本3.0.0-rc14)中指向图表的链接。

(vega editor link)

{
  "width": 300,
  "height": 300,
  "config": {
    "title": {"fontSize": 15},
    "numberFormat": ".0f",
    "style": {
      "bar": {"size": 20},
      "guide-title": {"value": "asdf", "fontSize": 15},
      "guide-label": {"fontSize": 15}
    },
    "scale": {"bandPaddingInner": 0.5, "bandPaddingOuter": 0.5},
    "legend": {"symbolSize": 100, "titleFontSize": 15, "labelFontSize": 15},
    "axis": {"titleFontSize": 15, "labelFontSize": 15, "labelLimit": 1000}
  },
  "data": {"name": "data-dba50c8bae540866b10e6763560b8ec9"},
  "mark": "circle",
  "encoding": {
    "tooltip": [
      {"type": "quantitative", "field": "expressiveness"},
      {"type": "quantitative", "field": "customization"}
    ],
    "x": {"type": "quantitative", "field": "expressiveness"},
    "y": {"type": "quantitative", "field": "customization"}
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v2.6.0.json",
  "datasets": {
    "data-dba50c8bae540866b10e6763560b8ec9": [
      {"library": "A", "expressiveness": 0, "customization": 1},
      {"library": "B", "expressiveness": 0.4, "customization": 0.7},
      {"library": "C", "expressiveness": 1, "customization": 0.7},
      {"library": "D", "expressiveness": 0.6, "customization": 0.7},
      {"library": "E", "expressiveness": 0, "customization": 1}
    ]
  }
}

1 个答案:

答案 0 :(得分:1)

因为您在配置中设置了"numberFormat": ".0f",所以它也应用于工具提示。