@cdc/map 4.24.3 → 4.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdcmap.js +28425 -28180
- package/examples/example-city-state.json +51 -17
- package/examples/hex-colors.json +507 -0
- package/index.html +8 -8
- package/package.json +3 -3
- package/src/CdcMap.tsx +149 -113
- package/src/components/BubbleList.jsx +7 -5
- package/src/components/CityList.jsx +5 -5
- package/src/components/EditorPanel/components/EditorPanel.tsx +1390 -1436
- package/src/components/EditorPanel/components/Error.tsx +12 -0
- package/src/components/EditorPanel/components/Panel.PatternSettings-style.css +5 -0
- package/src/components/EditorPanel/components/Panel.PatternSettings.tsx +18 -1
- package/src/components/Legend/components/Legend.tsx +18 -7
- package/src/components/Legend/components/LegendItem.Hex.tsx +1 -1
- package/src/components/UsaMap/components/HexIcon.tsx +2 -2
- package/src/components/UsaMap/components/Territory/Territory.Rectangle.tsx +1 -1
- package/src/components/UsaMap/components/UsaMap.County.tsx +7 -4
- package/src/components/UsaMap/components/UsaMap.Region.tsx +3 -2
- package/src/components/UsaMap/components/UsaMap.SingleState.tsx +5 -3
- package/src/components/UsaMap/components/UsaMap.State.tsx +25 -10
- package/src/components/WorldMap/components/WorldMap.jsx +18 -3
- package/src/data/supported-geos.js +1 -0
- package/src/hooks/useMapLayers.tsx +2 -2
- package/src/scss/editor-panel.scss +1 -12
- package/src/scss/main.scss +2 -1
- package/src/scss/map.scss +1 -1
package/src/CdcMap.tsx
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef, useCallback } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback, useId } from 'react'
|
|
2
2
|
import * as d3 from 'd3'
|
|
3
|
+
import Layout from '@cdc/core/components/Layout'
|
|
4
|
+
import Waiting from '@cdc/core/components/Waiting'
|
|
5
|
+
import Error from './components/EditorPanel/components/Error'
|
|
3
6
|
|
|
4
7
|
// IE11
|
|
5
8
|
import 'whatwg-fetch'
|
|
@@ -123,6 +126,7 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
123
126
|
const transform = new DataTransform()
|
|
124
127
|
const [state, setState] = useState({ ...initialState })
|
|
125
128
|
const [loading, setLoading] = useState(true)
|
|
129
|
+
const [displayPanel, setDisplayPanel] = useState(true)
|
|
126
130
|
const [currentViewport, setCurrentViewport] = useState()
|
|
127
131
|
const [runtimeFilters, setRuntimeFilters] = useState([])
|
|
128
132
|
const [runtimeLegend, setRuntimeLegend] = useState([])
|
|
@@ -135,14 +139,49 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
135
139
|
const [container, setContainer] = useState()
|
|
136
140
|
const [imageId, setImageId] = useState(`cove-${Math.random().toString(16).slice(-4)}`) // eslint-disable-line
|
|
137
141
|
const [dimensions, setDimensions] = useState()
|
|
142
|
+
const [requiredColumns, setRequiredColumns] = useState(null) // Simple state so we know if we need more information before parsing the map
|
|
143
|
+
|
|
138
144
|
const legendRef = useRef(null)
|
|
145
|
+
const legendId = useId()
|
|
146
|
+
const tooltipId = useId()
|
|
139
147
|
|
|
140
148
|
const { changeFilterActive, handleSorting } = useFilters({ config: state, setConfig: setState })
|
|
141
149
|
let legendMemo = useRef(new Map())
|
|
142
150
|
let legendSpecialClassLastMemo = useRef(new Map())
|
|
143
151
|
let innerContainerRef = useRef()
|
|
144
152
|
|
|
145
|
-
if (isDebug) console.log('CdcMap state=', state) // eslint-disable-line
|
|
153
|
+
if (isDebug) console.log('CdcMap state=', state) // <eslint-disable-line></eslint-disable-line>
|
|
154
|
+
|
|
155
|
+
const columnsRequiredChecker = useCallback(() => {
|
|
156
|
+
let columnList = []
|
|
157
|
+
|
|
158
|
+
// Geo is always required
|
|
159
|
+
if ('' === state.columns.geo.name) {
|
|
160
|
+
columnList.push('Geography')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Primary is required if we're on a data map or a point map
|
|
164
|
+
if ('navigation' !== state.general.type && '' === state.columns.primary.name) {
|
|
165
|
+
columnList.push('Primary')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Navigate is required for navigation maps
|
|
169
|
+
if ('navigation' === state.general.type && ('' === state.columns.navigate.name || undefined === state.columns.navigate)) {
|
|
170
|
+
columnList.push('Navigation')
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && '' === state.columns.latitude.name) {
|
|
174
|
+
columnList.push('Latitude')
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (('us-geocode' === state.general.type || 'world-geocode' === state.general.type) && '' === state.columns.longitude.name) {
|
|
178
|
+
columnList.push('Longitude')
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (columnList.length === 0) columnList = null
|
|
182
|
+
|
|
183
|
+
setRequiredColumns(columnList)
|
|
184
|
+
}, [state.columns, state.general.type])
|
|
146
185
|
|
|
147
186
|
useEffect(() => {
|
|
148
187
|
try {
|
|
@@ -1547,13 +1586,6 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1547
1586
|
}
|
|
1548
1587
|
if (!table.label || table.label === '') table.label = 'Data Table'
|
|
1549
1588
|
|
|
1550
|
-
// Outer container classes
|
|
1551
|
-
let outerContainerClasses = ['cdc-open-viz-module', 'cdc-map-outer-container', currentViewport]
|
|
1552
|
-
|
|
1553
|
-
if (className) {
|
|
1554
|
-
outerContainerClasses.push(className)
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
1589
|
// Map container classes
|
|
1558
1590
|
let mapContainerClasses = ['map-container', state.legend.position, state.general.type, state.general.geoType, 'outline-none']
|
|
1559
1591
|
|
|
@@ -1609,7 +1641,8 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1609
1641
|
supportedTerritories,
|
|
1610
1642
|
titleCase,
|
|
1611
1643
|
type: general.type,
|
|
1612
|
-
viewport: currentViewport
|
|
1644
|
+
viewport: currentViewport,
|
|
1645
|
+
tooltipId
|
|
1613
1646
|
}
|
|
1614
1647
|
|
|
1615
1648
|
if (!mapProps.data || !state.data) return <></>
|
|
@@ -1621,7 +1654,7 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1621
1654
|
|
|
1622
1655
|
// 1) skip to legend
|
|
1623
1656
|
if (general.showSidebar) {
|
|
1624
|
-
tabbingID =
|
|
1657
|
+
tabbingID = legendId
|
|
1625
1658
|
}
|
|
1626
1659
|
|
|
1627
1660
|
// 2) skip to data table if it exists and not a navigation map
|
|
@@ -1649,109 +1682,112 @@ const CdcMap = ({ className, config, navigationHandler: customNavigationHandler,
|
|
|
1649
1682
|
|
|
1650
1683
|
return (
|
|
1651
1684
|
<ConfigContext.Provider value={mapProps}>
|
|
1652
|
-
<
|
|
1653
|
-
{isEditor && <EditorPanel />}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
{state?.filters?.length > 0 && <Filters config={state} setConfig={setState} filteredData={runtimeFilters} setFilteredData={setRuntimeFilters} dimensions={dimensions} />}
|
|
1669
|
-
|
|
1670
|
-
<div
|
|
1671
|
-
role='region'
|
|
1672
|
-
tabIndex='0'
|
|
1673
|
-
className={mapContainerClasses.join(' ')}
|
|
1674
|
-
onClick={e => closeModal(e)}
|
|
1675
|
-
onKeyDown={e => {
|
|
1676
|
-
if (e.keyCode === 13) {
|
|
1677
|
-
closeModal(e)
|
|
1678
|
-
}
|
|
1679
|
-
}}
|
|
1680
|
-
>
|
|
1681
|
-
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}
|
|
1682
|
-
<section className='outline-none geography-container' ref={mapSvg} tabIndex='0' style={{ width: '100%' }}>
|
|
1683
|
-
{currentViewport && (
|
|
1684
|
-
<>
|
|
1685
|
-
{modal && <Modal />}
|
|
1686
|
-
{'single-state' === geoType && <UsaMap.SingleState />}
|
|
1687
|
-
{'us' === geoType && 'us-geocode' !== state.general.type && <UsaMap.State />}
|
|
1688
|
-
{'us-region' === geoType && <UsaMap.Region />}
|
|
1689
|
-
{'us-county' === geoType && <UsaMap.County />}
|
|
1690
|
-
{'world' === geoType && <WorldMap />}
|
|
1691
|
-
{'data' === general.type && logo && <img src={logo} alt='' className='map-logo' />}
|
|
1692
|
-
</>
|
|
1693
|
-
)}
|
|
1694
|
-
</section>
|
|
1695
|
-
|
|
1696
|
-
{general.showSidebar && 'navigation' !== general.type && <Legend ref={legendRef} />}
|
|
1697
|
-
</div>
|
|
1698
|
-
|
|
1699
|
-
{'navigation' === general.type && <NavigationMenu mapTabbingID={tabId} displayGeoName={displayGeoName} data={runtimeData} options={general} columns={state.columns} navigationHandler={val => navigationHandler(val)} />}
|
|
1700
|
-
|
|
1701
|
-
{/* Link */}
|
|
1702
|
-
{isDashboard && config.table?.forceDisplay && config.table.showDataTableLink ? tableLink : link && link}
|
|
1703
|
-
|
|
1704
|
-
{subtext.length > 0 && <p className='subtext'>{parse(subtext)}</p>}
|
|
1705
|
-
|
|
1706
|
-
<MediaControls.Section classes={['download-buttons']}>
|
|
1707
|
-
{state.general.showDownloadImgButton && <MediaControls.Button text='Download Image' title='Download Chart as Image' type='image' state={state} elementToCapture={imageId} />}
|
|
1708
|
-
{state.general.showDownloadPdfButton && <MediaControls.Button text='Download PDF' title='Download Chart as PDF' type='pdf' state={state} elementToCapture={imageId} />}
|
|
1709
|
-
</MediaControls.Section>
|
|
1710
|
-
|
|
1711
|
-
{state.runtime.editorErrorMessage.length === 0 && true === table.forceDisplay && general.type !== 'navigation' && false === loading && (
|
|
1712
|
-
<DataTable
|
|
1713
|
-
config={state}
|
|
1714
|
-
rawData={state.data}
|
|
1715
|
-
navigationHandler={navigationHandler}
|
|
1716
|
-
expandDataTable={general.expandDataTable ? general.expandDataTable : table.expanded ? table.expanded : false}
|
|
1717
|
-
headerColor={general.headerColor}
|
|
1718
|
-
columns={state.columns}
|
|
1719
|
-
showDownloadButton={general.showDownloadButton}
|
|
1720
|
-
showFullGeoNameInCSV={table.showFullGeoNameInCSV}
|
|
1721
|
-
runtimeLegend={runtimeLegend}
|
|
1722
|
-
runtimeData={runtimeData}
|
|
1723
|
-
displayDataAsText={displayDataAsText}
|
|
1724
|
-
displayGeoName={displayGeoName}
|
|
1725
|
-
applyLegendToRow={applyLegendToRow}
|
|
1726
|
-
tableTitle={table.label}
|
|
1727
|
-
indexTitle={table.indexLabel}
|
|
1728
|
-
vizTitle={general.title}
|
|
1729
|
-
viewport={currentViewport}
|
|
1730
|
-
formatLegendLocation={formatLegendLocation}
|
|
1731
|
-
setFilteredCountryCode={setFilteredCountryCode}
|
|
1732
|
-
tabbingId={tabId}
|
|
1733
|
-
showDownloadImgButton={state.general.showDownloadImgButton}
|
|
1734
|
-
showDownloadPdfButton={state.general.showDownloadPdfButton}
|
|
1735
|
-
innerContainerRef={innerContainerRef}
|
|
1736
|
-
outerContainerRef={outerContainerRef}
|
|
1737
|
-
imageRef={imageId}
|
|
1738
|
-
isDebug={isDebug}
|
|
1739
|
-
wrapColumns={table.wrapColumns}
|
|
1685
|
+
<Layout.VisualizationWrapper config={state} isEditor={isEditor} ref={outerContainerRef} imageId={imageId} showEditorPanel={state.showEditorPanel}>
|
|
1686
|
+
{isEditor && <EditorPanel columnsRequiredChecker={columnsRequiredChecker} />}
|
|
1687
|
+
<Layout.Responsive isEditor={isEditor}>
|
|
1688
|
+
{state?.runtime?.editorErrorMessage.length > 0 && <Error state={state} />}
|
|
1689
|
+
{requiredColumns && <Waiting requiredColumns={requiredColumns} className={displayPanel ? `waiting` : `waiting collapsed`} />}
|
|
1690
|
+
{!runtimeData.init && (general.type === 'navigation' || runtimeLegend) && (
|
|
1691
|
+
<section className={`cove-component__content cdc-map-inner-container ${currentViewport}`} aria-label={'Map: ' + title} ref={innerContainerRef}>
|
|
1692
|
+
{!window.matchMedia('(any-hover: none)').matches && 'hover' === tooltips.appearanceType && (
|
|
1693
|
+
<ReactTooltip id={`tooltip__${tooltipId}`} float={true} className={`${tooltips.capitalizeLabels ? 'capitalize tooltip tooltip-test' : 'tooltip tooltip-test'}`} style={{ background: `rgba(255,255,255, ${state.tooltips.opacity / 100})`, color: 'black' }} />
|
|
1694
|
+
)}
|
|
1695
|
+
{/* prettier-ignore */}
|
|
1696
|
+
<Title
|
|
1697
|
+
title={title}
|
|
1698
|
+
superTitle={general.superTitle}
|
|
1699
|
+
config={config}
|
|
1700
|
+
classes={['map-title', general.showTitle === true ? 'visible' : 'hidden', `${general.headerColor}`]}
|
|
1740
1701
|
/>
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1702
|
+
<SkipTo skipId={tabId} skipMessage='Skip Over Map Container' />
|
|
1703
|
+
|
|
1704
|
+
{general.introText && <section className='introText'>{parse(general.introText)}</section>}
|
|
1705
|
+
|
|
1706
|
+
{/* prettier-ignore */}
|
|
1707
|
+
{state?.filters?.length > 0 && <Filters config={state} setConfig={setState} filteredData={runtimeFilters} setFilteredData={setRuntimeFilters} dimensions={dimensions} />}
|
|
1708
|
+
|
|
1709
|
+
<div
|
|
1710
|
+
role='region'
|
|
1711
|
+
tabIndex='0'
|
|
1712
|
+
className={mapContainerClasses.join(' ')}
|
|
1713
|
+
onClick={e => closeModal(e)}
|
|
1714
|
+
onKeyDown={e => {
|
|
1715
|
+
if (e.keyCode === 13) {
|
|
1716
|
+
closeModal(e)
|
|
1717
|
+
}
|
|
1718
|
+
}}
|
|
1719
|
+
>
|
|
1720
|
+
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}
|
|
1721
|
+
<section className='outline-none geography-container' ref={mapSvg} tabIndex='0' style={{ width: '100%' }}>
|
|
1722
|
+
{currentViewport && (
|
|
1723
|
+
<>
|
|
1724
|
+
{modal && <Modal />}
|
|
1725
|
+
{'single-state' === geoType && <UsaMap.SingleState />}
|
|
1726
|
+
{'us' === geoType && 'us-geocode' !== state.general.type && <UsaMap.State />}
|
|
1727
|
+
{'us-region' === geoType && <UsaMap.Region />}
|
|
1728
|
+
{'us-county' === geoType && <UsaMap.County />}
|
|
1729
|
+
{'world' === geoType && <WorldMap />}
|
|
1730
|
+
{'data' === general.type && logo && <img src={logo} alt='' className='map-logo' />}
|
|
1731
|
+
</>
|
|
1732
|
+
)}
|
|
1733
|
+
</section>
|
|
1734
|
+
|
|
1735
|
+
{general.showSidebar && 'navigation' !== general.type && <Legend ref={legendRef} skipId={tabId} />}
|
|
1736
|
+
</div>
|
|
1737
|
+
|
|
1738
|
+
{'navigation' === general.type && <NavigationMenu mapTabbingID={tabId} displayGeoName={displayGeoName} data={runtimeData} options={general} columns={state.columns} navigationHandler={val => navigationHandler(val)} />}
|
|
1739
|
+
|
|
1740
|
+
{/* Link */}
|
|
1741
|
+
{isDashboard && config.table?.forceDisplay && config.table.showDataTableLink ? tableLink : link && link}
|
|
1742
|
+
|
|
1743
|
+
{subtext.length > 0 && <p className='subtext'>{parse(subtext)}</p>}
|
|
1744
|
+
|
|
1745
|
+
<MediaControls.Section classes={['download-buttons']}>
|
|
1746
|
+
{state.general.showDownloadImgButton && <MediaControls.Button text='Download Image' title='Download Chart as Image' type='image' state={state} elementToCapture={imageId} />}
|
|
1747
|
+
{state.general.showDownloadPdfButton && <MediaControls.Button text='Download PDF' title='Download Chart as PDF' type='pdf' state={state} elementToCapture={imageId} />}
|
|
1748
|
+
</MediaControls.Section>
|
|
1749
|
+
|
|
1750
|
+
{state.runtime.editorErrorMessage.length === 0 && true === table.forceDisplay && general.type !== 'navigation' && false === loading && (
|
|
1751
|
+
<DataTable
|
|
1752
|
+
config={state}
|
|
1753
|
+
rawData={state.data}
|
|
1754
|
+
navigationHandler={navigationHandler}
|
|
1755
|
+
expandDataTable={table.expanded}
|
|
1756
|
+
headerColor={general.headerColor}
|
|
1757
|
+
columns={state.columns}
|
|
1758
|
+
showDownloadButton={general.showDownloadButton}
|
|
1759
|
+
showFullGeoNameInCSV={table.showFullGeoNameInCSV}
|
|
1760
|
+
runtimeLegend={runtimeLegend}
|
|
1761
|
+
runtimeData={runtimeData}
|
|
1762
|
+
displayDataAsText={displayDataAsText}
|
|
1763
|
+
displayGeoName={displayGeoName}
|
|
1764
|
+
applyLegendToRow={applyLegendToRow}
|
|
1765
|
+
tableTitle={table.label}
|
|
1766
|
+
indexTitle={table.indexLabel}
|
|
1767
|
+
vizTitle={general.title}
|
|
1768
|
+
viewport={currentViewport}
|
|
1769
|
+
formatLegendLocation={formatLegendLocation}
|
|
1770
|
+
setFilteredCountryCode={setFilteredCountryCode}
|
|
1771
|
+
tabbingId={tabId}
|
|
1772
|
+
showDownloadImgButton={state.general.showDownloadImgButton}
|
|
1773
|
+
showDownloadPdfButton={state.general.showDownloadPdfButton}
|
|
1774
|
+
innerContainerRef={innerContainerRef}
|
|
1775
|
+
outerContainerRef={outerContainerRef}
|
|
1776
|
+
imageRef={imageId}
|
|
1777
|
+
isDebug={isDebug}
|
|
1778
|
+
wrapColumns={table.wrapColumns}
|
|
1779
|
+
/>
|
|
1780
|
+
)}
|
|
1781
|
+
|
|
1782
|
+
{general.footnotes && <section className='footnotes'>{parse(general.footnotes)}</section>}
|
|
1783
|
+
</section>
|
|
1784
|
+
)}
|
|
1785
|
+
|
|
1786
|
+
<div aria-live='assertive' className='cdcdataviz-sr-only'>
|
|
1787
|
+
{accessibleStatus}
|
|
1788
|
+
</div>
|
|
1789
|
+
</Layout.Responsive>
|
|
1790
|
+
</Layout.VisualizationWrapper>
|
|
1755
1791
|
</ConfigContext.Provider>
|
|
1756
1792
|
)
|
|
1757
1793
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import React, { useEffect } from 'react'
|
|
1
|
+
import React, { useEffect, useContext } from 'react'
|
|
2
2
|
import { scaleLinear } from 'd3-scale'
|
|
3
3
|
import { countryCoordinates } from '../data/country-coordinates'
|
|
4
4
|
import stateCoordinates from '../data/state-coordinates'
|
|
5
|
+
import ConfigContext from './../../src/context'
|
|
5
6
|
|
|
6
7
|
export const BubbleList = ({ data: dataImport, state, projection, applyLegendToRow, applyTooltipsToGeo, handleCircleClick, runtimeData, displayGeoName }) => {
|
|
7
8
|
const maxDataValue = Math.max(...dataImport.map(d => d[state.columns.primary.name]))
|
|
9
|
+
const { tooltipId } = useContext(ConfigContext)
|
|
8
10
|
const hasBubblesWithZeroOnMap = state.visual.showBubbleZeros ? 0 : 1
|
|
9
11
|
// sort runtime data. Smaller bubbles should appear on top.
|
|
10
12
|
const sortedRuntimeData = Object.values(runtimeData).sort((a, b) => (a[state.columns.primary.name] < b[state.columns.primary.name] ? 1 : -1))
|
|
@@ -62,7 +64,7 @@ export const BubbleList = ({ data: dataImport, state, projection, applyLegendToR
|
|
|
62
64
|
}}
|
|
63
65
|
transform={transform}
|
|
64
66
|
style={{ transition: 'all .25s ease-in-out', cursor: 'pointer' }}
|
|
65
|
-
data-tooltip-id=
|
|
67
|
+
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
66
68
|
data-tooltip-html={toolTip}
|
|
67
69
|
/>
|
|
68
70
|
|
|
@@ -90,7 +92,7 @@ export const BubbleList = ({ data: dataImport, state, projection, applyLegendToR
|
|
|
90
92
|
}}
|
|
91
93
|
transform={transform}
|
|
92
94
|
style={{ transition: 'all .25s ease-in-out', cursor: 'pointer' }}
|
|
93
|
-
data-tooltip-id=
|
|
95
|
+
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
94
96
|
data-tooltip-html={toolTip}
|
|
95
97
|
/>
|
|
96
98
|
)}
|
|
@@ -161,7 +163,7 @@ export const BubbleList = ({ data: dataImport, state, projection, applyLegendToR
|
|
|
161
163
|
}}
|
|
162
164
|
transform={transform}
|
|
163
165
|
style={{ transition: 'all .25s ease-in-out', cursor: 'pointer' }}
|
|
164
|
-
data-tooltip-id=
|
|
166
|
+
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
165
167
|
data-tooltip-html={toolTip}
|
|
166
168
|
/>
|
|
167
169
|
{state.visual.extraBubbleBorder && (
|
|
@@ -189,7 +191,7 @@ export const BubbleList = ({ data: dataImport, state, projection, applyLegendToR
|
|
|
189
191
|
}}
|
|
190
192
|
transform={transform}
|
|
191
193
|
style={{ transition: 'all .25s ease-in-out', cursor: 'pointer' }}
|
|
192
|
-
data-tooltip-id=
|
|
194
|
+
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
193
195
|
data-tooltip-html={toolTip}
|
|
194
196
|
/>
|
|
195
197
|
)}
|
|
@@ -5,7 +5,7 @@ import { supportedCities } from '../data/supported-geos'
|
|
|
5
5
|
import { scaleLinear } from 'd3-scale'
|
|
6
6
|
import { GlyphStar, GlyphTriangle, GlyphDiamond, GlyphSquare, GlyphCircle } from '@visx/glyph'
|
|
7
7
|
|
|
8
|
-
const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeoName, applyLegendToRow, projection, titleCase, setSharedFilterValue, isFilterValueSupported }) => {
|
|
8
|
+
const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeoName, applyLegendToRow, projection, titleCase, setSharedFilterValue, isFilterValueSupported, tooltipId }) => {
|
|
9
9
|
const [citiesData, setCitiesData] = useState({})
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|
|
@@ -67,7 +67,7 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
|
|
|
67
67
|
d='M0,0l-8.8-17.7C-12.1-24.3-7.4-32,0-32h0c7.4,0,12.1,7.7,8.8,14.3L0,0z'
|
|
68
68
|
title='Select for more information'
|
|
69
69
|
onClick={() => geoClickHandler(cityDisplayName, geoData)}
|
|
70
|
-
data-tooltip-id=
|
|
70
|
+
data-tooltip-id={`tooltip__${tooltipId}`}
|
|
71
71
|
data-tooltip-html={toolTip}
|
|
72
72
|
transform={`scale(${radius / 9})`}
|
|
73
73
|
stroke={state.general.geoBorderColor === 'sameAsBackground' ? '#ffffff' : '#000000'}
|
|
@@ -97,8 +97,8 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
|
|
|
97
97
|
|
|
98
98
|
const styles = {
|
|
99
99
|
fill: legendColors[0],
|
|
100
|
-
opacity: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] !== setSharedFilterValue ? 0.5 : 1,
|
|
101
|
-
stroke: setSharedFilterValue && isFilterValueSupported && data[city][state.columns.geo.name] === setSharedFilterValue ? 'rgba(0, 0, 0, 1)' : 'rgba(0, 0, 0, 0.4)',
|
|
100
|
+
opacity: setSharedFilterValue && isFilterValueSupported && data[city] && data[city][state.columns.geo.name] !== setSharedFilterValue ? 0.5 : 1,
|
|
101
|
+
stroke: setSharedFilterValue && isFilterValueSupported && data[city] && data[city][state.columns.geo.name] === setSharedFilterValue ? 'rgba(0, 0, 0, 1)' : 'rgba(0, 0, 0, 0.4)',
|
|
102
102
|
'&:hover': {
|
|
103
103
|
fill: legendColors[1],
|
|
104
104
|
outline: 0
|
|
@@ -119,7 +119,7 @@ const CityList = ({ data, state, geoClickHandler, applyTooltipsToGeo, displayGeo
|
|
|
119
119
|
onClick: () => geoClickHandler(cityDisplayName, geoData),
|
|
120
120
|
size: state.general.type === 'bubble' ? size(geoData[state.columns.primary.name]) : radius * 30,
|
|
121
121
|
title: 'Select for more information',
|
|
122
|
-
'data-tooltip-id':
|
|
122
|
+
'data-tooltip-id': `tooltip__${tooltipId}`,
|
|
123
123
|
'data-tooltip-html': toolTip,
|
|
124
124
|
stroke: state.general.geoBorderColor === 'sameAsBackground' ? '#ffffff' : '#000000',
|
|
125
125
|
strokeWidth: '2px',
|