У меня есть диаграмма, где я размечал оси X с интервалом в три месяца. Тем не менее, я бы хотел, чтобы этот шаблон начинался в январе, чтобы метками были январь [год], апрель [год], июль [год], октябрь [год] и т. Д. c. Как определить начальную точку для меток (а не для самой оси)? Я просмотрел документацию, но мне не повезло найти решение.
Вот код для диаграммы .
option = {
"yAxis": [
{
"show": true
}
],
"xAxis": [
{
"data": ["2017-06-01", "2017-07-01", "2017-08-01", "2017-09-01", "2017-10-01", "2017-11-01", "2017-12-01", "2018-01-01", "2018-02-01", "2018-03-01", "2018-04-01", "2018-05-01", "2018-06-01", "2018-07-01", "2018-08-01", "2018-09-01", "2018-10-01", "2018-11-01", "2018-12-01", "2019-01-01", "2019-02-01", "2019-03-01", "2019-04-01", "2019-05-01", "2019-06-01", "2019-07-01", "2019-08-01", "2019-09-01", "2019-10-01", "2019-11-01", "2019-12-01", "2020-01-01", "2020-02-01"],
"type": "time",
"boundaryGap": true,
//min: 1496323473000,
maxInterval: 7776000000,
minInterval: 7776000000,
"axisLabel": {
rotate: 90,
formatter: function (value) {
var d = new Date(value);
var months = ['Jan', "/Feb/", "/Mar/", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
return (months[d.getMonth()] + ' ' + d.getFullYear());}
}
}
],
"legend": {
"data": [
"Category 1",
"Category 2",
"Category 3",
"Category 4",
"Category 5"
]
},
"series": [
{
"data": [
{
"value": ["2017-06-01", " 62"]
},
{
"value": ["2017-07-01", " 66"]
},
{
"value": ["2017-08-01", " 55"]
},
{
"value": ["2017-09-01", " 58"]
},
{
"value": ["2017-10-01", " 47"]
},
{
"value": ["2017-11-01", "196"]
},
{
"value": ["2017-12-01", "161"]
},
{
"value": ["2018-01-01", " 53"]
},
{
"value": ["2018-02-01", " 28"]
},
{
"value": ["2018-03-01", " 24"]
},
{
"value": ["2018-04-01", " 38"]
},
{
"value": ["2018-05-01", " 49"]
},
{
"value": ["2018-06-01", " 45"]
},
{
"value": ["2018-07-01", " 41"]
},
{
"value": ["2018-08-01", " 60"]
},
{
"value": ["2018-09-01", " 40"]
},
{
"value": ["2018-10-01", " 49"]
},
{
"value": ["2018-11-01", "206"]
},
{
"value": ["2018-12-01", "167"]
},
{
"value": ["2019-01-01", " 60"]
},
{
"value": ["2019-02-01", " 38"]
},
{
"value": ["2019-03-01", " 44"]
},
{
"value": ["2019-04-01", " 43"]
},
{
"value": ["2019-05-01", " 50"]
},
{
"value": ["2019-06-01", " 58"]
},
{
"value": ["2019-07-01", " 60"]
},
{
"value": ["2019-08-01", " 49"]
},
{
"value": ["2019-09-01", " 63"]
},
{
"value": ["2019-10-01", " 50"]
},
{
"value": ["2019-11-01", "155"]
},
{
"value": ["2019-12-01", "180"]
},
{
"value": ["2020-01-01", " 77"]
},
{
"value": ["2020-02-01", " 47"]
}
],
"yAxisIndex": 0,
"xAxisIndex": 0,
"name": "Category 1",
"type": "line",
"coordinateSystem": "cartesian2d"
},
{
"data": [
{
"value": ["2017-06-01", "11"]
},
{
"value": ["2017-07-01", " 7"]
},
{
"value": ["2017-08-01", " 5"]
},
{
"value": ["2017-09-01", " 6"]
},
{
"value": ["2017-10-01", " 9"]
},
{
"value": ["2017-11-01", "33"]
},
{
"value": ["2017-12-01", "42"]
},
{
"value": ["2018-01-01", " 6"]
},
{
"value": ["2018-02-01", " 3"]
},
{
"value": ["2018-03-01", " 3"]
},
{
"value": ["2018-04-01", " 6"]
},
{
"value": ["2018-05-01", "10"]
},
{
"value": ["2018-06-01", " 4"]
},
{
"value": ["2018-07-01", "11"]
},
{
"value": ["2018-08-01", " 7"]
},
{
"value": ["2018-09-01", " 2"]
},
{
"value": ["2018-10-01", " 7"]
},
{
"value": ["2018-11-01", "36"]
},
{
"value": ["2018-12-01", "28"]
},
{
"value": ["2019-01-01", " 9"]
},
{
"value": ["2019-02-01", " 9"]
},
{
"value": ["2019-03-01", " 8"]
},
{
"value": ["2019-04-01", " 7"]
},
{
"value": ["2019-05-01", " 6"]
},
{
"value": ["2019-06-01", " 6"]
},
{
"value": ["2019-07-01", " 5"]
},
{
"value": ["2019-08-01", " 4"]
},
{
"value": ["2019-09-01", " 5"]
},
{
"value": ["2019-10-01", " 8"]
},
{
"value": ["2019-11-01", "15"]
},
{
"value": ["2019-12-01", "24"]
},
{
"value": ["2020-01-01", "10"]
},
{
"value": ["2020-02-01", " 6"]
}
],
"yAxisIndex": 0,
"xAxisIndex": 0,
"name": "Category 2",
"type": "line",
"coordinateSystem": "cartesian2d"
},
{
"data": [
{
"value": ["2017-06-01", "149"]
},
{
"value": ["2017-07-01", "158"]
},
{
"value": ["2017-08-01", "142"]
},
{
"value": ["2017-09-01", "133"]
},
{
"value": ["2017-10-01", "129"]
},
{
"value": ["2017-11-01", "693"]
},
{
"value": ["2017-12-01", "680"]
},
{
"value": ["2018-01-01", "189"]
},
{
"value": ["2018-02-01", "103"]
},
{
"value": ["2018-03-01", " 97"]
},
{
"value": ["2018-04-01", "103"]
},
{
"value": ["2018-05-01", "117"]
},
{
"value": ["2018-06-01", "146"]
},
{
"value": ["2018-07-01", "138"]
},
{
"value": ["2018-08-01", "144"]
},
{
"value": ["2018-09-01", "137"]
},
{
"value": ["2018-10-01", "140"]
},
{
"value": ["2018-11-01", "611"]
},
{
"value": ["2018-12-01", "722"]
},
{
"value": ["2019-01-01", "195"]
},
{
"value": ["2019-02-01", "124"]
},
{
"value": ["2019-03-01", "124"]
},
{
"value": ["2019-04-01", "127"]
},
{
"value": ["2019-05-01", "140"]
},
{
"value": ["2019-06-01", "169"]
},
{
"value": ["2019-07-01", "176"]
},
{
"value": ["2019-08-01", "132"]
},
{
"value": ["2019-09-01", "126"]
},
{
"value": ["2019-10-01", "128"]
},
{
"value": ["2019-11-01", "325"]
},
{
"value": ["2019-12-01", "516"]
},
{
"value": ["2020-01-01", "257"]
},
{
"value": ["2020-02-01", "118"]
}
],
"yAxisIndex": 0,
"xAxisIndex": 0,
"name": "Category 3",
"type": "line",
"coordinateSystem": "cartesian2d"
},
{
"data": [
{
"value": ["2017-06-01", "10"]
},
{
"value": ["2017-07-01", " 8"]
},
{
"value": ["2017-08-01", " 8"]
},
{
"value": ["2017-09-01", "10"]
},
{
"value": ["2017-10-01", " 4"]
},
{
"value": ["2017-11-01", "66"]
},
{
"value": ["2017-12-01", "66"]
},
{
"value": ["2018-01-01", "11"]
},
{
"value": ["2018-02-01", "10"]
},
{
"value": ["2018-03-01", " 3"]
},
{
"value": ["2018-04-01", " 5"]
},
{
"value": ["2018-05-01", " 9"]
},
{
"value": ["2018-06-01", "16"]
},
{
"value": ["2018-07-01", " 3"]
},
{
"value": ["2018-08-01", "11"]
},
{
"value": ["2018-09-01", "13"]
},
{
"value": ["2018-10-01", "12"]
},
{
"value": ["2018-11-01", "52"]
},
{
"value": ["2018-12-01", "60"]
},
{
"value": ["2019-01-01", "19"]
},
{
"value": ["2019-02-01", " 9"]
},
{
"value": ["2019-03-01", " 5"]
},
{
"value": ["2019-04-01", " 6"]
},
{
"value": ["2019-05-01", "12"]
},
{
"value": ["2019-06-01", "11"]
},
{
"value": ["2019-07-01", "11"]
},
{
"value": ["2019-08-01", " 8"]
},
{
"value": ["2019-09-01", " 9"]
},
{
"value": ["2019-10-01", " 5"]
},
{
"value": ["2019-11-01", "23"]
},
{
"value": ["2019-12-01", "32"]
},
{
"value": ["2020-01-01", "18"]
},
{
"value": ["2020-02-01", "15"]
}
],
"yAxisIndex": 0,
"xAxisIndex": 0,
"name": "Category 4",
"type": "line",
"coordinateSystem": "cartesian2d"
},
{
"data": [
{
"value": ["2017-06-01", "19"]
},
{
"value": ["2017-07-01", "25"]
},
{
"value": ["2017-08-01", "11"]
},
{
"value": ["2017-09-01", "19"]
},
{
"value": ["2017-10-01", "21"]
},
{
"value": ["2017-11-01", "42"]
},
{
"value": ["2017-12-01", "45"]
},
{
"value": ["2018-01-01", "21"]
},
{
"value": ["2018-02-01", "11"]
},
{
"value": ["2018-03-01", "15"]
},
{
"value": ["2018-04-01", "19"]
},
{
"value": ["2018-05-01", "24"]
},
{
"value": ["2018-06-01", "28"]
},
{
"value": ["2018-07-01", "24"]
},
{
"value": ["2018-08-01", "26"]
},
{
"value": ["2018-09-01", "26"]
},
{
"value": ["2018-10-01", "20"]
},
{
"value": ["2018-11-01", "65"]
},
{
"value": ["2018-12-01", "82"]
},
{
"value": ["2019-01-01", "39"]
},
{
"value": ["2019-02-01", "19"]
},
{
"value": ["2019-03-01", "30"]
},
{
"value": ["2019-04-01", "24"]
},
{
"value": ["2019-05-01", "35"]
},
{
"value": ["2019-06-01", "35"]
},
{
"value": ["2019-07-01", "45"]
},
{
"value": ["2019-08-01", "38"]
},
{
"value": ["2019-09-01", "26"]
},
{
"value": ["2019-10-01", "19"]
},
{
"value": ["2019-11-01", "65"]
},
{
"value": ["2019-12-01", "85"]
},
{
"value": ["2020-01-01", "44"]
},
{
"value": ["2020-02-01", "28"]
}
],
"yAxisIndex": 0,
"xAxisIndex": 0,
"name": "Category 5",
"type": "line",
"coordinateSystem": "cartesian2d"
}
]
}