import * as React from 'react' import { ResponsiveLine, LineComputedSerieData } from '@nivo/line' import { LegendMouseHandlerData } from '@nivo/legends' const colorBy = (data: LineComputedSerieData) => data.color as string export default class Line extends React.Component { public render() { return (
`${v}`, }} enableGridX={true} enableGridY={true} enableDots={true} dotSize={12} enableDotLabel={true} enableArea={true} areaBaselineValue={4} areaOpacity={0.15} markers={[ { axis: 'x', value: 4, legend: 'X marker a 4', lineStyle: { stroke: 'blue', }, textStyle: { fill: 'blue', }, }, { axis: 'y', value: 4, legend: 'Y marker at 4', lineStyle: { stroke: 'red', }, textStyle: { fill: 'red', }, }, ]} isInteractive={true} enableStackTooltip={true} legends={[ { anchor: 'top-left', translateX: 20, translateY: 10, direction: 'column', itemWidth: 100, itemHeight: 26, itemOpacity: 0.8, symbolShape: 'circle', onClick: (data: LegendMouseHandlerData, event: React.MouseEvent) => { console.log(data, event.clientX, event.clientY) }, effects: [ { on: 'hover', style: { itemBackground: '#eeeeee', itemOpacity: 1, }, }, ], }, ]} animate={true} motionStiffness={150} motionDamping={15} />
) } }