@@ -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 }
0 commit comments