@@ -77,9 +77,8 @@ svgObject.addEventListener('load', () => {
7777
7878 regions . forEach ( region => {
7979 if ( region . id && ! region . id . includes ( "path" ) ) {
80- region . addEventListener ( 'mouseover' , ( ) => {
80+ region . addEventListener ( 'mouseover' , ( e ) => {
8181 region . style . fill = '#FF0000' ;
82-
8382
8483 const stateInfo = document . getElementById ( 'stateInfo' ) ;
8584 stateInfo . style . display = 'block' ;
@@ -105,9 +104,30 @@ svgObject.addEventListener('load', () => {
105104 if ( Array . from ( countyData . entries ( ) ) . find ( ( [ key ] ) => key . endsWith ( processedId ) ) ) {
106105 Create_County_Chart ( 'tempChart' , getRandomPattern ( test_data_pattern1 , test_data_pattern2 ) , 'County Alert Trend' ) ;
107106 }
107+ // const tooltip = document.getElementById('tooltip');
108+ // console.log("get tooltip", tooltip);
109+ // tooltip.style.display = 'block';
110+ // tooltip.style.left = e.pageX + 10 + 'px';
111+ // tooltip.style.top = e.pageY + 10 + 'px';
112+ // tooltip.innerHTML = `
113+ // <h3>${processedId}</h3>
114+ // ${(() => {
115+ // const match = Array.from(countyData.entries()).find(([key]) => key.endsWith(processedId));
116+ // if (match) {
117+ // const [_, value] = match;
118+ // return `
119+ // <p>Climate Zone: ${value.BA_zone}</p>
120+ // <p>State: ${value.state_name}</p>
121+ // `;
122+ // }
123+ // return 'Data not match';
124+ // })() }
125+ // `;
126+
108127 } ) ;
109128 region . addEventListener ( 'mouseout' , ( ) => {
110129 region . style . fill = '' ;
130+ // document.getElementById('tooltip').style.display = 'none';
111131 } ) ;
112132 region . addEventListener ( 'click' , ( ) => {
113133 const targetUrl = `https://danielchen3.github.io/usa_map/${ region . id } ` ;
@@ -143,7 +163,7 @@ svgObject.addEventListener('load', () => {
143163 } ) ( ) }
144164 ` ;
145165 if ( Array . from ( countyData . entries ( ) ) . find ( ( [ key ] ) => key . endsWith ( processedId ) ) ) {
146- Create_County_Chart ( 'tempChart' , test_data , 'County Alert Trend' ) ;
166+ Create_County_Chart ( 'tempChart' , getRandomPattern ( test_data_pattern1 , test_data_pattern2 ) , 'County Alert Trend' ) ;
147167 }
148168 } ) ;
149169 path . addEventListener ( 'mouseout' , ( ) => {
0 commit comments