2020import * as zrUtil from 'zrender/src/core/util' ;
2121import ChartView from '../../view/Chart' ;
2222import * as graphic from '../../util/graphic' ;
23- import { setStatesStylesFromModel } from '../../util/states' ;
23+ import { setStatesStylesFromModel , toggleHoverEmphasis } from '../../util/states' ;
2424import Path , { PathProps } from 'zrender/src/graphic/Path' ;
2525import { createClipPath } from '../helper/createClipPathFromCoordSys' ;
2626import CandlestickSeriesModel , { CandlestickDataItemOption } from './CandlestickSeries' ;
@@ -33,6 +33,7 @@ import { CoordinateSystemClipArea } from '../../coord/CoordinateSystem';
3333import Model from '../../model/Model' ;
3434import { saveOldStyle } from '../../animation/basicTransition' ;
3535import Element from 'zrender/src/Element' ;
36+ import { getBorderColor , getColor } from './candlestickVisual' ;
3637
3738const SKIP_PROPS = [ 'color' , 'borderColor' ] as const ;
3839
@@ -294,6 +295,19 @@ function setBoxCommon(el: NormalBoxPath, data: SeriesData, dataIndex: number, is
294295 el . __simpleBox = isSimpleBox ;
295296
296297 setStatesStylesFromModel ( el , itemModel ) ;
298+
299+ const sign = data . getItemLayout ( dataIndex ) . sign ;
300+ zrUtil . each ( el . states , ( state , stateName ) => {
301+ const stateModel = itemModel . getModel ( stateName as any ) ;
302+ const color = getColor ( sign , stateModel ) ;
303+ const borderColor = getBorderColor ( sign , stateModel ) || color ;
304+ const stateStyle = state . style || ( state . style = { } ) ;
305+ color && ( stateStyle . fill = color ) ;
306+ borderColor && ( stateStyle . stroke = borderColor ) ;
307+ } ) ;
308+
309+ const emphasisModel = itemModel . getModel ( 'emphasis' ) ;
310+ toggleHoverEmphasis ( el , emphasisModel . get ( 'focus' ) , emphasisModel . get ( 'blurScope' ) , emphasisModel . get ( 'disabled' ) ) ;
297311}
298312
299313function transInit ( points : number [ ] [ ] , itemLayout : CandlestickItemLayout ) {
@@ -391,12 +405,9 @@ function createLarge(
391405
392406function setLargeStyle ( sign : number , el : LargeBoxPath , seriesModel : CandlestickSeriesModel , data : SeriesData ) {
393407 // TODO put in visual?
394- let borderColor = seriesModel . get ( [ 'itemStyle' , sign > 0 ? 'borderColor' : 'borderColor0' ] )
408+ const borderColor = getBorderColor ( sign , seriesModel )
395409 // Use color for border color by default.
396- || seriesModel . get ( [ 'itemStyle' , sign > 0 ? 'color' : 'color0' ] ) ;
397- if ( sign === 0 ) {
398- borderColor = seriesModel . get ( [ 'itemStyle' , 'borderColorDoji' ] ) ;
399- }
410+ || getColor ( sign , seriesModel ) ;
400411
401412 // Color must be excluded.
402413 // Because symbol provide setColor individually to set fill and stroke
0 commit comments