diff --git a/packages/f2/src/components/axis/rect/bottom.tsx b/packages/f2/src/components/axis/rect/bottom.tsx index 779a2bc45..4223b4656 100644 --- a/packages/f2/src/components/axis/rect/bottom.tsx +++ b/packages/f2/src/components/axis/rect/bottom.tsx @@ -9,6 +9,7 @@ export default (props: RectProps<'bottom'>, context) => { const { grid, tickLine, line, labelOffset, label, symbol } = style; const filterTicks = ticks.filter((d) => !isNaN(d.value)); const symbols = isArray(symbol) ? symbol : [symbol]; + const { length: tickLineLength, ...tickLineStyle } = tickLine || {}; return ( @@ -19,8 +20,8 @@ export default (props: RectProps<'bottom'>, context) => { const end = points[points.length - 1]; return ( , context) => { ); }) : null} - {tickLine && tickLine.length + {tickLineLength ? filterTicks.map((tick) => { const { points, tickValue } = tick; const start = points[0]; return ( ); @@ -64,7 +65,7 @@ export default (props: RectProps<'bottom'>, context) => { ) : null} {line ? ( , context) => { return ( { +export default (props: RectProps, context) => { const { ticks: originTicks, coord, style, animation } = props; + const { px2hd } = context; const { left, top, bottom } = coord; const { grid, tickLine, line, labelOffset, label, symbol } = style; const ticks = originTicks.filter((d) => !isNaN(d.value)); const symbols = isArray(symbol) ? symbol : [symbol]; + const { length: tickLineLength, ...tickLineStyle } = tickLine || {}; return ( @@ -18,8 +20,8 @@ export default (props: RectProps) => { const end = points[points.length - 1]; return ( { ); }) : null} - {tickLine && tickLine.length + {tickLineLength ? ticks.map((tick) => { const { points, tickValue } = tick; const start = points[0]; return ( ); @@ -88,8 +90,8 @@ export default (props: RectProps) => { const start = points[0]; return ( { +export default (props: RectProps, context) => { const { ticks: originTicks, coord, style } = props; + const { px2hd } = context; const { top, right, bottom } = coord; const { grid, tickLine, line, labelOffset, label, symbol } = style; const ticks = originTicks.filter((d) => !isNaN(d.value)); const symbols = isArray(symbol) ? symbol : [symbol]; + const { length: tickLineLength, ...tickLineStyle } = tickLine || {}; return ( {grid ? ticks.map((tick) => { - const { points, gridStyle } = tick; + const { points, tickValue, gridStyle } = tick; const start = points[0]; const end = points[points.length - 1]; return ( { ); }) : null} - {tickLine && tickLine.length + {tickLineLength ? ticks.map((tick) => { - const { points } = tick; + const { points, tickValue } = tick; const end = points[points.length - 1]; return ( ); @@ -59,7 +63,7 @@ export default (props: RectProps) => { ) : null} {line ? ( { ) : null} {label ? ticks.map((tick, _index) => { - const { points, text, labelStyle } = tick; + const { tickValue, points, text, labelStyle } = tick; const end = points[points.length - 1]; return ( { +export default (props: RectProps, context) => { const { ticks: originTicks, coord, style } = props; + const { px2hd } = context; const { left, top, right } = coord; const { grid, tickLine, line, labelOffset, label, symbol } = style; const ticks = originTicks.filter((d) => !isNaN(d.value)); const symbols = isArray(symbol) ? symbol : [symbol]; + const { length: tickLineLength, ...tickLineStyle } = tickLine || {}; return ( {grid ? ticks.map((tick) => { - const { points, gridStyle } = tick; + const { points, tickValue, gridStyle } = tick; const start = points[0]; const end = points[points.length - 1]; return ( { : null} {tickLine && tickLine.length ? ticks.map((tick) => { - const { points } = tick; + const { points, tickValue } = tick; const end = points[points.length - 1]; return ( ); @@ -61,7 +65,7 @@ export default (props: RectProps) => { ) : null} {line ? ( { ) : null} {label ? ticks.map((tick, _index) => { - const { points, text, labelStyle } = tick; + const { tickValue, points, text, labelStyle } = tick; const end = points[points.length - 1]; return ( { const { props } = ( - + @@ -279,9 +290,20 @@ describe('candlestick', () => { expect(context).toMatchImageSnapshot(); const { props: nextProps } = ( - + - +