@@ -15,16 +15,6 @@ function randomInt(min: number, max: number) {
1515 return min + Math . floor ( pseudoRandom ( ) * ( max - min ) ) ;
1616}
1717
18- function shuffleArray < T > ( array : T [ ] ) : T [ ] {
19- let currentIndex = array . length ;
20- while ( currentIndex !== 0 ) {
21- const randomIndex = Math . floor ( Math . random ( ) * currentIndex ) ;
22- currentIndex -- ;
23- [ array [ currentIndex ] , array [ randomIndex ] ] = [ array [ randomIndex ] , array [ currentIndex ] ] ;
24- }
25- return array ;
26- }
27-
2818const colors = [
2919 "#F15C80" ,
3020 "#2B908F" ,
@@ -101,20 +91,21 @@ for (let i = 0; i < 10; i++) {
10191 secondarySeriesData [ `data${ letter } ` ] = generateSecondaryAxisData ( letter , i ) ;
10292}
10393
104- const series : Highcharts . SeriesOptionsType [ ] = shuffleArray (
105- [ ...Object . values ( primarySeriesData ) , ...Object . values ( secondarySeriesData ) ] . map ( ( data , index ) => {
106- const name = data [ 0 ] . name ;
107- const isPercentage = name . startsWith ( "Percentage" ) ;
108- return {
109- name,
110- type : "line" ,
111- data : data ,
112- yAxis : isPercentage ? 1 : 0 ,
113- color : colors [ index % colors . length ] ,
114- dashStyle : isPercentage ? "Dash" : "Solid" ,
115- } ;
116- } ) ,
117- ) ;
94+ const series : Highcharts . SeriesOptionsType [ ] = [
95+ ...Object . values ( primarySeriesData ) ,
96+ ...Object . values ( secondarySeriesData ) ,
97+ ] . map ( ( data , index ) => {
98+ const name = data [ 0 ] . name ;
99+ const isPercentage = name . startsWith ( "Percentage" ) ;
100+ return {
101+ name,
102+ type : "line" ,
103+ data : data ,
104+ yAxis : isPercentage ? 1 : 0 ,
105+ color : colors [ index % colors . length ] ,
106+ dashStyle : isPercentage ? "Dash" : "Solid" ,
107+ } ;
108+ } ) ;
118109
119110export default function ( ) {
120111 const { chartProps } = useChartSettings ( ) ;
0 commit comments