admin 管理员组

文章数量: 887021


2024年1月11日发(作者:计算机汉语言编程)

代码结构详细代码// 动态曲线

开始
结束
//Buttons();const myChart = new MyChart(mentById("myChart"));();function initButtons(){ var timer; const startBtn = new MyButton(elector("#start")); ntListener("click",function(){ timer = startTimer(); e(); });

const endBtn = new MyButton(elector("#end")); ntListener("click",function(){ closeTimer(timer); (); });}function startTimer(){ return timer = setInterval(function(){ (); },1000,myChart);}function closeTimer(timer){ clearInterval(timer)}//

data:values }] });

} function createTimes(myChart){ let {dotNum,interval,lastStartTime} = myChart; let startTime = lastStartTime?lastStartTime:new Date().getTime(); lastStartTime = startTime + interval; let times = [];

for(var i=0;i

function createValues(myChart){ let {dotNum,lastValues} = myChart; let values; if( === 0){ values = []; for(var i=0;i

function formatTime(time){ const hour = rs(); const min = utes(); const sec = onds(); const h = hour<10 ? "0"+hour : hour; const m = min<10 ? "0"+min : min; const s = sec<10 ? "0"+sec : sec; return h+":"+m+":"+s; } t = MyChart;}(window))

//(function(win){ function MyButton(elm){ = elm;

} ntListener = function(type,handler){ if(ntListener){ ntListener(type,handler,false); }else { ["on"+type] = handler; } } e = function(){ ("disabled"); } = function(){ ("disabled"); } on = MyButton;}(window));

//#myChart{ display:inline-block; width:400px;height:200px; border:1px solid lightgray; border-right:none; vertical-align:middle;}.container{ display:inline-block; width:80px;height:200px; border:1px solid lightgray; border-left:none; margin:-5px; vertical-align:middle;}.buttons{ display:table-cell; width:inherit;height: inherit; vertical-align: middle;}.button{ font-size:0.75em; padding:.3em; background-color:rgba(0,0,255,.5); border:1px solid transparent; border-radius:.5em; box-shadow:1px 1px 1px black; text-align:center; margin:1em;}.button:hover{ cursor:pointer; background-color:rgba(0,0,255,1); color:white;}.disabled{ background-color:lightgray; color:lavender; box-shadow:1px 1px 1px lightslategray;}.disabled:hover{ cursor:not-allowed; background-color:lightgray; color:lavender;}


本文标签: 代码 计算机 曲线 编程 动态