提交 3ac5b246 authored 作者: liujiaxing's avatar liujiaxing

图标曲线时间显示

上级 ab098854
......@@ -277,10 +277,22 @@ function initChart() {
interval: 'auto', // 或直接不写
hideOverlap: true, // 防重叠(很关键)
formatter: function (value) {
console.log(value);
if (value.toString().includes(':')) {
const date = new Date(value);
const minutes = date.getMinutes();
if (minutes === 0 || minutes === 30) {
console.log(value, '判断分钟');
return value
}
} else if (!isNaN(Number(value))) {
const date = new Date(value);
const minutes = date.getMinutes();
if (minutes === 0 || minutes === 30) {
console.log(timestampToHMS(value), '判断分钟11');
return timestampToHMS(value)
}
}
}
// formatter: function (value) {
// if (value.toString().includes(':') && false) {
......@@ -396,12 +408,21 @@ function initChart() {
window.addEventListener('resize', resizeChart);
// }, 1000);
}
//转换颜色函数
function hexToRgba(hex, alpha) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
//将时间戳转换成时分秒
function timestampToHMS(timestamp) {
const date = new Date(timestamp * 1000); // 如果传入的是秒,需要乘以1000转换为毫秒
const hours = date.getUTCHours().toString().padStart(2, '0');
const minutes = date.getUTCMinutes().toString().padStart(2, '0');
const seconds = date.getUTCSeconds().toString().padStart(2, '0');
return `${hours}:${minutes}:${seconds}`;
}
var timesset = null
function resizeChart() {
if (myChart) {
......
......@@ -509,6 +509,7 @@ const handleConfigApplay = async () => {
_titles: titles.value
}
appStore.currentHotMapCountry = currentHotMapCountry
emits('handleScreenConfigeClose')//关闭弹窗
// console.log('appStore.chartConfig 传递的时候', appStore.chartConfig)
// Promise.all([
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论