All files / src/form/fields LineChart.tsx

44.44% Statements 4/9
12.5% Branches 1/8
0% Functions 0/2
50% Lines 4/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40        66x   66x     66x               66x                                            
import React, { ReactElement, Suspense } from "react";
import { emptyMethod } from "@utils/Constants";
import { TableMetaProps } from "@props/RecordProps";
 
const Line = React.lazy(() => import('../../components/wrap/LineWrap'));
 
Eif (typeof window.URL.createObjectURL == 'undefined') {
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  window.URL.createObjectURL = emptyMethod;
}
 
interface LineChartProps {
  value: string;
  column: TableMetaProps;
}
 
const LineChart = (props: LineChartProps): ReactElement => {
  const { value, column } = props;
  const { chartInfo } = column.extInfo || {};
  const data = JSON.parse(value);
 
  return (
    <Suspense fallback={<div/>}>
      <Line
        data={data}
        height={400}
        xField={chartInfo?.xField || 'x'}
        yField={chartInfo?.yField || 'y'}
        axis={chartInfo?.axis}
        seriesField={chartInfo?.seriesField}
        point={chartInfo?.point}
        color={chartInfo?.color}
      />
    </Suspense>
  );
};
 
export default LineChart;