Skip to content

Pie Chart Data Structure Description

// Below is a demo of pie chart data (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 is divided into
series[#] dict A set of data representing one slice of the pie chart
series[#].columns list Yes The first item in the pie chart must be the field time, the second item is the slice name ['time', 'slice_name']
series[#].values list Yes A two-dimensional array. In a pie chart there should be only one data point; if multiple exist, only the first is used
series[#].values[#] list A data source consisting of [time_value, data_value]. The first item in the pie chart can be set to null, the second item 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],
            ],
          }
        ]
      }
    ]
  }