Skip to content

Pie Chart Data Structure Description

// Below is a demo of a pie chart (divided into 3 slices)
  {
    series: [
      {
        values: [[null, 1.33635905]],
        columns: ['time', 'pieA'],
      },
      {
        values: [[null, 1.79202423]],
        columns: ['time', 'pieB'],
      },
      {
        values: [[null, 2]],
        columns: ['time', 'pieC'],
      },
    ],
  },
  • Field Description:
Parameter Type Required Description
series list Yes Data groups, the length indicates how many slices the pie chart has
series[#] dict A set of data representing one slice of the pie chart
series[#].columns list Yes The first item of the pie chart is fixed as the field time, the second item is the slice name: ['time', 'slice name']
series[#].values list Yes Two-dimensional array. In a pie chart, there should be only one data entry; if multiple, only the first one is used
series[#].values[#] list A data source composed of [time value, data value]. In the pie chart, the first value can be set to null, the second is the data value (the reference value for the pie chart proportion)

External Function Response Structure Example

@DFF.API('function_name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
    data1 = 100
    data2 = 200
    data3 = 300
    #
    return {
    "content": [
      {
        "series": [
          {
            "columns": ["time", "data"],
            "values": [
              [null, data1],
              [null, data2],
              [null, data3],
            ],
          }
        ]
      }
    ]
  }

Feedback

Is this page helpful?