import * as React from 'react'; import JqxChart, { IChartProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxchart'; import JqxCheckBox from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxcheckbox'; import JqxDropDownList, { IDropDownListProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxdropdownlist'; import JqxSlider from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxslider'; export interface IState extends IChartProps { colorsSchemesList: IDropDownListProps['source']; schemeSelectedIndex: IDropDownListProps['selectedIndex']; seriesList: IDropDownListProps['source']; seriesSelectedIndex: IDropDownListProps['selectedIndex'] } class App extends React.PureComponent<{}, IState> { private myChart = React.createRef(); constructor(props: {}) { super(props); this.sliderStartAngle = this.sliderStartAngle.bind(this); this.sliderRadius = this.sliderRadius.bind(this); this.dropDownListColor = this.dropDownListColor.bind(this); this.dropDownListSeries = this.dropDownListSeries.bind(this); this.checkBoxAutoRotate = this.checkBoxAutoRotate.bind(this); this.checkBoxTicksBetween = this.checkBoxTicksBetween.bind(this); const data: any[] = [ { type: 'Organic Search', month1: 1725090, month2: 3136190 }, { type: 'Paid Search', month1: 925090, month2: 2136190 }, { type: 'Direct', month1: 425090, month2: 936190 }, { type: 'Referral', month1: 1250900, month2: 2536190 }, { type: 'Twitter', month1: 350900, month2: 681900 }, { type: 'Facebook', month1: 381900, month2: 831500 } ]; this.state = { colorScheme: 'scheme05', colorsSchemesList: ['scheme01', 'scheme02', 'scheme03', 'scheme04', 'scheme05', 'scheme06', 'scheme07', 'scheme08'], description: 'Month over month comparison', padding: { left: 5, top: 5, right: 5, bottom: 5 }, schemeSelectedIndex: 4, seriesGroups: [ { endAngle: 360, radius: 120, series: [ { dataField: 'month1', displayText: 'January 2014', opacity: 0.7, radius: 2, lineWidth: 2, symbolType: 'circle' }, { dataField: 'month2', displayText: 'February 2014', opacity: 0.7, radius: 2, lineWidth: 2, symbolType: 'square' } ], spider: true, startAngle: 0, type: 'spline' } ], seriesList: ['splinearea', 'spline', 'column', 'scatter', 'stackedcolumn', 'stackedsplinearea', 'stackedspline'], seriesSelectedIndex: 1, source: data, title: 'Website audience acquision by source', titlePadding: { left: 0, top: 0, right: 0, bottom: 5 }, valueAxis: { labels: { formatFunction: (value: any, itemIndex: any, serieIndex: any, groupIndex: any): string => { return Math.round(value / 1000) + ' K'; }, formatSettings: { decimalPlaces: 0 } }, unitInterval: 1000000 }, xAxis: { dataField: 'type', displayText: 'Traffic source', labels: { autoRotate: false }, valuesOnTicks: true } }; } public render() { return (

Move the slider to rotate:

Select the series type:

Move the slider to change the radius:

Select color scheme:

Auto-rotate labels Ticks between values
); } private sliderStartAngle(event: any): void { const value = event.args.value; const newSeriesGroups = this.state.seriesGroups; newSeriesGroups![0].startAngle = value; newSeriesGroups![0].endAngle = value + 360; this.setState({ seriesGroups: newSeriesGroups }, () => { this.myChart.current!.update(); }); } private sliderRadius(event: any): void { const value = event.args.value; const newSeriesGroups = this.state.seriesGroups; newSeriesGroups![0].radius = value; this.setState({ seriesGroups: newSeriesGroups }, () => { this.myChart.current!.update(); }); } private dropDownListColor(event: any): void { const value = event.args.item.value; const index = event.args.index; this.setState({ colorScheme: value, schemeSelectedIndex: index }); } private dropDownListSeries(event: any): void { const value = event.args.item.value; const index = event.args.index; const newSeriesGroups = this.state.seriesGroups; newSeriesGroups![0].type = value; this.setState({ seriesGroups: newSeriesGroups, seriesSelectedIndex: index }, () => { this.myChart.current!.update(); }); } private checkBoxTicksBetween(event: any): void { const newXAxis = this.state.xAxis; newXAxis!.valuesOnTicks = !event.args.checked; this.setState({ xAxis: newXAxis }, () => { this.myChart.current!.update(); }); } private checkBoxAutoRotate(event: any): void { const newXAxis = this.state.xAxis; const newValueAxis = this.state.valueAxis; newXAxis!.labels!.autoRotate = event.args.checked; newValueAxis!.labels!.autoRotate = event.args.checked; this.setState({ valueAxis: newValueAxis, xAxis: newXAxis }, () => { this.myChart.current!.update(); }); } } export default App;