-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.aardio
65 lines (56 loc) · 2.91 KB
/
main.aardio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import win.ui;
/*DSG{{*/
mainForm = win.form(text="ScottPlot_Demo";right=823;bottom=525)
mainForm.add(
button1={cls="button";text="1";left=4;top=489;right=34;bottom=525;db=1;dl=1;z=2};
button10={cls="button";text="10";left=344;top=489;right=374;bottom=525;db=1;dl=1;z=11};
button11={cls="button";text="11";left=382;top=489;right=412;bottom=525;db=1;dl=1;z=13};
button12={cls="button";text="12";left=420;top=489;right=450;bottom=525;db=1;dr=1;z=14};
button13={cls="button";text="13";left=457;top=489;right=487;bottom=525;db=1;dr=1;z=15};
button14={cls="button";text="14";left=495;top=489;right=525;bottom=525;db=1;dr=1;z=16};
button15={cls="button";text="15";left=533;top=489;right=563;bottom=525;db=1;dr=1;z=17};
button16={cls="button";text="16";left=571;top=489;right=601;bottom=525;db=1;dr=1;z=18};
button17={cls="button";text="17";left=608;top=489;right=638;bottom=525;db=1;dr=1;z=19};
button18={cls="button";text="18";left=646;top=489;right=676;bottom=525;db=1;dr=1;z=20};
button19={cls="button";text="19";left=684;top=489;right=714;bottom=525;db=1;dr=1;z=12};
button2={cls="button";text="2";left=42;top=489;right=72;bottom=525;db=1;dl=1;z=3};
button3={cls="button";text="3";left=80;top=489;right=110;bottom=525;db=1;dl=1;z=4};
button4={cls="button";text="4";left=117;top=489;right=147;bottom=525;db=1;dl=1;z=5};
button5={cls="button";text="5";left=155;top=489;right=185;bottom=525;db=1;dl=1;z=6};
button6={cls="button";text="6";left=193;top=489;right=223;bottom=525;db=1;dl=1;z=7};
button7={cls="button";text="7";left=231;top=489;right=261;bottom=525;db=1;dl=1;z=8};
button8={cls="button";text="8";left=268;top=489;right=298;bottom=525;db=1;dl=1;z=9};
button9={cls="button";text="9";left=306;top=489;right=336;bottom=525;db=1;dl=1;z=10};
custom={cls="custom";text="自定义控件";left=0;top=0;right=824;bottom=485;bgcolor=12639424;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
import System.ValueTuple;
import ScottPlot;
var Chart = ScottPlot.FormsPlot();
//绑定界面
dotNet.setParent(Chart,mainForm.custom);
var ys = ScottPlot.DataGen.NoisyLinear(null, 100,1,30, 20);
var xs = ScottPlot.DataGen.Consecutive(#ys);
var x1 = xs[1];
var x2 = xs[#xs];
var arr = System.ValueTuple.Create(dotNet.double(x1),dotNet.double(x2));
// use the linear regression fitter to fit these data
var model = ScottPlot.Statistics.LinearRegressionLine(xs, ys);
// plot the original data and add the regression line
Chart.Plot.Title('Linear Regression\n' ++ "Y = "++model.slope++"x + "++model.offset++ " (R² = "++model.rSquared++")");
Chart.Plot.AddScatter(xs, ys, null, 0);
Chart.Plot.AddLine(model.slope, model.offset, arr,null, 2);
Chart.Refresh(true,false);
run = function(text){
if(text!="" or text!=null){
var frmChild = mainForm.loadForm("\dlg\demo"++text++".aardio");
frmChild.show();
}
}
for(i=1;19;1){
mainForm["button"++i].oncommand = function(id,event){
run(i);
};
}
mainForm.show();
return win.loopMessage();