diff --git a/README.md b/README.md index 9cd9a62..7e349d3 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ app.py ----服务器的主程序 ## 更新日志 +* 2021年2月8号,前端更新 + + * 新增在弹出窗口里嵌入bokehjs代码的功能 + * ![avatar](./doc/schematic5.png) * 2021年2月8号,前端更新,后端更新 * 优化了mos器件的描述方法 @@ -90,7 +94,7 @@ app.py ----服务器的主程序 * 增加了按下delete键删除元素的功能 * 发现了一些bug,例如当进行FlipH和FlipV时端口无法跟着进行翻转 * 当前的功能界面如下图所示 - * ![avatar](./doc/schematic.png) + * ![avatar](./doc/schematic1.png) * 2021年1月28日,前端更新 * 增加了一些功能控件,完成基本雏形 diff --git a/doc/schematic.png b/doc/schematic1.png similarity index 100% rename from doc/schematic.png rename to doc/schematic1.png diff --git a/doc/schematic5.png b/doc/schematic5.png new file mode 100644 index 0000000..59a6f20 Binary files /dev/null and b/doc/schematic5.png differ diff --git a/static/spice/bokeh_01.js b/static/spice/bokeh_01.js new file mode 100644 index 0000000..fc9929c --- /dev/null +++ b/static/spice/bokeh_01.js @@ -0,0 +1,43 @@ + +// create a data source to hold data +var source = new Bokeh.ColumnDataSource({ + data: { x: [], y: [] } +}); + +// make a plot with some tools +var plot = Bokeh.Plotting.figure({ + title:'Example of Random data', + tools: "pan,wheel_zoom,box_zoom,reset,save", + height: 300, + width: 300 +}); + +// add a line with data from the source +plot.line({ field: "x" }, { field: "y" }, { + source: source, + line_width: 2 +}); + +// show the plot, appending it to the end of the current section +Bokeh.Plotting.show(plot,'#bokeh_01'); + +function addPoint() { + // add data --- all fields must be the same length. + source.data.x.push(Math.random()) + source.data.y.push(Math.random()) + + // notify the DataSource of "in-place" changes + source.change.emit() +} + +function Callback_Button() { + addPoint(); +} + +var addDataButton = document.createElement("Button"); +addDataButton.appendChild(document.createTextNode("Add Some Data!!!")); +document.currentScript.parentElement.appendChild(addDataButton); +addDataButton.addEventListener("click", Callback_Button); + +addPoint(); +addPoint(); diff --git a/template/schematic/schematic.html b/template/schematic/schematic.html index 0e1a0e1..5c3a3bc 100644 --- a/template/schematic/schematic.html +++ b/template/schematic/schematic.html @@ -1,12 +1,11 @@ - Toolbar example for mxGraph + CZ Open Spice Schematic + + + + + + @@ -1076,23 +1081,16 @@ function showOutline(graph) } } })); - // Shows XML for debugging the actual model - document.body.appendChild(mxUtils.button('Show XML', function() - { - var encoder = new mxCodec(); - var node = encoder.encode(graph.getModel()); - mxUtils.popup(mxUtils.getPrettyXml(node), true); - })); - document.body.appendChild(mxUtils.button('Show Spice', function() + document.body.appendChild(mxUtils.button('Show info', function() { - var node = ParseSpice(graph.getModel()); var circuit = NormalizeXML(node); let spice = ExtractSpice(circuit); mxUtils.popup(spice, true); })); - document.body.appendChild(mxUtils.button('Show Spice 2', function() + + document.body.appendChild(mxUtils.button('Show Spice', function() { var node = ParseSpice(graph.getModel()); @@ -1103,7 +1101,6 @@ function showOutline(graph) document.body.appendChild(mxUtils.button('Send Spice', function() { - var node = ParseSpice(graph.getModel()); var circuit = NormalizeXML(node); let spice = ExtractSpice_2(circuit); @@ -1120,7 +1117,38 @@ function showOutline(graph) } }); - })); + })); + + document.body.appendChild(mxUtils.button('wnd test', function() + { + + var frame = document.createElement('div'); + frame.setAttribute('id','bokeh_01'); + + var x = document.createElement('script'); + x.setAttribute('src','static/spice/bokeh_01.js'); + + frame.appendChild(x); + + var w = document.body.clientWidth; + var h = (document.body.clientHeight || document.documentElement.clientHeight); + var wnd = new mxWindow('Title', frame, (w-200)/2, (h-200)/3, 400, 400, true, true); + + wnd.setVisible(true); + wnd.setScrollable(true); + wnd.setResizable(true); + wnd.setVisible(true); + wnd.setClosable(true); + + })); + + // Shows XML for debugging the actual model + // document.body.appendChild(mxUtils.button('Show XML', function() + // { + // var encoder = new mxCodec(); + // var node = encoder.encode(graph.getModel()); + // mxUtils.popup(mxUtils.getPrettyXml(node), true); + // })); // // Extract SPICE model // document.body.appendChild(mxUtils.button('Show Info', function()