//////////////////////////////////////////////////////////////////////////// // System Pre-define Functions // 95099372-ef3e-11ea-9c81-bf848405c62e //Callback of data preparation stage before UI is fully loaded. function OnInitializeData(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); ui.list.table = [["阶数", "特征值", "频率"]]; model.startLocalhost(()=>{ ui.webview.value = "http://localhost:4000"; parent.setTimeout(()=>{ //ui.type.enable = true; //OnLoad(); }, 100); }); } //Callback after UI is fully loaded and displayed. function OnReady(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); } function OnCloseForm() { } function OnException(err) { //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok); } ////////////////////////////////////////////////////////////////////////// // Callback Functions. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7 function OnReturnMenu(){ unit.form.mainfrm.menu(8); } function OnEnd(){ unit.form.mainfrm.OnSend('endModel'); } function OnPlay(){ unit.form.mainfrm.OnSend('playModel ' + model.getCurrentDirectory()); } function getChart1(val) { const xvalue = []; const yvalue = []; val.forEach((value, index) => { const cubeRoot = Math.sqrt(parseFloat(value)) / (2 * 3.1415926); //res.push([index + 1, value, cubeRoot]); xvalue.push(`第${index + 1}阶`); yvalue.push(cubeRoot); // 在这里可以执行其他操作 }); return { xAxis: { type: 'category', //data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: xvalue }, yAxis: { type: 'value' }, series: [ { //data: [150, 230, 224, 218, 135, 147, 260], data: yvalue, type: 'line' } ] }; } async function OnLoad(val){ model.updateLineChart(getChart1(val)); } function OnNextModel(){ if(parseFloat(model.getOrder()) === 24){ model.setOrder(5); }else{ model.setOrder(model.getOrder() + 1); } unit.form.mainfrm.OnSend('ModelAnsys ' + model.getCurrentDirectory() + ' ' + model.getOrder()); unit.form.mainfrm.OnChangePicture(5, 2); //unit.form.mainfrm.OnCueline('