WIP customizing x tick according to time difference
This commit is contained in:
@@ -215,3 +215,14 @@ export const setTimeStringFormatBaseOnTimeDifference = (minTimeStamp, maxTimeSta
|
||||
|
||||
return dateFormat;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an array of Unix timestamps to formatted date strings based on the
|
||||
* specified format for use as axis ticks.
|
||||
* 根據指定的格式將 Unix 時間戳數組轉換為軸標籤的格式化日期字符串。
|
||||
* @param {Array<number>} timeStampArr
|
||||
* @param {string} timeFormat For example, 'MM/DD'
|
||||
*/
|
||||
export const mapTimestampToAxisTicksByFormat = (timeStampArr, timeFormat) => {
|
||||
return timeStampArr.map(ts => moment(ts).format(timeFormat));
|
||||
};
|
||||
Reference in New Issue
Block a user