我正在使用ngx-charts,我得到的JSON的结构与此类似:
[
{
"name": "Réunion",
"series": [
{
"value": 4500,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 6193,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 4003,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 6137,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 4178,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Réunion",
"series": [
{
"value": 4905,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 4014,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 6364,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 5178,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 5943,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Senegal",
"series": [
{
"value": 3874,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 6686,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 4061,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 6735,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 4148,
"name": "2016-09-13T12:24:55.620Z"
}
]
}
]
要进行转换,我使用以下代码:
this.data = this.multi.map(group => {
group.series = group.series.map(dataItem => {
// dataItem.name = moment(dataItem.name).format('llll');
dataItem.name = new Date(dataItem.name);
return dataItem;
});
return group;
});
我已经尝试过使用矩矩格式(dataItem.name).format('llll');的矩矩库;但是时间轴停止工作并在返回时显示一切。
我的问题是X轴的下栏用英语显示,我想更改语言。我该如何做到而又不会失去时间表?