@@ -56,7 +56,10 @@ function createSymbol(name, lineData, idx) {
5656 symbolSize [ 0 ] , symbolSize [ 1 ] , color
5757 ) ;
5858
59- symbolPath . rotation = ( symbolRotate || 0 ) * Math . PI / 180 || 0 ;
59+ // rotate by default if symbolRotate is not specified or NaN
60+ symbolPath . rotation = symbolRotate == null || isNaN ( symbolRotate )
61+ ? undefined
62+ : + symbolRotate * Math . PI / 180 || 0 ;
6063 symbolPath . name = name ;
6164
6265 return symbolPath ;
@@ -125,9 +128,11 @@ function updateSymbolAndLabelBeforeLineUpdate() {
125128 if ( symbolFrom ) {
126129 symbolFrom . attr ( 'position' , fromPos ) ;
127130 // Fix #12388
128- // when symbol is set to be 'arrow' in markLine,
129- // symbolRotate value will be ignored, and compulsively use tangent angle.
130- if ( symbolFrom . shape && symbolFrom . shape . symbolType === 'arrow' ) {
131+ // when symbol is set to be 'arrow' in markLine,
132+ // symbolRotate value will be ignored, and compulsively use tangent angle.
133+ // rotate by default if symbol rotation is not specified
134+ if ( symbolFrom . rotation == null
135+ || ( symbolFrom . shape && symbolFrom . shape . symbolType === 'arrow' ) ) {
131136 var tangent = line . tangentAt ( 0 ) ;
132137 symbolFrom . attr ( 'rotation' , Math . PI / 2 - Math . atan2 (
133138 tangent [ 1 ] , tangent [ 0 ]
@@ -140,7 +145,9 @@ function updateSymbolAndLabelBeforeLineUpdate() {
140145 // Fix #12388
141146 // when symbol is set to be 'arrow' in markLine,
142147 // symbolRotate value will be ignored, and compulsively use tangent angle.
143- if ( symbolTo . shape && symbolTo . shape . symbolType === 'arrow' ) {
148+ // rotate by default if symbol rotation is not specified
149+ if ( symbolTo . rotation == null
150+ || ( symbolTo . shape && symbolTo . shape . symbolType === 'arrow' ) ) {
144151 var tangent = line . tangentAt ( 1 ) ;
145152 symbolTo . attr ( 'rotation' , - Math . PI / 2 - Math . atan2 (
146153 tangent [ 1 ] , tangent [ 0 ]
0 commit comments