backtest-report: use segment control

This commit is contained in:
c9s 2022-06-27 00:10:58 +08:00
parent 1557423229
commit a9ab77f6d3
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1,6 +1,8 @@
import React, {useEffect, useRef, useState} from 'react';
import {tsvParse} from "d3-dsv";
import {Button} from '@mantine/core';
import { SegmentedControl } from '@mantine/core';
// https://github.com/tradingview/lightweight-charts/issues/543
// const createChart = dynamic(() => import('lightweight-charts'));
@ -483,17 +485,16 @@ const TradingViewChart = (props: TradingViewChartProps) => {
return () => resizeObserver.current.disconnect();
}, []);
return (
<div>
<span>
{intervals.map((interval) => {
return <Button key={interval} compact onClick={() => {
setCurrentInterval(interval)
}}>
{interval}
</Button>
})}
</span>
<div>
<SegmentedControl
data={intervals.map((interval) => { return { label: interval, value: interval } })}
onChange={setCurrentInterval}
/>
</div>
<div ref={chartContainerRef} style={{'flex': 1, 'minHeight': 300}}>
</div>
</div>