import * as React from 'react'; import { IChartProps, ILineChartPoints, ILineChartProps, LineChart, ChartHoverCard, ICustomizedCalloutData, } from '@fluentui/react-charting'; import { DefaultPalette } from '@fluentui/react/lib/Styling'; interface IStyledLineChartExampleState { width: number; height: number; } export class LineChartStyledExample extends React.Component<{}, IStyledLineChartExampleState> { constructor(props: ILineChartProps) { super(props); this.state = { width: 700, height: 300, }; } public render(): JSX.Element { return
{this._styledExample()}
; } private _onWidthChange = (e: React.ChangeEvent) => { this.setState({ width: parseInt(e.target.value, 10) }); }; private _onHeightChange = (e: React.ChangeEvent) => { this.setState({ height: parseInt(e.target.value, 10) }); }; private _styledExample(): JSX.Element { const points: ILineChartPoints[] = [ { data: [ { x: new Date('2018/01/06'), y: 10 }, { x: new Date('2018/01/16'), y: 18 }, { x: new Date('2018/01/20'), y: 24 }, { x: new Date('2018/01/24'), y: 35 }, { x: new Date('2018/01/26'), y: 35 }, { x: new Date('2018/01/29'), y: 90 }, ], legend: 'Week', color: DefaultPalette.blue, }, ]; const data: IChartProps = { chartTitle: 'Line Chart', lineChartData: points, }; const rootStyle = { width: `${this.state.width}px`, height: `${this.state.height}px`, }; return ( <>
props ? ( ) : null } />
); } }