addData

优质
小牛编辑
129浏览
2023-12-01

Parameter:
data or data group -- In JSON format

1. Load a single data set
Loads data to the controller of Gio and overrides previous data synchronously. The dataset used for
visualization is in JSON format. Each element of the array has an import country (i), an export country
(e) and a value (v).



[
        {
                "e":
"CN",
                "i":
"US",
                "v":
3300000
        },
        {
                "e":
"CN",
                "i":
"RU",
                "v":
10000
        }
]

Explanation: The line connects two countries and it has a direction, the moving particle will animate in
this direction, this direction is defined by "e" -> "i". "e" and "i" represent two countries, "e" is the
country where the line is out, "i" is the country where the line is in. The "v" is the value between
these two country, there are particles moving on the line, if the value is small, the size and quantity
of the particles will be small, and moving slowly, if the value is large, the size and quantity be
large, and moving fast. In Gio.js 2.0, v can be defined as continent, checkout Continent
documentation

for more information.

2. Load a data group (multiple data sets)
Loads a data group (multiple data sets) to the controller of Gio synchronously. All data sets defined in
data group can be loaded in to Gio.js Controller in one time, and use switchDataSet()
API to control which
data set to be displayed onto the 3D globe. The format of data group is as defined below:



{
        dataSetKeys: [key1, key2, ......],
        initDataSet: key1,
        key1: dataSet,
        key2: dataSet,
        ...
}

Explanation: Each data set has a specific "key", the attribute "dataSetKeys" stores all keys, the attribute
"initDataSet" stores the key of the data set which will be initially displayed onto the globe. The data
structure of "dataSet" is the same as Load a single data set.