@@ -25,23 +25,6 @@ define([
25
25
'vp_base/data/m_visualize/plotlyLibrary' ,
26
26
] , function ( ptHTML , ptCss , com_String , com_generator , com_util , PopupComponent , SuggestInput , FileNavigation , DataSelector , PLOTLY_LIBRARIES ) {
27
27
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
- */
45
28
class Plotly extends PopupComponent {
46
29
_init ( ) {
47
30
super . _init ( ) ;
@@ -391,7 +374,7 @@ define([
391
374
key : userCodeKey ,
392
375
selector : userCodeTarget ,
393
376
events : [ {
394
- key : 'change ' ,
377
+ key : 'blur ' ,
395
378
callback : function ( instance , evt ) {
396
379
// save its state
397
380
instance . save ( ) ;
@@ -499,12 +482,12 @@ define([
499
482
500
483
let generatedCode = com_generator . vp_codeGenerator ( this , config , this . state
501
484
, etcOptionCode . length > 0 ? ', ' + etcOptionCode . join ( ', ' ) : '' ) ;
502
- code . append ( generatedCode ) ;
485
+ code . appendFormatLine ( "fig = {0}" , generatedCode ) ;
503
486
504
487
if ( userCode && userCode != '' ) {
505
- code . appendLine ( ) ;
506
- code . append ( userCode ) ;
488
+ code . appendLine ( userCode ) ;
507
489
}
490
+ code . append ( 'fig.show()' ) ;
508
491
509
492
return code . toString ( ) ;
510
493
}
0 commit comments