Line Chart Data Structure Description¶
// Below is a demo data for a line chart (two lines)
{
series: [
{
values: [
[1737344820000, 1.33635905],
[1737344810000, 2.6481715],
[1737344800000, 1.21059269],
],
columns: ['time', 'avg(usage_system)'],
},
{
values: [
[1737344820000, 1.79202423],
[1737344810000, 0.83102493],
[1737344800000, 1.84110971],
],
columns: ['time', 'avg(usage_system)'],
},
],
},
- Field Description:
| Parameter | Type | Required | Description |
|---|---|---|---|
| series | list | Yes | Data groups, the length indicates how many groups of data (in a line chart, how many lines) |
| series[#] | dict | A set of data | |
| series[#].columns | list | Yes | List of data source field keys, ['time', ...] |
| series[#].columns[#] | str | Data source field key, the first column must be 'time' | |
| series[#].values | list | Yes | Two-dimensional array, each item represents a data point |
| series[#].values[#] | list | Data source consisting of [timestamp, value]; in a line chart, the length of values is 2, each data point represents a connection point on the line chart |
External Function Response Structure Example¶
@DFF.API('function name', category='dataPlatform.dataQueryFunc')
def whytest_topology_test():
data1 = 123
data2 = 200
now1 = int(time.time()) * 1000
now2 = int(time.time()) * 1000
#
return {
"content": [
{
"series": [
{
"columns": ["time", "data"],
"values": [
[now1, data1],
[now2, data2]
],
}
]
}
]
}