Skip to content

Pie Chart Data Structure Description

// The following is a data demo of a pie chart (divided into 3 segments)
  {
    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 Required Data group, the length indicates how many parts the pie chart is divided into
series[#] dict A set of data, representing the data of one segment in the pie chart
series[#].columns list Required The first item in the pie chart is fixed as the field time, the second item is the segment name ['time', 'segment name']
series[#].values list Required Two-dimensional array, should contain only one piece of data in the pie chart; if multiple, only the first will be used
series[#].values[#] list Data source composed of [time value, data value], the first value in the pie chart can be set to null, the second is the data value (this value serves as the reference for the pie chart's proportion)

Example of External Function Response Structure

@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],
            ],
          }
        ]
      }
    ]
  }