Skip to content

Commit 38bf7d0

Browse files
authored
Merge pull request #140 from minjk-bl/devops
Hotfix for 2.2.5
2 parents c9b0c23 + fe98a89 commit 38bf7d0

14 files changed

+222
-98
lines changed

html/m_visualize/seaborn.html

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,29 +114,34 @@
114114
<!-- Auto-create -->
115115
</select>
116116
</div>
117-
<div class="vp-grid-box sb-option">
118-
<label><input type="checkbox" id="showValues" class="vp-state"/><span>Show values</span></label>
119-
<input type="number" id="showValuesPrecision" class="vp-state" placeholder="Type precision (0 ~ 5)" min="0" max="5"/>
120-
</div>
121-
<div class="vp-grid-col-p50 sb-option" style="grid-column-start: 1;grid-column-end: 3;">
122-
<div class="vp-grid-box">
123-
<label class="vp-bold">Sort values by
124-
<select id="sortBy" class="vp-state vp-select" style="width: 75px;height:25px;">
117+
<div class="vp-grid-box sb-option" style="grid-column-start: 1;grid-column-end: 3;">
118+
<hr style="margin:5px;"/>
119+
<label class="vp-tab-group-title">Sort</label>
120+
<div class="vp-grid-col-p50">
121+
<div class="vp-grid-col-95">
122+
<label for="sortType">Order</label>
123+
<select id="sortType" class="vp-state vp-select m">
124+
<option value="">No sorting</option>
125+
<option value="descending">Sort in descending order</option>
126+
<option value="ascending">Sort in ascending order</option>
127+
</select>
128+
</div>
129+
<div class="vp-grid-col-95">
130+
<label for="sortBy">Sort by</label>
131+
<select id="sortBy" class="vp-state vp-select m">
125132
<option value="y">y axis</option>
126133
<option value="x">x axis</option>
127134
</select>
128-
</label>
129-
<select id="sortType" class="vp-state">
130-
<option value="">No sorting</option>
131-
<option value="descending">Sort in descending order</option>
132-
<option value="ascending">Sort in ascending order</option>
133-
</select>
135+
</div>
134136
</div>
135-
<div class="vp-grid-box">
136-
<label class="vp-bold">Sort condition</label>
137-
<input type="text" id="sortHue" class="vp-input vp-state" placeholder="Type hue condition"/>
138-
<label><input type="checkbox" id="sortHueText" class="vp-state"/><span>Text</span></label>
137+
<div class="vp-grid-col-95 sb-option">
138+
<label for="sortHue">Hue condition</label>
139+
<div>
140+
<input type="text" id="sortHue" class="vp-input vp-state" placeholder="Type hue condition"/>
141+
<label><input type="checkbox" id="sortHueText" class="vp-state" checked/><span>Text</span></label>
142+
</div>
139143
</div>
144+
<hr style="margin:5px;"/>
140145
</div>
141146
</div>
142147
<label for="userOption" class="vp-bold">User Option</label>
@@ -207,7 +212,16 @@
207212
<input type="text" id="y_label" class="vp-input vp-state" placeholder="Type Y Label" />
208213
</div>
209214
</div>
210-
215+
<div class="vp-grid-box sb-option">
216+
<hr style="margin:5px;"/>
217+
<label class="vp-tab-group-title">Show values</label>
218+
<label><input type="checkbox" id="showValues" class="vp-state"/><span>Show values on the top of bar</span></label>
219+
<div class="vp-grid-col-95">
220+
<label for="showValuesPrecision">Decimal place</label>
221+
<input type="number" id="showValuesPrecision" class="vp-state" placeholder="Type decimal places(0~5)" min="0" max="5"/>
222+
</div>
223+
<hr style="margin:5px;"/>
224+
</div>
211225
<label for="useLegend" class="vp-bold">Legend</label>
212226
<div class="vp-grid-col-p50">
213227
<select id="legendPos" class="vp-select vp-state">

js/com/com_Config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,14 @@ define([
104104
'%matplotlib inline'
105105
]
106106
},
107-
{ library: 'seaborn', alias:'sns' }
107+
{ library: 'seaborn', alias:'sns' },
108+
{
109+
library: 'plotly.express', alias: 'px',
110+
include: [
111+
'from plotly.offline import init_notebook_mode',
112+
'init_notebook_mode(connected=True)'
113+
]
114+
}
108115
]
109116
}
110117

@@ -142,7 +149,7 @@ define([
142149
type: 'package'
143150
},
144151
'px': {
145-
code: 'import plotly.express as px',
152+
code: 'import plotly.express as px\nfrom plotly.offline import init_notebook_mode\ninit_notebook_mode(connected=True)',
146153
type: 'package'
147154
},
148155
'WordCloud': {
@@ -251,6 +258,7 @@ define([
251258
'fileNaviCommand.py',
252259
'pandasCommand.py',
253260
'variableCommand.py',
261+
'visualizationCommand.py',
254262
// 'userCommand.py'
255263
];
256264
let promiseList = [];

js/com/component/PopupComponent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ define([
709709
*/
710710
checkRequiredOption() {
711711
let requiredFilled = true;
712-
let requiredTags = $(this.wrapSelector('input[required=true],input[required=required]'));
712+
let requiredTags = $(this.wrapSelector('input[required=true]') + ',' + this.wrapSelector('input[required=required]'));
713+
714+
vpLog.display(VP_LOG_TYPE.DEVELOP, 'checkRequiredOption', this, requiredTags);
713715

714716
if (requiredTags) {
715717
for (let i = 0; i < requiredTags.length; i++) {

js/m_apps/Import.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ define([
2929
, include: [
3030
'%matplotlib inline'
3131
]
32+
},
33+
{ i0: 'seaborn', i1: 'sns', type: 'module'},
34+
{
35+
i0: 'plotly.express', i1: 'px', type: 'module'
36+
, include: [
37+
'from plotly.offline import init_notebook_mode',
38+
'init_notebook_mode(connected=True)'
39+
]
3240
}
3341
],
3442
'machine-learning': [
@@ -46,7 +54,6 @@ define([
4654
/** Write codes executed before rendering */
4755
this.config.dataview = false;
4856
this.config.sizeLevel = 1;
49-
this.config.checkModules = ['pd'];
5057

5158
let savedData = vpConfig.getDataSimple('', 'vpimport');
5259
// Reset abnormal data
@@ -243,14 +250,19 @@ define([
243250
// module
244251
sbCode.appendFormat("import {0}{1}", pacI0, ((pacI1 === undefined || pacI1 === "") ? "" : (" as " + pacI1)));
245252
}
246-
}
247253

248-
// Need additional code?
249-
if (pacI0 == 'matplotlib.pyplot' || pacI0 == 'matplotlib') {
250-
sbCode.appendLine();
251-
sbCode.append('%matplotlib inline');
254+
// Need additional code?
255+
if (pacI0 == 'matplotlib.pyplot' || pacI0 == 'matplotlib') {
256+
sbCode.appendLine();
257+
sbCode.append('%matplotlib inline');
258+
}
259+
if (pacI0 == 'plotly.express' || pacI0 == 'plotly') {
260+
sbCode.appendLine();
261+
sbCode.appendLine('from plotly.offline import init_notebook_mode');
262+
sbCode.append('init_notebook_mode(connected=True)');
263+
}
252264
}
253-
265+
254266
importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: pacChecked });
255267
}
256268
this.state.importMeta = importMeta;

js/m_apps/Profiling.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ define([
8282
code.append(saveas);
8383
break;
8484
}
85-
com_interface.insertCell('code', code.toString(), true, 'Data Analysis > Profiling');
86-
that.loadReportList();
85+
that.checkAndRunModules(true).then(function() {
86+
com_interface.insertCell('code', code.toString(), true, 'Data Analysis > Profiling');
87+
that.loadReportList();
88+
});
8789
});
8890
}
8991

js/m_ml/DataSets.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ define([
3030
super._init();
3131
this.config.sizeLevel = 2;
3232
this.config.dataview = false;
33+
this.config.checkModules = ['pd'];
3334

3435
this.state = {
3536
loadType: 'load_boston',

js/m_ml/ModelInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ define([
438438
options: [
439439
{ name: 'fi_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X_train' },
440440
{ name: 'sort', label: 'Sort data', component: ['bool_checkbox'], value: true, usePair: true },
441-
{ name: 'top_count', label: 'Top count', component: ['input_number'], min: 0, max: 5, usePair: true },
441+
{ name: 'top_count', label: 'Top count', component: ['input_number'], min: 0, usePair: true },
442442
]
443443
}
444444
}

js/m_visualize/Chart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,11 @@ define([
570570
var fontSize = $(this.wrapSelector('#vp_plFontSize')).val();
571571

572572
code.appendLine('import matplotlib.pyplot as plt');
573-
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figWidth, figHeight);
573+
code.appendLine('%matplotlib inline');
574574
if (styleName && styleName.length > 0) {
575575
code.appendFormatLine("plt.style.use('{0}')", styleName);
576576
}
577+
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figWidth, figHeight);
577578
code.appendLine();
578579

579580
code.appendLine('from matplotlib import rcParams');

js/m_visualize/ChartSetting.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ define([
2929
this.config.dataview = false;
3030

3131
this.state = {
32-
figureWidth: 12,
33-
figureHeight: 8,
32+
figureWidth: '12',
33+
figureHeight: '8',
3434
styleSheet: '',
3535
fontName: '',
36-
fontSize: 10,
36+
fontSize: '10',
3737
...this.state
3838
}
3939
}
@@ -124,7 +124,7 @@ define([
124124
generateImportCode() {
125125
var code = new com_String();
126126
code.appendLine('import matplotlib.pyplot as plt');
127-
code.append('%matplotlib inline');
127+
code.appendLine('%matplotlib inline');
128128
code.appendLine('import seaborn as sns');
129129
return [code.toString()];
130130
}
@@ -144,10 +144,10 @@ define([
144144
code.appendLine('import matplotlib.pyplot as plt');
145145
code.appendLine('%matplotlib inline');
146146
code.appendLine('import seaborn as sns');
147-
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figureWidth, figureHeight);
148147
if (styleSheet && styleSheet.length > 0) {
149148
code.appendFormatLine("plt.style.use('{0}')", styleSheet);
150149
}
150+
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figureWidth, figureHeight);
151151
code.appendLine();
152152

153153
code.appendLine('from matplotlib import rcParams');

js/m_visualize/Plotly.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ define([
549549
// let height = $(this.wrapSelector('#vp_ptPreview')).height();
550550
// console.log(width, height);
551551
etcOptionCode.push(com_util.formatString('width={0}, height={1}', width, height));
552+
553+
// no auto-import for preview
554+
this.config.checkModules = [];
555+
} else {
556+
this.config.checkModules = ['px'];
552557
}
553558

554559
let generatedCode = com_generator.vp_codeGenerator(this, config, this.state

0 commit comments

Comments
 (0)