Skip to content

Commit

Permalink
fix: histogram cannot be rendered properly when data only has step 0 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPanZH authored Sep 10, 2020
1 parent e2e1bb2 commit c7fc5c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/packages/core/builder/mock.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable @typescript-eslint/no-var-requires */

const {middleware} = require('@visualdl/mock');
const {createProxyMiddleware} = require('http-proxy-middleware');

module.exports = {
middleware,
middleware: process.env.MOCK
? () => createProxyMiddleware({target: process.env.MOCK, changeOrigin: true})
: middleware,
pathname: '/api'
};
1 change: 1 addition & 0 deletions frontend/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"enhanced-resolve": "4.3.0",
"express": "4.17.1",
"fs-extra": "9.0.1",
"http-proxy-middleware": "1.0.5",
"jest": "26.4.2",
"snowpack": "2.10.1",
"typescript": "4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/components/StackChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const StackChart = React.forwardRef<StackChartRef, StackChartProps & WithStyled>
};
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(
(x: number, y: number, z: number, getCoord: GetCoord) => {
Expand Down

0 comments on commit c7fc5c1

Please sign in to comment.