import * as React from 'react'; import JqxBulletChart, { IBulletChartProps } from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxbulletchart'; class App extends React.PureComponent<{}, IBulletChartProps> { constructor(props: {}) { super(props); this.state = { description: 'on 28 May', labelsFormatFunction: (value: string, position: string): string => { const valueNum = parseFloat(value); let labelsColor; if (valueNum < 10) { labelsColor = '#0099FF'; } else if (valueNum < 15) { labelsColor = '#006600'; } else if (valueNum < 20) { labelsColor = '#FF6600'; } else { labelsColor = '#FF4526'; } if (position === 'near') { return '' + (valueNum * 1.8 + 32) + '°F'; } else { return valueNum + '°C'; } }, pointer: { color: '#181818', size: '25%', value: 11 }, ranges: [ { color: '#0099FF', endValue: 10, opacity: 1, startValue: 0 }, { color: '#006600', endValue: 15, opacity: 1, startValue: 10 }, { color: '#FF6600', endValue: 20, opacity: 1, startValue: 15 }, { color: '#FF4526', endValue: 25, opacity: 1, startValue: 20 } ], target: { color: '#181818', size: 4, value: 15 }, ticks: { interval: 5, position: 'both', size: 10 }, title: 'Temperature in Boston, Mass.', tooltipFormatFunction: (value: number, target: number): string => { return '
Temperature on May 28: ' + (value * 1.8 + 32) + '°F (' + value + '°C)
Average temperature in May: ' + (target * 1.8 + 32) + '°F (' + target + '°C)
' } } }; public render() { return ( ); } } export default App;