ChartInstance.tsx 657 Bytes
Newer Older
崔佳豪's avatar
崔佳豪 committed
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
import React from 'react';
import { useEffect } from 'react';
import { useRef } from 'react';
import { BasicChart } from '../index';

const Demo = () => {
  const ref = useRef();
  const option = {
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    },
    yAxis: {
      type: 'value',
    },
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        type: 'line',
      },
    ],
  };

  useEffect(() => {
    console.log(ref.current);
  }, []);

28 29 30 31 32
  return (
    <div style={{ height: 300 }}>
      <BasicChart ref={ref} option={option} />
    </div>
  );
崔佳豪's avatar
崔佳豪 committed
33 34 35
};

export default Demo;