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

Commitc0e4486

Browse files
author
minjk-bl
committed
Add x_label, y_label option on Plotly app
1 parente4ff2e5 commitc0e4486

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed

‎html/m_visualize/plotly.html‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
<labelclass="vp-bold">Parents</label>
7171
<selectid="parents"class="vp-select vp-state">
7272

73+
</select>
74+
</div>
75+
<divclass="vp-grid-box pt-option">
76+
<labelclass="vp-bold">Color</label>
77+
<selectid="color"class="vp-select vp-state">
78+
7379
</select>
7480
</div>
7581
</div>
@@ -79,7 +85,16 @@
7985
<divclass="vp-tab-page vp-grid-box"data-type="info"style="display: none;">
8086
<labelfor="title"class="vp-bold">Title</label>
8187
<inputtype="text"id="title"class="vp-input vp-state wp100"placeholder="Title for the chart"/>
82-
88+
<divclass="vp-grid-col-p50">
89+
<divclass="vp-grid-box">
90+
<labelfor="x_label"class="vp-bold">X Label</label>
91+
<inputtype="text"id="x_label"class="vp-input vp-state"placeholder="Type X Label"/>
92+
</div>
93+
<divclass="vp-grid-box">
94+
<labelfor="y_label"class="vp-bold">Y Label</label>
95+
<inputtype="text"id="y_label"class="vp-input vp-state"placeholder="Type Y Label"/>
96+
</div>
97+
</div>
8398

8499
</div>
85100
<divclass="vp-tab-page vp-grid-box"data-type="style"style="display: none;">

‎js/m_visualize/Plotly.js‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ define([
3737
this.state={
3838
chartType:'scatter',
3939
data:'',
40+
x:'',y:'',z:'',
41+
x_start:'',x_end:'',
42+
values:'',names:'',parents:'',
43+
color:'',
4044
userOption:'',
4145
title:'',
46+
x_label:'',
47+
y_label:'',
4248
userCode:'',
4349
autoRefresh:true,
4450
...this.state
@@ -453,9 +459,9 @@ define([
453459
*/
454460
let{
455461
chartType,
456-
data, x, y, setXY,
462+
data, x, y,color,setXY,
457463
userOption, userCode,
458-
title
464+
title, x_label, y_label
459465
}=this.state;
460466
letcode=newcom_String();
461467
letconfig=this.chartConfig[chartType];
@@ -465,6 +471,42 @@ define([
465471
if(title!=''){
466472
etcOptionCode.push(com_util.formatString("title='{0}'",title));
467473
}
474+
letlabelOptions=[];
475+
// add x_label
476+
if(x_label!=''){
477+
if(setXY===true){
478+
// replace 'x' to x_label
479+
labelOptions.push(com_util.formatString("'x': '{0}'",x_label));
480+
}else{
481+
// if x is selected
482+
if(x!=''){
483+
// replace x column name to x_label
484+
labelOptions.push(com_util.formatString("{0}: '{1}'",x,x_label));
485+
}else{
486+
// replace 'index' to x_label
487+
labelOptions.push(com_util.formatString("'index': '{0}'",x_label));
488+
}
489+
}
490+
}
491+
// add y_label
492+
if(y_label!=''){
493+
if(setXY===true){
494+
// replace 'y' to y_label
495+
labelOptions.push(com_util.formatString("'y': '{0}'",y_label));
496+
}else{
497+
// if y is selected
498+
if(y!=''){
499+
// replace y column name to y_label
500+
labelOptions.push(com_util.formatString("{0}: '{1}'",y,y_label));
501+
}else{
502+
// replace 'index' to y_label
503+
labelOptions.push(com_util.formatString("'index': '{0}'",y_label));
504+
}
505+
}
506+
}
507+
if(labelOptions.length>0){
508+
etcOptionCode.push(com_util.formatString("labels={ {0} }",labelOptions.join(', ')));
509+
}
468510
// add user option
469511
if(userOption!=''){
470512
etcOptionCode.push(userOption);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp