data
설명
선택 사항. Pivot 테이블의 데이터를 포함하는 객 체 배열
사용법
data?: [];
매개변수
data 배열의 각 객체는 하나의 행을 나타냅니다. 기본값은 빈 배열입니다.
data 속성의 직접적인 하위 속성은 없습니다. 그러나 배열의 각 객체는 Pivot 테이블의 차원과 값을 나타내는 임의 개수의 속성을 가질 수 있습니다.
data 배열 예시:
const data = [
{
name: "Argentina",
year: 2015,
continent: "South America",
form: "Republic",
gdp: 181.357,
oil: 1.545,
balance: 4.699,
when: new Date("4/21/2015")
},
{
name: "Argentina",
year: 2017,
continent: "South America",
form: "Republic",
gdp: 212.507,
oil: 1.732,
balance: 7.167,
when: new Date("1/15/2017")
},
{
name: "Argentina",
year: 2014,
continent: "South America",
form: "Republic",
gdp: 260.071,
oil: 2.845,
balance: 6.728,
when: new Date("6/16/2014")
},
{
name: "Argentina",
year: 2014,
continent: "South America",
form: "Republic",
gdp: 324.405,
oil: 4.333,
balance: 5.99,
when: new Date("2/20/2014")
},
{
name: "Argentina",
year: 2014,
continent: "South America",
form: "Republic",
gdp: 305.763,
oil: 2.626,
balance: 7.544,
when: new Date("8/17/2014")
},
//다른 데이터
];
예제
const table = new pivot.Pivot("#root", {
fields,
data: [
{
rank: 1,
title: "Shingeki no Kyojin: The Final Season - Kanketsu-hen",
popularity: 609,
genre: "Action",
studio: "MAPPA",
type: "Special",
episodes: 2,
duration: 61,
members: 347875,
score: 9.17,
},
{
rank: 2,
title: "Fullmetal Alchemist: Brotherhood",
popularity: 3,
genre: "Action",
studio: "Bones",
type: "TV",
episodes: 64,
duration: 24,
members: 3109951,
score: 9.11
},
//다른 데이터 객체
],
config: {
rows: ["studio", "genre"],
columns: [],
values: [
{
field: "title",
method: "count"
},
{
field: "score",
method: "max"
}
]
}
});