Skip to content

Table Chart

Table charts include Grouped Table Charts and Time Series Table Charts.

Grouped Table Chart Data Structure

// The following demo data table columns are: ['host', 'host_ip', 'columnA', 'columnB']
{
    group_by: ['host', 'host_ip'],
    column_names: ['columnA', 'columnB'],
    series: [
      {
        tags: {
          host: 'host_1',
          host_ip: '111.11.123.103',
        },
        values: [[null, 1,2]],
        column_names: ['time', 'columnA', 'columnB'],
        columns: ['time', 'columnA', 'columnB'],
      },
      {
        tags: {
          host: 'host_2',
          host_ip: '111.11.123.101',
        },
        values: [[null, 3,4]],
        column_names: ['time', 'columnA', 'columnB'],
        columns: ['time', 'columnA', 'columnB'],
      },
      {
        tags: {
          host: 'host_3',
          host_ip: '111.11.123.102',
        },
        values: [[null, 5,6]],
        column_names: ['time', 'columnA', 'columnB'],
        columns: ['time', 'columnA', 'columnB'],
      },
      {
        tags: {
          host: 'host_4',
          host_ip: '111.11.123.106',
        },
        values: [[null, 7,8]],
        column_names: ['time', 'columnA', 'columnB'],
        columns: ['time', 'columnA', 'columnB'],
      },
    ],
  },

The column values of a grouped table chart are formed by merging group_by and column_names. group_by can be empty.

  • Field descriptions:
Parameter Type Required Description
group_by list Part of the table columns. The corresponding column values are taken from the tags object of each item in series.
group_by[#] str
column_names list Yes Part of the table columns. Should correspond to the non-time field values in series column_names. The column values are taken from series[#].values.
column_names[#] str
series list Yes Data groups. The length represents the number of rows in the table.
series[#] dict A set of data.
series[#].tags dict Attribute values corresponding to the group_by table columns (mapped values for the group_by columns, also used as alias key mappings).
series[#].columns list Yes Same as series[#].column_names['time', ...].
series[#].columns[#] str Data source field key. The first column value must be the time field.
series[#].column_names list Yes Data source field keys. Fields other than time are used as references for table columns.
series[#].column_names[#] str
series[#].values list Data groups. The length should match series[#].columns. (In the table chart, these are mapped values for the column_names columns.)
series[#].values[#] list Composed of [null, data_value, ...].
series[#].values[#][#] str

Example External Function Response Structure

@DFF.API('function_name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
    data1_1 = 100
    data1_2 = 101
    data2_1 = 200
    data2_2 = 201
    now1 = int(time.time()) * 1000
    now2 = int(time.time()) * 1000
    #
    return {
    "content": [
      {
        "group_by": ['attrA'],
        "columns": ["filedA","filedB"]
        "column_names": ["filedA","filedB"]
        "series": [
          {
            "tags": {"attrA":'value1'},
            "columns": ["time", "filedA","filedB"],
            "values": [
              [now1, data1_1,data1_2],
              [now2, data2_1,data2_2]
            ],
            "total_hits": -1
          }
        ]
      }
    ]
  }

Time Series Table Chart Data Structure

// The following demo data table columns are: ['fieldA', 'fieldB', 'fieldC', 'fieldD']
{
  "query": {},
  "series": [
    {
      "values": [
        [1737365938763, 19],
        [1737365938585, 20],
        [1737365938874, 21],
        [1737365939137, 22]
      ],
      "columns": ["time", "fieldA"]
    },
    {
      "values": [
        [1737365938763, 30],
        [1737365938585, 30.5],
        [1737365938874, 31],
        [1737365939137, 31.5]
      ],
      "columns": ["time", "fieldB"]
    },
    {
      "values": [
        [1737365938763, 50],
        [1737365938585, 50.5],
        [1737365938874, 51],
        [1737365939137, 51.5]
      ],
      "columns": ["time", "fieldC"]
    },
    {
      "values": [
        [1737365938763, 60],
        [1737365938585, 60.5],
        [1737365938874, 61],
        [1737365939137, 61.5]
      ],
      "columns": ["time", "fieldD"]
    }
  ]
}

The column values of a time series table chart are formed by merging the second column data from series[#].columns.

  • Field descriptions:
Parameter Type Required Description
series list Yes Data groups. The length represents the number of data groups in the table.
series[#] dict A set of data.
series[#].columns list Yes Composed of time and a column name, i.e., ['time', column_name].
series[#].columns[#] str
series[#].values list A 2D array. Each data entry represents the value of that column at different time dimensions. The length affects the number of rows in the table.
series[#].values[#] list [timestamp, data_value].
series[#].values[#][#] str

Example External Function Response Structure

@DFF.API('function_name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
    data1_1 = 100
    data1_2 = 101
    data2_1 = 200
    data2_2 = 201
    data3_1 = 101
    data3_2 = 202
    now1 = int(time.time()) * 1000
    now2 = int(time.time()) * 1000
    now3 = int(time.time()) * 1000
    #
    return {
    "content": [
      {
        "series": [
          {
            "columns": ["time", "filedA"],
            "values": [
              [now1, data1_1],
              [now2, data2_1],
              [now3, data3_1],
            ],
          },
          {
            "columns": ["time", "filedB"],
            "values": [
              [now1, data1_2],
              [now2, data2_2]
              [now3, data3_2]
            ],
          }
        ]
      }
    ]
  }

Feedback

Is this page helpful?