React UI Components Documentation
The React Chart draws more than 30 chart types, among them line, area, bar, pie, donut, range, financial, polar and spider charts, as SVG or HTML5 Canvas. This guide adds the React Chart (jqxChart) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-react-tsx/jqxchart 
In a React project (to start one, see Getting started with React), add the package:
npm install jqwidgets-scripts
import JqxChart, { type IChartProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxchart';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
jqx.base.css is required. The second file is a theme; pick one of the jqx.*.css files (material, fluent, light, dark and more) and pass its name to the theme prop.
The source of the live Column Series with Local Data demo:
import type { JSX } from 'react';
import { useMemo } from 'react';
import JqxChart, { type IChartProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxchart';
interface SampleData {
Day: string;
Keith: number;
Erica: number;
George: number;
}
const sampleData: SampleData[] = [
{ Day: 'Monday', Keith: 30, Erica: 15, George: 25 },
{ Day: 'Tuesday', Keith: 25, Erica: 25, George: 30 },
{ Day: 'Wednesday', Keith: 30, Erica: 20, George: 25 },
{ Day: 'Thursday', Keith: 35, Erica: 25, George: 45 },
{ Day: 'Friday', Keith: 20, Erica: 20, George: 25 },
{ Day: 'Saturday', Keith: 30, Erica: 20, George: 30 },
{ Day: 'Sunday', Keith: 60, Erica: 45, George: 90 }
];
const description = 'Time spent in vigorous exercise';
const padding = { left: 5, top: 5, right: 5, bottom: 5 };
const title = 'Fitness & exercise weekly scorecard';
const titlePadding = { left: 90, top: 0, right: 0, bottom: 10 };
const xAxis: IChartProps['xAxis'] = { dataField: 'Day', gridLines: { visible: false } };
const seriesGroups: IChartProps['seriesGroups'] = [
{
columnsGapPercent: 50,
series: [
{ dataField: 'Keith', displayText: 'Keith' },
{ dataField: 'Erica', displayText: 'Erica' },
{ dataField: 'George', displayText: 'George' }
],
seriesGapPercent: 0,
type: 'column',
valueAxis: {
axisSize: 'auto',
maxValue: 100,
minValue: 0,
tickMarks: { color: '#888888' },
title: { text: 'Time in minutes' },
unitInterval: 10,
visible: true
}
}
];
function App(): JSX.Element {
const chartData = useMemo(() => sampleData, []);
return (
<JqxChart
style={{ width: '850px', height: '500px' }}
title={title}
description={description}
showLegend={true}
enableAnimations={true}
padding={padding}
titlePadding={titlePadding}
source={chartData}
xAxis={xAxis}
seriesGroups={seriesGroups}
colorScheme="scheme01"
/>
);
}
export default App;Options are props. Keep objects such as the data adapter and the columns stable across renders with useMemo, so the component does not reload them.
Each event is a prop named on plus the event name with a capital first letter. For example, click: The event is raised when the user clicks on series element.
const handleClick = (event: any): void => {
console.log(event.args);
};
return <JqxChart onClick={handleClick} />;
Call methods through a ref. For example, refresh:
import { useRef } from 'react';
const myChart = useRef<JqxChart>(null);
const onClick = () => {
myChart.current!.refresh();
};
return <JqxChart ref={myChart} />;
Every component also has setOptions({ … }) and getOptions('name'), to change or read options after the first render.