fix: Issues #262 done.

This commit is contained in:
chiayin
2024-03-25 12:03:23 +08:00
parent 83cca58fe2
commit c26693f933
2 changed files with 15 additions and 11 deletions

View File

@@ -292,12 +292,12 @@ export default {
}, },
time: { time: {
displayFormats: { displayFormats: {
second: 'hh:mm:ss', // ex: 01:01:01 second: 'h:mm:ss', // ex: 1:11:11
minute: 'MM/dd hh:mm', // ex: 01/01 01:01 minute: 'M/d h:mm', // ex: 1/1 1:11
hour: 'MM/dd hh:00', // ex: 01/01 01:00 hour: 'M/d h:mm', // ex: 1/1 1:11
day: 'yyyy/MM/dd', // ex: 1911/01/01 day: 'M/d h', // ex: 1/1 1
month: 'yyyy/MM', // ex: 1911/01 month: 'y/M/d', // ex: 1911/1/1
} },
}, },
ticks: { ticks: {
display: true, display: true,
@@ -355,6 +355,7 @@ export default {
} }
break; break;
case 'count': case 'count':
setOption.scales.y.ticks.precision = 0; // y 軸顯示小數點後 0 位
setOption.plugins.tooltip.callbacks.label = function(context) { setOption.plugins.tooltip.callbacks.label = function(context) {
let value = context.parsed.y; let value = context.parsed.y;
@@ -660,6 +661,7 @@ export default {
}; };
break; break;
case 'count': case 'count':
setOption.scales.x.ticks.precision = 0; // x 軸顯示小數點後 0 位
setOption.plugins.tooltip.callbacks.label = function(context) { setOption.plugins.tooltip.callbacks.label = function(context) {
let value = context.parsed.y; let value = context.parsed.y;

View File

@@ -287,11 +287,11 @@ export default {
}, },
time: { time: {
displayFormats: { displayFormats: {
second: 'hh:mm:ss', // ex: 01:01:01 second: 'h:mm:ss', // ex: 1:11:11
minute: 'MM/dd hh:mm', // ex: 01/01 01:01 minute: 'M/d h:mm', // ex: 1/1 1:11
hour: 'MM/dd hh:00', // ex: 01/01 01:00 hour: 'M/d h:mm', // ex: 1/1 1:11
day: 'MM/dd', // ex: 01/01 day: 'M/d h', // ex: 1/1 1
month: 'yyyy/MM', // ex: 1911/01 month: 'y/M/d', // ex: 1911/1/1
}, },
round: true round: true
}, },
@@ -341,6 +341,7 @@ export default {
}; };
break; break;
case 'count': case 'count':
setOption.scales.y.ticks.precision = 0; // y 軸顯示小數點後 0 位
setOption.plugins.tooltip.callbacks.label = function(context) { setOption.plugins.tooltip.callbacks.label = function(context) {
return `${content.y}: ${context.parsed.y}`; return `${content.y}: ${context.parsed.y}`;
}; };
@@ -573,6 +574,7 @@ export default {
}; };
break; break;
case 'count': case 'count':
setOption.scales.x.ticks.precision = 0; // x 軸顯示小數點後 0 位
setOption.plugins.tooltip.callbacks.label = function(context) { setOption.plugins.tooltip.callbacks.label = function(context) {
return `${content.x}: ${context.parsed.x}`; return `${content.x}: ${context.parsed.x}`;
} }