@@ -60,6 +60,8 @@ define([
60
60
61
61
this . columnBindList = [ 'depVar' , 'factor' , 'factorA' , 'factorB' , 'covariate' ] ;
62
62
63
+ this . tmpInstallCode = [ ] ; // install codes
64
+
63
65
this . subsetEditor = { } ;
64
66
}
65
67
@@ -74,6 +76,29 @@ define([
74
76
75
77
$ ( that . wrapSelector ( '.vp-st-option' ) ) . hide ( ) ;
76
78
$ ( that . wrapSelector ( '.vp-st-option.' + testType ) ) . show ( ) ;
79
+
80
+ that . tmpInstallCode = [ ] ;
81
+ that . hideInstallButton ( ) ;
82
+
83
+ if ( testType === 'one-way' || testType === 'two-way' ) {
84
+ if ( that . state . tukey || that . state . scheffe || that . state . duncan ) {
85
+ // Add installation code
86
+ if ( vpConfig . extensionType === 'lite' ) {
87
+ that . tmpInstallCode = [ "%pip install scikit-posthocs" ] ;
88
+ } else {
89
+ that . tmpInstallCode = [ "!pip install scikit-posthocs" ] ;
90
+ }
91
+ that . showInstallButton ( ) ;
92
+ }
93
+ } else if ( testType === 'ancova' ) {
94
+ // Add installation code : # pip install pingouin
95
+ if ( vpConfig . extensionType === 'lite' ) {
96
+ that . tmpInstallCode = [ "%pip install pingouin" ] ;
97
+ } else {
98
+ that . tmpInstallCode = [ "!pip install pingouin" ] ;
99
+ }
100
+ that . showInstallButton ( ) ;
101
+ }
77
102
} ) ;
78
103
79
104
$ ( this . wrapSelector ( '#data' ) ) . on ( 'change' , function ( ) {
@@ -91,6 +116,28 @@ define([
91
116
com_generator . vp_bindColumnSource ( that , 'data' , that . columnBindList , 'select' , false , false ) ;
92
117
}
93
118
} ) ;
119
+
120
+ $ ( this . wrapSelector ( '.vp-st-posthoc-box .vp-state' ) ) . on ( 'change' , function ( ) {
121
+ let id = $ ( this ) [ 0 ] . id ;
122
+ let checked = $ ( this ) . prop ( 'checked' ) === true ;
123
+ that . state [ id ] = checked ;
124
+ let { testType, tukey, scheffe, duncan } = that . state ;
125
+ if ( testType === 'one-way' || testType === 'two-way' ) {
126
+ if ( tukey || scheffe || duncan ) {
127
+ // Add installation code
128
+ if ( vpConfig . extensionType === 'lite' ) {
129
+ that . tmpInstallCode = [ "%pip install scikit-posthocs" ] ;
130
+ } else {
131
+ that . tmpInstallCode = [ "!pip install scikit-posthocs" ] ;
132
+ }
133
+ that . showInstallButton ( ) ;
134
+ } else {
135
+ that . hideInstallButton ( ) ;
136
+ }
137
+ }
138
+ } ) ;
139
+
140
+ $ ( this . wrapSelector ( '' ) )
94
141
}
95
142
96
143
templateForBody ( ) {
@@ -147,6 +194,10 @@ define([
147
194
$ ( this . wrapSelector ( '.vp-st-option.' + this . state . testType ) ) . show ( ) ;
148
195
}
149
196
197
+ generateInstallCode ( ) {
198
+ return this . tmpInstallCode ;
199
+ }
200
+
150
201
generateCode ( ) {
151
202
let {
152
203
testType, data, depVar, factor, factorA, factorB, covariate, sigLevel,
@@ -253,12 +304,6 @@ define([
253
304
}
254
305
255
306
if ( tukey === true || scheffe === true || duncan === true ) {
256
- if ( vpConfig . extensionType === 'lite' ) {
257
- codeList . push ( "%pip install scikit-posthocs" ) ;
258
- } else {
259
- codeList . push ( "!pip install scikit-posthocs" ) ;
260
- }
261
-
262
307
// Post hoc analysis - Tukey
263
308
if ( tukey === true ) {
264
309
code . appendLine ( ) ;
@@ -383,13 +428,6 @@ define([
383
428
code . append ( "display(_res[0])" ) ;
384
429
}
385
430
if ( tukey === true || scheffe === true || duncan === true ) {
386
- // Add installation code
387
- if ( vpConfig . extensionType === 'lite' ) {
388
- codeList . push ( "%pip install scikit-posthocs" ) ;
389
- } else {
390
- codeList . push ( "!pip install scikit-posthocs" ) ;
391
- }
392
-
393
431
// Post hoc analysis - Tukey
394
432
if ( tukey === true ) {
395
433
code . appendLine ( ) ;
@@ -453,13 +491,6 @@ define([
453
491
code . append ( " plt.show()" ) ;
454
492
}
455
493
456
- // Add installation code : # pip install pingouin
457
- if ( vpConfig . extensionType === 'lite' ) {
458
- codeList . push ( "%pip install pingouin" ) ;
459
- } else {
460
- codeList . push ( "!pip install pingouin" ) ;
461
- }
462
-
463
494
code . appendLine ( ) ;
464
495
code . appendLine ( ) ;
465
496
code . appendLine ( "# ANCOVA - Analysis of covariance" ) ;
0 commit comments