未验证 提交 c7fc5c19 编写于 作者: P Peter Pan 提交者: GitHub

fix: histogram cannot be rendered properly when data only has step 0 (#807)

上级 e2e1bb28
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const {middleware} = require('@visualdl/mock'); const {middleware} = require('@visualdl/mock');
const {createProxyMiddleware} = require('http-proxy-middleware');
module.exports = { module.exports = {
middleware, middleware: process.env.MOCK
? () => createProxyMiddleware({target: process.env.MOCK, changeOrigin: true})
: middleware,
pathname: '/api' pathname: '/api'
}; };
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
"enhanced-resolve": "4.3.0", "enhanced-resolve": "4.3.0",
"express": "4.17.1", "express": "4.17.1",
"fs-extra": "9.0.1", "fs-extra": "9.0.1",
"http-proxy-middleware": "1.0.5",
"jest": "26.4.2", "jest": "26.4.2",
"snowpack": "2.10.1", "snowpack": "2.10.1",
"typescript": "4.0.2", "typescript": "4.0.2",
......
...@@ -64,7 +64,7 @@ const StackChart = React.forwardRef<StackChartRef, StackChartProps & WithStyled> ...@@ -64,7 +64,7 @@ const StackChart = React.forwardRef<StackChartRef, StackChartProps & WithStyled>
}; };
const rawData = useMemo(() => seriesData.data ?? [], [seriesData.data]); const rawData = useMemo(() => seriesData.data ?? [], [seriesData.data]);
const negativeY = useMemo(() => minY - (maxY - minY) * 0.4, [minY, maxY]); const negativeY = useMemo(() => (minY === 0 && maxY === 0 ? -0.4 : minY - (maxY - minY) * 0.4), [minY, maxY]);
const getPoint = useCallback( const getPoint = useCallback(
(x: number, y: number, z: number, getCoord: GetCoord) => { (x: number, y: number, z: number, getCoord: GetCoord) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册