学员学习折线图样式

This commit is contained in:
禺狨 2023-04-20 11:09:59 +08:00
parent 41ef729b3f
commit 922708647e

View File

@ -61,12 +61,12 @@ const MemberLearnPage = () => {
const minuteFormat = (duration: number) => { const minuteFormat = (duration: number) => {
if (duration === 0) { if (duration === 0) {
return 0; return "0小时0分0秒";
} }
let h = Math.trunc(duration / 3600); let h = Math.trunc(duration / 3600);
let m = Math.trunc((duration % 3600) / 60); let m = Math.trunc((duration % 3600) / 60);
let s = Math.trunc((duration % 3600) % 60); let s = Math.trunc((duration % 3600) % 60);
return h + "小时" + m + "分"; return h + "小时" + m + "分" + s + "秒";
}; };
const renderView = (params: any) => { const renderView = (params: any) => {
@ -75,7 +75,7 @@ const MemberLearnPage = () => {
params.map((item: any) => { params.map((item: any) => {
let time = minuteFormat(item.value / 1000); let time = minuteFormat(item.value / 1000);
timeData.push(item.key); timeData.push(item.key);
valueData.push(item.value / 1000); valueData.push(time);
}); });
let dom: any = chartRef.current; let dom: any = chartRef.current;
let myChart = echarts.init(dom); let myChart = echarts.init(dom);
@ -99,7 +99,8 @@ const MemberLearnPage = () => {
data: timeData, data: timeData,
}, },
yAxis: { yAxis: {
type: "value", type: "category",
boundaryGap: false,
}, },
series: [ series: [
{ {