@@ -42,7 +42,18 @@ define([
4242super . _bindEvent ( ) ;
4343
4444let that = this ;
45-
45+ // setting popup - set default
46+ $ ( this . wrapSelector ( '#setDefault' ) ) . on ( 'change' , function ( ) {
47+ let checked = $ ( this ) . prop ( 'checked' ) ;
48+
49+ if ( checked ) {
50+ // disable input
51+ $ ( that . wrapSelector ( '.vp-chart-setting-body input' ) ) . prop ( 'disabled' , true ) ;
52+ } else {
53+ // enable input
54+ $ ( that . wrapSelector ( '.vp-chart-setting-body input' ) ) . prop ( 'disabled' , false ) ;
55+ }
56+ } ) ;
4657}
4758
4859templateForBody ( ) {
@@ -113,31 +124,40 @@ define([
113124generateImportCode ( ) {
114125var code = new com_String ( ) ;
115126code . appendLine ( 'import matplotlib.pyplot as plt' ) ;
116- code . append ( 'import seaborn as sns' ) ;
127+ code . appendLine ( 'import seaborn as sns' ) ;
128+ code . append ( '%matplotlib inline' ) ;
117129return [ code . toString ( ) ] ;
118130}
119131
120132generateCode ( ) {
121133var code = new com_String ( ) ;
122134
123135// get parameters
124- let { figureWidth, figureHeight, styleSheet, fontName, fontSize} = this . state ;
125-
126- code . appendLine ( 'import matplotlib.pyplot as plt' ) ;
127- code . appendFormatLine ( "plt.rc('figure', figsize=({0}, {1}))" , figureWidth , figureHeight ) ;
128- if ( styleSheet && styleSheet . length > 0 ) {
129- code . appendFormatLine ( "plt.style.use('{0}')" , styleSheet ) ;
130- }
131- code . appendLine ( ) ;
132-
133- code . appendLine ( 'from matplotlib import rcParams' ) ;
134- if ( fontName && fontName . length > 0 ) {
135- code . appendFormatLine ( "rcParams['font.family'] = '{0}'" , fontName ) ;
136- }
137- if ( fontSize && fontSize . length > 0 ) {
138- code . appendFormatLine ( "rcParams['font.size'] = {0}" , fontSize ) ;
136+ let setDefault = $ ( this . wrapSelector ( '#setDefault' ) ) . prop ( 'checked' ) ;
137+ if ( setDefault == true ) {
138+ code . appendLine ( 'from matplotlib import rcParams, rcParamsDefault' ) ;
139+ code . append ( 'rcParams.update(rcParamsDefault)' ) ;
140+ } else {
141+ // get parameters
142+ let { figureWidth, figureHeight, styleSheet, fontName, fontSize} = this . state ;
143+
144+ code . appendLine ( 'import matplotlib.pyplot as plt' ) ;
145+ code . appendLine ( 'import seaborn as sns' ) ;
146+ code . appendFormatLine ( "plt.rc('figure', figsize=({0}, {1}))" , figureWidth , figureHeight ) ;
147+ if ( styleSheet && styleSheet . length > 0 ) {
148+ code . appendFormatLine ( "plt.style.use('{0}')" , styleSheet ) ;
149+ }
150+ code . appendLine ( ) ;
151+
152+ code . appendLine ( 'from matplotlib import rcParams' ) ;
153+ if ( fontName && fontName . length > 0 ) {
154+ code . appendFormatLine ( "rcParams['font.family'] = '{0}'" , fontName ) ;
155+ }
156+ if ( fontSize && fontSize . length > 0 ) {
157+ code . appendFormatLine ( "rcParams['font.size'] = {0}" , fontSize ) ;
158+ }
159+ code . append ( "rcParams['axes.unicode_minus'] = False" ) ;
139160}
140- code . append ( "rcParams['axes.unicode_minus'] = False" ) ;
141161
142162return code . toString ( ) ;
143163}