blank_Outline_pane.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. OnCutModelShow();
  12. OnOutlineModelShow();
  13. model.startLocalhost(()=>{
  14. ui.webview.value = "http://localhost:4000";
  15. parent.setTimeout(()=>{
  16. model.updateLineChart(getChart1());
  17. }, 100);
  18. });
  19. }
  20. function update(){
  21. model.updateLineChart(getChart1());
  22. }
  23. //Callback after UI is fully loaded and displayed.
  24. function OnReady(reload, preview) {
  25. PUI(()=>{
  26. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  27. //The 'pui' variable is valid in all functions of this document.
  28. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  29. });
  30. }
  31. function OnCloseForm() {
  32. }
  33. function OnException(err) {
  34. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  35. }
  36. //////////////////////////////////////////////////////////////////////////
  37. // Callback Functions.
  38. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  39. function getChart1() {
  40. option = {
  41. xAxis: {
  42. type: 'category',
  43. boundaryGap: false
  44. },
  45. yAxis: {
  46. type: 'value',
  47. boundaryGap: [0, '30%']
  48. },
  49. visualMap: {
  50. type: 'piecewise',
  51. show: false,
  52. dimension: 0,
  53. seriesIndex: 0,
  54. pieces: [
  55. {
  56. gt: 1,
  57. lt: 3,
  58. color: 'rgba(0, 0, 180, 0.4)'
  59. },
  60. {
  61. gt: 5,
  62. lt: 7,
  63. color: 'rgba(0, 0, 180, 0.4)'
  64. }
  65. ]
  66. },
  67. series: [
  68. {
  69. type: 'line',
  70. smooth: 0.6,
  71. symbol: 'none',
  72. lineStyle: {
  73. color: '#5470C6',
  74. width: 5
  75. },
  76. markLine: {
  77. symbol: ['none', 'none'],
  78. label: { show: false },
  79. data: [{ xAxis: 1 }, { xAxis: 3 }, { xAxis: 5 }, { xAxis: 7 }]
  80. },
  81. areaStyle: {},
  82. data: [
  83. ['2019-10-10', 200],
  84. ['2019-10-11', 560],
  85. ['2019-10-12', 750],
  86. ['2019-10-13', 580],
  87. ['2019-10-14', 250],
  88. ['2019-10-15', 300],
  89. ['2019-10-16', 450],
  90. ['2019-10-17', 300],
  91. ['2019-10-18', 100]
  92. ]
  93. }
  94. ]
  95. };
  96. return option;
  97. }
  98. function OnBlankChange(){
  99. unit.form.side_pane.OnBlankOutlineCopy();
  100. }
  101. function OnCutModelHide(){
  102. ui.cut_down_btn.visible = false;
  103. ui.cut_right_btn.visible = true;
  104. ui.cut_stk.visible = false;
  105. }
  106. function OnCutModelShow(){
  107. ui.cut_down_btn.visible = true;
  108. ui.cut_right_btn.visible = false;
  109. ui.cut_stk.visible = true;
  110. }
  111. function OnOutlineModelHide(){
  112. ui.outline_down_btn.visible = false;
  113. ui.outline_right_btn.visible = true;
  114. ui.outline_stk.visible = false;
  115. }
  116. function OnOutlineModelShow(){
  117. ui.outline_down_btn.visible = true;
  118. ui.outline_right_btn.visible = false;
  119. ui.outline_stk.visible = true;
  120. }
  121. //The message corresponding callback executed by the docker pane.
  122. // when calling [side_pane].fireEvent(type,para) in the main form.
  123. function OnParentDockerMessage(type, para) {
  124. }
  125. //////////////////////////////////////////////////////////////////////////
  126. // Utils Functions.
  127. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  128. function onDragFile(filepath) {
  129. }
  130. function PUI(cb) {
  131. if(pui){cb();}
  132. }
  133. /*Usage of BLOCK_EVENT
  134. BLOCK_EVENT(()=>{
  135. ui.[name].[var] = ...;
  136. });
  137. */
  138. function BLOCK_EVENT(cb) {
  139. ui.block_event = true;
  140. cb();
  141. ui.block_event = false;
  142. }
  143. //////////////////////////////////////////////////////////////////////////
  144. // template codes for cw callback js.
  145. function CW_DeclareVariable(name, setter, getter) {
  146. if(typeof(__DeclareVariable) === 'function') {
  147. __DeclareVariable(name, setter, getter);
  148. }
  149. }
  150. function CW_DeclareOuterVariable(name) {
  151. if(typeof(__DeclareOuterVariable) === 'function') {
  152. __DeclareOuterVariable(name);
  153. }
  154. }