有没有办法在图例比例上格式化数字(Fusion Charts Map)

问题描述 投票:0回答:2

我有一个融合地图,其中有一些非常大的值;我的地图显示了不同州的存款数据摘要,例如“纽约”的价值近 3 万亿美元。

在图例范围(或图例范围)上,我将其设置为 0 到 3 万亿美元。但是,它并没有按照我需要的方式格式化该值;基本上,我被要求将其格式化为 $3,000B (现在它的格式为 $3,000,0000M)。

有没有办法格式化 Fusion Chart 上的图例范围?我添加了图表配置和图像,以供参考。另外,我检查了此链接以获取更多信息(https://www.fusioncharts.com/dev/map-guide/colouring-based-on-data-range

  const colorrange = {
    minvalue: 0,
    startlabel: "Low",
    endlabel: "High",
    code: "#FFFFA2",
    gradient: "1",
    color: [
      {
        maxvalue: 1000000000000,
        code: "#ED4630",
        displayValue: "Median",
      },
      {
        maxvalue: 3000000000000,
        code: "#B2D1FD",
      },
    ],
  };

  const usaMapChartProps = {
    id: "usa-map-container",
    type: "maps/usa",
    width: "700",
    height: "550",
    dataFormat: "JSON",
    dataSource: {
      chart: {
        caption: "Concentration of Deposits",
        subcaption: "Rollover a state for more information",
        entityfillhovercolor: "#EEEEEE",
        showlabels: "1",
        borderthickness: "0.4",
        theme: "fusion",
        basefontcolor: "#013a5d",
        entitytooltext: "<b>$lname</b>",
      },
      colorrange: colorrange,
      data: mapData,
    },
}


fusioncharts
2个回答
0
投票

对于任何对我的发现感兴趣的人,此文档可以得出我的答案https://www.fusioncharts.com/dev/chart-guide/chart-configurations/number-format


0
投票

您必须显式修改数字缩放比例才能添加数十亿。属性 numberScaleValue 和 numberScaleUnit 负责刻度上的数字格式。

 {
  "chart": {
    "numberScaleValue": "1000,1000,1000",
    "numberScaleUnit": "K,M,B"
  }
}

要了解有关此功能的更多信息,请参阅 - https://www.fusioncharts.com/dev/chart-guide/chart-configurations/number-format#add-billions-to-default-scaling

这是一个演示 - https://jsfiddle.net/yg7avpsn/

© www.soinside.com 2019 - 2024. All rights reserved.