Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6251919

Browse files
author
minjk-bl
committed
Edit figsize option's input on PandasPlot app
1 parentdd1c065 commit6251919

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

‎js/m_library/m_pandas/PandasPlot.js‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
//============================================================================
1515
define([
1616
'vp_base/js/com/component/LibraryComponent',
17-
'vp_base/js/com/component/DataSelector'
18-
],function(LibraryComponent,DataSelector){
17+
'vp_base/js/com/component/DataSelector',
18+
'vp_base/js/com/com_util'
19+
],function(LibraryComponent,DataSelector,com_util){
1920
/**
2021
* PandasPlot
2122
*/
@@ -26,15 +27,52 @@ define([
2627
this.state={
2728
i0:'',
2829
o0:'',
30+
figWidth:'',
31+
figHeight:'',
2932
...this.state
3033
}
3134
}
35+
36+
_bindEventAfterRender(){
37+
letthat=this;
38+
39+
$(this.wrapSelector('#figWidth')).on('blur',function(){
40+
letwidth=$(this).val();
41+
letheight=$(that.wrapSelector('#figHeight')).val();
42+
43+
if(width!==''||height!==''){
44+
$(that.wrapSelector('#figsize')).val(com_util.formatString('({0},{1})',width,height));
45+
}else{
46+
$(that.wrapSelector('#figsize')).val('');
47+
}
48+
});
49+
$(this.wrapSelector('#figHeight')).on('blur',function(){
50+
letwidth=$(that.wrapSelector('#figWidth')).val();
51+
letheight=$(this).val();
52+
53+
if(width!==''||height!==''){
54+
$(that.wrapSelector('#figsize')).val(com_util.formatString('({0},{1})',width,height));
55+
}else{
56+
$(that.wrapSelector('#figsize')).val('');
57+
}
58+
});
59+
}
60+
3261
render(){
3362
super.render();
3463

3564
// add data selector
3665
letdataSelector=newDataSelector({pageThis:this,id:'i0',value:this.state.i0,required:true});
3766
$(this.wrapSelector('#i0')).replaceWith(dataSelector.toTagString());
67+
68+
// divide figure size option to width / height
69+
letfigSizeTemplate=`
70+
<input type="number" class="vp-input m vp-state" id="figWidth" placeholder="Width" value="${this.state.figWidth}"/>
71+
<input type="number" class="vp-input m vp-state" id="figHeight" placeholder="Height" value="${this.state.figHeight}"/>`
72+
$(this.wrapSelector('#figsize')).hide();
73+
$(this.wrapSelector('#figsize')).parent().append(figSizeTemplate);
74+
75+
this._bindEventAfterRender();
3876
}
3977
}
4078

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp