Warning, /graphics/kst-plot/devel-docs/deprecated/scripting.txt is written in an unsupported language. File is not indexed.
0001 Javascript Definition: 0002 0003 Overview: 0004 A planck-HFI reqirement is that kst support scripting to allow flexable 0005 generation of complex plots. We plan to use JavaScript as excellent 0006 facilities for this exist within KDE. 0007 0008 Requirements: 0009 - Complete bindings to all objects 0010 - everything that can be done in a .kst file can be done with a 0011 javascript 0012 - DCOP based commandline tool with konsole 0013 - will provide a 'command line' to kst (like sm or idl) 0014 - Can be commanded from either an embedded konsole, or an external 0015 konsole. 0016 - Multiple ways of entering scripts 0017 - from command line when starting kst 0018 eg: kst -J "file=\"data.dat\";field=\"N15C2\"" bolo.js 0019 - From file menue 0020 - From DCOP/command line tool. 0021 - We will not use automatic bindings. Instead, we will "ideal" bindings 0022 and implement them as internal calls to our internal objects 0023 - The update thread doesn't run if the interpreter is running, and blocks the 0024 interpreter from starting up during an update There will be a force 0025 update/repaint mechanism to allow updates during script interpretation. 0026 - vectors can be referenced as strings (tagname) everywhere too 0027 0028 0029 Open Questions: 0030 - kjsembed or qsa? 0031 0032 0033 Examples: 0034 A plot with points + error bars, and a line fit. 0035 The X axis vector has to be re-scaled. 0036 0037 var f = new DataSource("Data.dat"); 0038 if (!f) { 0039 alert("error"); 0040 } 0041 0042 var Vx = new DataVector(f, "1"); 0043 string Vn = (new DataVector(f, "2", start, end)).tagName(); 0044 var Vp = new DataVector(f, "3", start, end, skip); 0045 var Vm = new DataVector(f, "4", start, end, skip, ave); 0046 0047 // After here is unimplemented so far 0048 var Ex = Equation("[" + Vx.tag + "] * 0.0042", Vx); 0049 0050 var C = Curve(Ex.sv, Vn); 0051 C.hasPoint = true; 0052 C.hasLines = false; 0053 C.setYError(Vp, Vm); 0054 C.setPointType(6);. 0055 0056 var lfit = fit("kstfit_linear_unweighted", Ex.sv, Vn); 0057 0058 var Cf = Curve(Ex.sv, lfit.Y_Fitted); 0059 0060 var P = Plot(); 0061 0062 P.addCurve(C); // ordering etc............. P.curves.append() etc? 0063 P.addCurve(Cf); 0064 0065 P.xLabel.text = "x axis"; 0066 P.yLabel.text = "y axis"; 0067 0068 L = PlotLabel(lfit.parameterstring); 0069 L.setPos(0.2, 0.8); 0070 P.addLabel(L); 0071 0072 Window().addPlot(P); 0073