update x label
This commit is contained in:
parent
9cef649d52
commit
f022b458c4
@ -24,6 +24,7 @@ let optionsCPI;
|
|||||||
let filterRule = 'annual';
|
let filterRule = 'annual';
|
||||||
|
|
||||||
let timePeriod = 'threeYears';
|
let timePeriod = 'threeYears';
|
||||||
|
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||||
|
|
||||||
|
|
||||||
function filterEndOfYearDates(data) {
|
function filterEndOfYearDates(data) {
|
||||||
@ -180,6 +181,14 @@ async function plotData() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
|
formatter: function (value) {
|
||||||
|
// Assuming dates are in the format 'yyyy-mm-dd'
|
||||||
|
// Extract the month and day from the date string and convert the month to its abbreviated name
|
||||||
|
const dateParts = value.split('-');
|
||||||
|
const year = dateParts[0].substring(2); // Extracting the last two digits of the year
|
||||||
|
const monthIndex = parseInt(dateParts[1]) - 1; // Months are zero-indexed in JavaScript Date objects
|
||||||
|
return `${monthNames[monthIndex]} '${year}`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data: dates,
|
data: dates,
|
||||||
type: 'category',
|
type: 'category',
|
||||||
@ -234,6 +243,14 @@ async function plotCPI() {
|
|||||||
xAxis: {
|
xAxis: {
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
|
formatter: function (value) {
|
||||||
|
// Assuming dates are in the format 'yyyy-mm-dd'
|
||||||
|
// Extract the month and day from the date string and convert the month to its abbreviated name
|
||||||
|
const dateParts = value.split('-');
|
||||||
|
const year = dateParts[0].substring(2); // Extracting the last two digits of the year
|
||||||
|
const monthIndex = parseInt(dateParts[1]) - 1; // Months are zero-indexed in JavaScript Date objects
|
||||||
|
return `${monthNames[monthIndex]} '${year}`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data: dates,
|
data: dates,
|
||||||
type: 'category',
|
type: 'category',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user