Skip to content

Commit e4ff2e5

Browse files
author
minjk-bl
committed
Fix to refresh preview for bluring textarea on Seaborn, Plotly app
1 parent f85d2e0 commit e4ff2e5

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

js/m_visualize/Plotly.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ define([
2525
'vp_base/data/m_visualize/plotlyLibrary',
2626
], function(ptHTML, ptCss, com_String, com_generator, com_util, PopupComponent, SuggestInput, FileNavigation, DataSelector, PLOTLY_LIBRARIES) {
2727

28-
/**
29-
* TODO: libraries.json add menu
30-
* {
31-
"id" : "visualize_plotly",
32-
"type" : "function",
33-
"level": 1,
34-
"name" : "Plotly",
35-
"tag" : "PLOTLY,VISUALIZATION,VISUALIZE",
36-
"path" : "visualpython - visualization - plotly",
37-
"desc" : "Plotly express",
38-
"file" : "m_visualize/Plotly",
39-
"apps" : {
40-
"color": 5,
41-
"icon": "apps/apps_visualize.svg"
42-
}
43-
},
44-
*/
4528
class Plotly extends PopupComponent {
4629
_init() {
4730
super._init();
@@ -391,7 +374,7 @@ define([
391374
key: userCodeKey,
392375
selector: userCodeTarget,
393376
events: [{
394-
key: 'change',
377+
key: 'blur',
395378
callback: function(instance, evt) {
396379
// save its state
397380
instance.save();
@@ -499,12 +482,12 @@ define([
499482

500483
let generatedCode = com_generator.vp_codeGenerator(this, config, this.state
501484
, etcOptionCode.length > 0? ', ' + etcOptionCode.join(', '): '');
502-
code.append(generatedCode);
485+
code.appendFormatLine("fig = {0}", generatedCode);
503486

504487
if (userCode && userCode != '') {
505-
code.appendLine();
506-
code.append(userCode);
488+
code.appendLine(userCode);
507489
}
490+
code.append('fig.show()');
508491

509492
return code.toString();
510493
}

js/m_visualize/Seaborn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ define([
526526
key: userCodeKey,
527527
selector: userCodeTarget,
528528
events: [{
529-
key: 'change',
529+
key: 'blur',
530530
callback: function(instance, evt) {
531531
// save its state
532532
instance.save();

0 commit comments

Comments
 (0)