Skip to content

Hotfix for 2.2.5 #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 33 additions & 19 deletions html/m_visualize/seaborn.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,29 +114,34 @@
<!-- Auto-create -->
</select>
</div>
<div class="vp-grid-box sb-option">
<label><input type="checkbox" id="showValues" class="vp-state"/><span>Show values</span></label>
<input type="number" id="showValuesPrecision" class="vp-state" placeholder="Type precision (0 ~ 5)" min="0" max="5"/>
</div>
<div class="vp-grid-col-p50 sb-option" style="grid-column-start: 1;grid-column-end: 3;">
<div class="vp-grid-box">
<label class="vp-bold">Sort values by
<select id="sortBy" class="vp-state vp-select" style="width: 75px;height:25px;">
<div class="vp-grid-box sb-option" style="grid-column-start: 1;grid-column-end: 3;">
<hr style="margin:5px;"/>
<label class="vp-tab-group-title">Sort</label>
<div class="vp-grid-col-p50">
<div class="vp-grid-col-95">
<label for="sortType">Order</label>
<select id="sortType" class="vp-state vp-select m">
<option value="">No sorting</option>
<option value="descending">Sort in descending order</option>
<option value="ascending">Sort in ascending order</option>
</select>
</div>
<div class="vp-grid-col-95">
<label for="sortBy">Sort by</label>
<select id="sortBy" class="vp-state vp-select m">
<option value="y">y axis</option>
<option value="x">x axis</option>
</select>
</label>
<select id="sortType" class="vp-state">
<option value="">No sorting</option>
<option value="descending">Sort in descending order</option>
<option value="ascending">Sort in ascending order</option>
</select>
</div>
</div>
<div class="vp-grid-box">
<label class="vp-bold">Sort condition</label>
<input type="text" id="sortHue" class="vp-input vp-state" placeholder="Type hue condition"/>
<label><input type="checkbox" id="sortHueText" class="vp-state"/><span>Text</span></label>
<div class="vp-grid-col-95 sb-option">
<label for="sortHue">Hue condition</label>
<div>
<input type="text" id="sortHue" class="vp-input vp-state" placeholder="Type hue condition"/>
<label><input type="checkbox" id="sortHueText" class="vp-state" checked/><span>Text</span></label>
</div>
</div>
<hr style="margin:5px;"/>
</div>
</div>
<label for="userOption" class="vp-bold">User Option</label>
Expand Down Expand Up @@ -207,7 +212,16 @@
<input type="text" id="y_label" class="vp-input vp-state" placeholder="Type Y Label" />
</div>
</div>

<div class="vp-grid-box sb-option">
<hr style="margin:5px;"/>
<label class="vp-tab-group-title">Show values</label>
<label><input type="checkbox" id="showValues" class="vp-state"/><span>Show values on the top of bar</span></label>
<div class="vp-grid-col-95">
<label for="showValuesPrecision">Decimal place</label>
<input type="number" id="showValuesPrecision" class="vp-state" placeholder="Type decimal places(0~5)" min="0" max="5"/>
</div>
<hr style="margin:5px;"/>
</div>
<label for="useLegend" class="vp-bold">Legend</label>
<div class="vp-grid-col-p50">
<select id="legendPos" class="vp-select vp-state">
Expand Down
12 changes: 10 additions & 2 deletions js/com/com_Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ define([
'%matplotlib inline'
]
},
{ library: 'seaborn', alias:'sns' }
{ library: 'seaborn', alias:'sns' },
{
library: 'plotly.express', alias: 'px',
include: [
'from plotly.offline import init_notebook_mode',
'init_notebook_mode(connected=True)'
]
}
]
}

Expand Down Expand Up @@ -142,7 +149,7 @@ define([
type: 'package'
},
'px': {
code: 'import plotly.express as px',
code: 'import plotly.express as px\nfrom plotly.offline import init_notebook_mode\ninit_notebook_mode(connected=True)',
type: 'package'
},
'WordCloud': {
Expand Down Expand Up @@ -251,6 +258,7 @@ define([
'fileNaviCommand.py',
'pandasCommand.py',
'variableCommand.py',
'visualizationCommand.py',
// 'userCommand.py'
];
let promiseList = [];
Expand Down
4 changes: 3 additions & 1 deletion js/com/component/PopupComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ define([
*/
checkRequiredOption() {
let requiredFilled = true;
let requiredTags = $(this.wrapSelector('input[required=true],input[required=required]'));
let requiredTags = $(this.wrapSelector('input[required=true]') + ',' + this.wrapSelector('input[required=required]'));

vpLog.display(VP_LOG_TYPE.DEVELOP, 'checkRequiredOption', this, requiredTags);

if (requiredTags) {
for (let i = 0; i < requiredTags.length; i++) {
Expand Down
26 changes: 19 additions & 7 deletions js/m_apps/Import.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ define([
, include: [
'%matplotlib inline'
]
},
{ i0: 'seaborn', i1: 'sns', type: 'module'},
{
i0: 'plotly.express', i1: 'px', type: 'module'
, include: [
'from plotly.offline import init_notebook_mode',
'init_notebook_mode(connected=True)'
]
}
],
'machine-learning': [
Expand All @@ -46,7 +54,6 @@ define([
/** Write codes executed before rendering */
this.config.dataview = false;
this.config.sizeLevel = 1;
this.config.checkModules = ['pd'];

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

// Need additional code?
if (pacI0 == 'matplotlib.pyplot' || pacI0 == 'matplotlib') {
sbCode.appendLine();
sbCode.append('%matplotlib inline');
// Need additional code?
if (pacI0 == 'matplotlib.pyplot' || pacI0 == 'matplotlib') {
sbCode.appendLine();
sbCode.append('%matplotlib inline');
}
if (pacI0 == 'plotly.express' || pacI0 == 'plotly') {
sbCode.appendLine();
sbCode.appendLine('from plotly.offline import init_notebook_mode');
sbCode.append('init_notebook_mode(connected=True)');
}
}

importMeta.push({ i0: pacI0, i1: pacI1, type: pacType, checked: pacChecked });
}
this.state.importMeta = importMeta;
Expand Down
6 changes: 4 additions & 2 deletions js/m_apps/Profiling.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ define([
code.append(saveas);
break;
}
com_interface.insertCell('code', code.toString(), true, 'Data Analysis > Profiling');
that.loadReportList();
that.checkAndRunModules(true).then(function() {
com_interface.insertCell('code', code.toString(), true, 'Data Analysis > Profiling');
that.loadReportList();
});
});
}

Expand Down
1 change: 1 addition & 0 deletions js/m_ml/DataSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ define([
super._init();
this.config.sizeLevel = 2;
this.config.dataview = false;
this.config.checkModules = ['pd'];

this.state = {
loadType: 'load_boston',
Expand Down
2 changes: 1 addition & 1 deletion js/m_ml/ModelInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ define([
options: [
{ name: 'fi_featureData', label: 'Feature Data', component: ['data_select'], var_type: ['DataFrame', 'Series', 'ndarray', 'list', 'dict'], value: 'X_train' },
{ name: 'sort', label: 'Sort data', component: ['bool_checkbox'], value: true, usePair: true },
{ name: 'top_count', label: 'Top count', component: ['input_number'], min: 0, max: 5, usePair: true },
{ name: 'top_count', label: 'Top count', component: ['input_number'], min: 0, usePair: true },
]
}
}
Expand Down
3 changes: 2 additions & 1 deletion js/m_visualize/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,11 @@ define([
var fontSize = $(this.wrapSelector('#vp_plFontSize')).val();

code.appendLine('import matplotlib.pyplot as plt');
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figWidth, figHeight);
code.appendLine('%matplotlib inline');
if (styleName && styleName.length > 0) {
code.appendFormatLine("plt.style.use('{0}')", styleName);
}
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figWidth, figHeight);
code.appendLine();

code.appendLine('from matplotlib import rcParams');
Expand Down
10 changes: 5 additions & 5 deletions js/m_visualize/ChartSetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ define([
this.config.dataview = false;

this.state = {
figureWidth: 12,
figureHeight: 8,
figureWidth: '12',
figureHeight: '8',
styleSheet: '',
fontName: '',
fontSize: 10,
fontSize: '10',
...this.state
}
}
Expand Down Expand Up @@ -124,7 +124,7 @@ define([
generateImportCode() {
var code = new com_String();
code.appendLine('import matplotlib.pyplot as plt');
code.append('%matplotlib inline');
code.appendLine('%matplotlib inline');
code.appendLine('import seaborn as sns');
return [code.toString()];
}
Expand All @@ -144,10 +144,10 @@ define([
code.appendLine('import matplotlib.pyplot as plt');
code.appendLine('%matplotlib inline');
code.appendLine('import seaborn as sns');
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figureWidth, figureHeight);
if (styleSheet && styleSheet.length > 0) {
code.appendFormatLine("plt.style.use('{0}')", styleSheet);
}
code.appendFormatLine("plt.rc('figure', figsize=({0}, {1}))", figureWidth, figureHeight);
code.appendLine();

code.appendLine('from matplotlib import rcParams');
Expand Down
5 changes: 5 additions & 0 deletions js/m_visualize/Plotly.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@ define([
// let height = $(this.wrapSelector('#vp_ptPreview')).height();
// console.log(width, height);
etcOptionCode.push(com_util.formatString('width={0}, height={1}', width, height));

// no auto-import for preview
this.config.checkModules = [];
} else {
this.config.checkModules = ['px'];
}

let generatedCode = com_generator.vp_codeGenerator(this, config, this.state
Expand Down
Loading