@@ -37,8 +37,14 @@ define([
37
37
this . state = {
38
38
chartType : 'scatter' ,
39
39
data : '' ,
40
+ x : '' , y : '' , z : '' ,
41
+ x_start : '' , x_end : '' ,
42
+ values : '' , names : '' , parents : '' ,
43
+ color : '' ,
40
44
userOption : '' ,
41
45
title : '' ,
46
+ x_label : '' ,
47
+ y_label : '' ,
42
48
userCode : '' ,
43
49
autoRefresh : true ,
44
50
...this . state
@@ -453,9 +459,9 @@ define([
453
459
*/
454
460
let {
455
461
chartType,
456
- data, x, y, setXY,
462
+ data, x, y, color , setXY,
457
463
userOption, userCode,
458
- title
464
+ title, x_label , y_label
459
465
} = this . state ;
460
466
let code = new com_String ( ) ;
461
467
let config = this . chartConfig [ chartType ] ;
@@ -465,6 +471,42 @@ define([
465
471
if ( title != '' ) {
466
472
etcOptionCode . push ( com_util . formatString ( "title='{0}'" , title ) ) ;
467
473
}
474
+ let labelOptions = [ ] ;
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
+ }
468
510
// add user option
469
511
if ( userOption != '' ) {
470
512
etcOptionCode . push ( userOption ) ;
0 commit comments