File tree Expand file tree Collapse file tree
packages/cli/templates/react/igr-ts
category-chart/default/files/src/app/__path__
doughnut-chart/default/files/src/app/__path__
financial-chart/default/files/src/app/__path__
pie-chart/default/files/src/app/__path__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import { IgrCategoryChartModule } from 'igniteui-react-charts' ;
33import { IgrCategoryChart } from 'igniteui-react-charts' ;
44import style from './style.module.css' ;
@@ -15,7 +15,11 @@ const data: any = [
1515
1616export default function $ ( ClassName ) ( ) {
1717 const title = 'Category Chart' ;
18- const [ chartData ] = useState ( data ) ;
18+ const [ chartData , setChartData ] = useState ( [ ] ) ;
19+
20+ useEffect ( ( ) => {
21+ setChartData ( data ) ;
22+ } , [ ] ) ;
1923
2024 return (
2125 < div >
Original file line number Diff line number Diff line change @@ -23,18 +23,12 @@ const data: any = [
2323
2424export default function $ ( ClassName ) ( ) {
2525 const title = 'Doughnut Chart' ;
26- const [ chartData ] = useState ( data ) ;
26+ const [ chartData , setChartData ] = useState ( [ ] ) ;
2727 const legendRef : any = useRef ( null ) ;
2828 const chartRef : any = useRef ( null ) ;
2929
3030 useEffect ( ( ) => {
31- if ( chartRef . current && legendRef . current ) {
32- const chart = chartRef . current ;
33- const series = chart . series ?. [ 0 ] ;
34- if ( series ) {
35- series . legend = legendRef . current ;
36- }
37- }
31+ setChartData ( data ) ;
3832 } , [ ] ) ;
3933
4034 return (
@@ -59,6 +53,7 @@ export default function $(ClassName)() {
5953 dataSource = { chartData }
6054 labelMemberPath = "Company"
6155 valueMemberPath = "MarketShare"
56+ legend = { legendRef . current }
6257 />
6358 </ IgrDoughnutChart >
6459 </ div >
Original file line number Diff line number Diff line change 1- import { useState } from 'react'
1+ import { useEffect , useState } from 'react'
22import { IgrFinancialChartModule } from 'igniteui-react-charts' ;
33import { IgrFinancialChart } from 'igniteui-react-charts' ;
44import style from './style.module.css' ;
@@ -22,7 +22,11 @@ const data: any = [
2222
2323export default function $ ( ClassName ) ( ) {
2424 const title = 'Financial Chart' ;
25- const [ chartData ] = useState ( data ) ;
25+ const [ chartData , setChartData ] = useState ( [ ] ) ;
26+
27+ useEffect ( ( ) => {
28+ setChartData ( data ) ;
29+ } , [ ] ) ;
2630
2731 return (
2832 < div >
Original file line number Diff line number Diff line change @@ -18,14 +18,12 @@ const data: any = [
1818
1919export default function $ ( ClassName ) ( ) {
2020 const title = 'Pie Chart' ;
21- const [ chartData ] = useState ( data ) ;
21+ const [ chartData , setChartData ] = useState ( [ ] ) ;
2222 const legendRef : any = useRef ( null ) ;
2323 const chartRef : any = useRef ( null ) ;
2424
2525 useEffect ( ( ) => {
26- if ( chartRef . current && legendRef . current ) {
27- chartRef . current . legend = legendRef . current ;
28- }
26+ setChartData ( data ) ;
2927 } , [ ] ) ;
3028
3129 return (
@@ -49,6 +47,7 @@ export default function $(ClassName)() {
4947 height = "500px"
5048 ref = { chartRef }
5149 legendLabelMemberPath = "Label"
50+ legend = { legendRef . current }
5251 />
5352 </ div >
5453 </ div >
Original file line number Diff line number Diff line change 2727 "@types/node" : " ^24.12.0" ,
2828 "@types/react" : " ^19.2.14" ,
2929 "@types/react-dom" : " ^19.2.3" ,
30+ "@vitejs/plugin-react" : " ^5.0.3" ,
3031 "@vitest/browser-playwright" : " ^4.1.0" ,
3132 "eslint" : " ^9.39.4" ,
3233 "eslint-plugin-react-hooks" : " ^7.0.1" ,
Original file line number Diff line number Diff line change 1+ /// <reference types="vitest/config" />
12import { playwright } from '@vitest/browser-playwright'
2- import { defineConfig } from 'vitest/config'
3+ import { defineConfig } from 'vite'
4+ import react from '@vitejs/plugin-react'
35
46// https://vitejs.dev/config/
57export default defineConfig ( {
68 build : {
79 chunkSizeWarningLimit : 10 * 1024 * 1024 , // 10 MB
810 } ,
11+ plugins : [ react ( ) ] ,
912 test : {
1013 browser : {
1114 enabled : true ,
You can’t perform that action at this time.
0 commit comments