diff --git a/packages/grafana-ui/.storybook/webpack.config.js b/packages/grafana-ui/.storybook/webpack.config.js index bfdf4d0f3cc..792759122a4 100644 --- a/packages/grafana-ui/.storybook/webpack.config.js +++ b/packages/grafana-ui/.storybook/webpack.config.js @@ -103,7 +103,7 @@ module.exports = ({ config, mode }) => { minimize: isProductionBuild, minimizer: isProductionBuild ? [ - new TerserPlugin({ cache: false, parallel: false, sourceMap: false, exclude: /monaco/ }), + new TerserPlugin({ cache: false, parallel: false, sourceMap: false, exclude: /monaco|bizcharts/ }), new OptimizeCSSAssetsPlugin({}), ] : [], diff --git a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx index a5df4c15cd2..95eea803376 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValueLayout.tsx @@ -1,6 +1,7 @@ // Libraries -import React, { CSSProperties, Suspense } from 'react'; +import React, { CSSProperties } from 'react'; import tinycolor from 'tinycolor2'; +import { Chart, Geom } from 'bizcharts'; // Utils import { formattedValueToString, DisplayValue, getColorForTheme } from '@grafana/data'; @@ -13,16 +14,6 @@ import { getTextColorForBackground } from '../../utils'; const LINE_HEIGHT = 1.2; const MAX_TITLE_SIZE = 30; -const Chart = React.lazy(async () => { - const { Chart } = await import(/* webpackChunkName: "bizcharts" */ 'bizcharts'); - return { default: Chart }; -}); - -const Geom = React.lazy(async () => { - const { Geom } = await import(/* webpackChunkName: "bizcharts" */ 'bizcharts'); - return { default: Geom }; -}); - export abstract class BigValueLayout { titleFontSize: number; valueFontSize: number; @@ -72,6 +63,8 @@ export abstract class BigValueLayout { fontSize: this.valueFontSize, fontWeight: 500, lineHeight: LINE_HEIGHT, + position: 'relative', + zIndex: 1, }; switch (this.props.colorMode) { @@ -175,19 +168,17 @@ export abstract class BigValueLayout { } return ( - Loading chart...}> - - {this.renderGeom()} - - + + {this.renderGeom()} + ); } @@ -220,10 +211,10 @@ export abstract class BigValueLayout { lineStyle.stroke = lineColor; return ( - Loading chart...}> + <> - + ); } diff --git a/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap b/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap index cfaf1b3416b..3f57fd43340 100644 --- a/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap +++ b/packages/grafana-ui/src/components/BigValue/__snapshots__/BigValue.test.tsx.snap @@ -30,10 +30,12 @@ exports[`BigValue Render with basic options should render 1`] = ` 150 ? lightTheme.colors.textStrong : darkTheme.colors.textStrong; + return b > 180 ? lightTheme.colors.textStrong : darkTheme.colors.textStrong; } export let sortedColors = sortColorsByHue(colors);