1
1
function Condition ( chart , options ) {
2
2
options = options || { } ;
3
3
Symbol . call ( this , chart , options ) ;
4
-
4
+ this . textMargin = this . getAttr ( 'text-margin' ) ;
5
5
this . yes_direction = 'bottom' ;
6
6
this . no_direction = 'right' ;
7
7
if ( options . yes && options [ 'direction_yes' ] && options . no && ! options [ 'direction_no' ] ) {
@@ -29,19 +29,19 @@ function Condition(chart, options) {
29
29
this . no_direction = this . no_direction || 'right' ;
30
30
31
31
this . text . attr ( {
32
- x : ( this . chart . options . symbols [ this . symbolType ] [ 'text-margin' ] || this . chart . options [ 'text-margin' ] ) * 2
32
+ x : this . textMargin * 2
33
33
} ) ;
34
34
35
- var width = this . text . getBBox ( ) . width + 3 * ( this . chart . options . symbols [ this . symbolType ] [ 'text-margin' ] || this . chart . options [ 'text-margin' ] ) ;
35
+ var width = this . text . getBBox ( ) . width + 3 * this . textMargin ;
36
36
width += width / 2 ;
37
- var height = this . text . getBBox ( ) . height + 2 * ( this . chart . options . symbols [ this . symbolType ] [ 'text-margin' ] || this . chart . options [ 'text-margin' ] ) ;
37
+ var height = this . text . getBBox ( ) . height + 2 * this . textMargin ;
38
38
height += height / 2 ;
39
39
height = Math . max ( width * 0.5 , height ) ;
40
40
var startX = width / 4 ;
41
41
var startY = height / 4 ;
42
42
43
43
this . text . attr ( {
44
- x : startX + ( this . chart . options . symbols [ this . symbolType ] [ 'text-margin' ] || this . chart . options [ 'text-margin' ] ) / 2
44
+ x : startX + this . textMargin / 2
45
45
} ) ;
46
46
47
47
var start = { x : startX , y : startY } ;
@@ -56,9 +56,9 @@ function Condition(chart, options) {
56
56
var symbol = drawPath ( chart , start , points ) ;
57
57
58
58
symbol . attr ( {
59
- stroke : ( this . chart . options . symbols [ this . symbolType ] [ 'element-color' ] || this . chart . options [ 'element-color' ] ) ,
60
- 'stroke-width' : ( this . chart . options . symbols [ this . symbolType ] [ 'line-width' ] || this . chart . options [ 'line-width' ] ) ,
61
- fill : ( this . chart . options . symbols [ this . symbolType ] [ 'fill' ] || this . chart . options [ 'fill' ] )
59
+ stroke : this . getAttr ( 'element-color' ) ,
60
+ 'stroke-width' : this . getAttr ( 'line-width' ) ,
61
+ fill : this . getAttr ( 'fill' )
62
62
} ) ;
63
63
if ( options . link ) { symbol . attr ( 'href' , options . link ) ; }
64
64
if ( options . target ) { symbol . attr ( 'target' , options . target ) ; }
@@ -85,7 +85,7 @@ Condition.prototype.render = function() {
85
85
this [ this . no_direction + '_symbol' ] = this . no_symbol ;
86
86
}
87
87
88
- var lineLength = this . chart . options . symbols [ this . symbolType ] [ 'line-length' ] || this . chart . options [ 'line-length' ] ;
88
+ var lineLength = this . getAttr ( 'line-length' ) ;
89
89
90
90
if ( this . bottom_symbol ) {
91
91
var bottomPoint = this . getBottom ( ) ;
@@ -138,10 +138,10 @@ Condition.prototype.render = function() {
138
138
139
139
Condition . prototype . renderLines = function ( ) {
140
140
if ( this . yes_symbol ) {
141
- this . drawLineTo ( this . yes_symbol , this . chart . options [ 'yes-text' ] , this . yes_direction ) ;
141
+ this . drawLineTo ( this . yes_symbol , this . getAttr ( 'yes-text' ) , this . yes_direction ) ;
142
142
}
143
143
144
144
if ( this . no_symbol ) {
145
- this . drawLineTo ( this . no_symbol , this . chart . options [ 'no-text' ] , this . no_direction ) ;
145
+ this . drawLineTo ( this . no_symbol , this . getAttr ( 'no-text' ) , this . no_direction ) ;
146
146
}
147
- } ;
147
+ } ;
0 commit comments