# Thống nhất parameter download chart (export GG Sheets, Excel)
## Cấu trúc parameter download
- dimension: (json stringify)
```
[
{
"name": "campaign_name",
"label": "Chiến dịch 1", # Label của dimension hoặc alias label
"aggregationType": "none" #Theo thông tin aggregation của schema
},
{
"name": "campaign_name",
"label": "Chiến dịch 2",
"aggregationType": "none"
}
]
```
- metric:
```
[
{
"name": "click",
"label": "Click",
"aggregationType": "sum" #Theo thông tin aggregation của schema hoặc alias aggregation
},
{
"name": "click",
"label": "Lượt nhấn chọn",
"aggregationType": "sum"
}
]
```
- sort:
```
[
{
"name": "click",
"label": "Lượt nhấn chọn",
"aggregationType": "sum",
"az": "asc"
}
]
```
- filters:
### Đối với trường hợp các chart chỉ hiện thị giá trị > 0 ở trên giao diện thì luôn luôn truyền filter metric > 0
Ví dụ: **Treemap** có metric là **Click**
```
[
[
{
"click": {
"greater_than_equals": "0",
"type": "include"
}
},
]
]
```
### Line Chart
1. Đối với trường hợp không show other trong style
- Trên chart user chọn bao nhiêu line thì sẽ truyền filter include match any của những đối tượng đó
Ví dụ: User enable 3 line thì filters params như sau:
```
[
[
{
"campaign_name": {
"matches_any": "duy, Phong, chien",
"type": "include"
}
},
]
]
```
2. Đối với trường hợp có show other trong style
- Trên chart user chọn bao nhiêu line thì sẽ truyền filter exlude match any như sau:
```
[
[
{
"campaign_name": {
"matches_any": "duy, Phong, chien", #Các line bị bỏ chọn
"type": "exclude"
}
},
]
]
```
### Bar Chart (hiện tại chưa xử lý)
- Trường hợp Bar Chart có yêu cầu export khá đặc biệt cho nên cần phải truyền thêm kiểu options, để phía API xử lý riêng cho Bar Chart
VD: Kiểu options như sau:
```
options: {
maxBars: '',
showOtherBars: false,
maxSeries: '',
showOtherSeries: false,
}
```