代码之家  ›  专栏  ›  技术社区  ›  JL_Coder

来自Datable的json groupby数据

  •  0
  • JL_Coder  · 技术社区  · 6 年前

    我希望从这里使用这个amCharts库来实现一些可视化。 https://www.amcharts.com/demos/grouped-countries-map/

    我已经序列化了我的数据表,但似乎它不起作用,我不确定如何才能使用groupby4类别/区域。

    任何帮助/建议都会很有帮助。

    enter image description here

    var groupData = [
      {
        "name": "EU member before 2004",
        "color": chart.colors.getIndex(0),
        "data": [
          {
            "title": "Austria",
            "id": "AT", // With MapPolygonSeries.useGeodata = true, it will try and match this id, then apply the other properties as custom data
            "customData": "1995"
          }, {
            "title": "Ireland",
            "id": "IE",
            "customData": "1973"
          }, {
            "title": "Denmark",
            "id": "DK",
            "customData": "1973"
          }, {
            "title": "Portugal",
            "id": "PT",
            "customData": "1986"
          }
        ]
      },
      {
        "name": "Joined at 2004",
        "color": chart.colors.getIndex(1),
        "data": [
          {
            "title": "Lithuania",
            "id": "LT",
            "color": chart.colors.getIndex(1),
            "customData": "2004",
            "groupId": "2004"
          }, {
            "title": "Latvia",
            "id": "LV",
            "color": chart.colors.getIndex(1),
            "customData": "2004",
            "groupId": "2004"
          }
      },
      {
        "name": "Joined at 2007",
        "color": chart.colors.getIndex(3),
        "data": [
          {
            "title": "Romania",
            "id": "RO",
            "customData": "2007"
          }, {
            "title": "Bulgaria",
            "id": "BG",
            "customData": "2007"
          }
        ]
      },
      {
        "name": "Joined at 2013",
        "color": chart.colors.getIndex(4),
        "data": [
          {
            "title": "Croatia",
            "id": "HR",
            "customData": "2013"
          }
        ]
      }
    ];
    
    0 回复  |  直到 6 年前
    推荐文章