Fix tooltips
Этот коммит содержится в:
родитель
3071f350ab
Коммит
eac1fa7bb8
@ -59,16 +59,6 @@
|
|||||||
let tooltipContent;
|
let tooltipContent;
|
||||||
let tooltipX;
|
let tooltipX;
|
||||||
let tooltipY;
|
let tooltipY;
|
||||||
|
|
||||||
function handleMouseOver(event) {
|
|
||||||
showTooltip = true;
|
|
||||||
tooltipX = event.clientX;
|
|
||||||
tooltipY = event.clientY;
|
|
||||||
tooltipContent = ttContent;
|
|
||||||
}
|
|
||||||
function handleMouseOut() {
|
|
||||||
showTooltip = false;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="timeline-container" bind:clientWidth={width}>
|
<div class="timeline-container" bind:clientWidth={width}>
|
||||||
@ -171,7 +161,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
{#if showTooltip}
|
{#if showTooltip}
|
||||||
<Tooltip {tooltipX} {tooltipY} {tooltipContent} />
|
<Tooltip {tooltipX} {tooltipY} {tooltipContent} {width}/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -3,14 +3,16 @@
|
|||||||
export let tooltipX;
|
export let tooltipX;
|
||||||
export let tooltipY;
|
export let tooltipY;
|
||||||
export let tooltipContent;
|
export let tooltipContent;
|
||||||
|
export let width;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
transition:fade="{{ duration: 250 }}"
|
transition:fade="{{ duration: 250 }}"
|
||||||
class="tooltip"
|
class="tooltip"
|
||||||
style="
|
style="
|
||||||
top:{tooltipY < 100 ? tooltipY + 60 : tooltipY - 40}px;
|
top:{tooltipY}px;
|
||||||
left:{tooltipX < 800 ? tooltipX - 30 : tooltipX - 360}px;
|
left:{tooltipX < width - 300 ? tooltipX + 10 : tooltipX - 300 - 10}px;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{@html tooltipContent}
|
{@html tooltipContent}
|
||||||
@ -18,11 +20,11 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.tooltip {
|
.tooltip {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
background: rgba(255, 255, 255, 0.95);
|
background: rgba(255, 255, 255, 0.95);
|
||||||
transform: translate(0%, -200%);
|
transform: translate(0%, -50%);
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
|
||||||
|
|||||||
@ -62,8 +62,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const metricsResponse = await csv('https://fiat-2024-processed-data.s3.us-west-2.amazonaws.com/fiat_country_metrics.csv')
|
const metricsResponse = await csv('https://fiat-2024-processed-data.s3.us-west-2.amazonaws.com/fiat_country_metrics.csv')
|
||||||
//metrics = metricsResponse
|
|
||||||
//console.log(metrics)
|
|
||||||
metrics = metricsResponse.map(d => {
|
metrics = metricsResponse.map(d => {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
obj.date = new Date(d.Date),
|
obj.date = new Date(d.Date),
|
||||||
|
|||||||
Загрузка…
x
Ссылка в новой задаче
Block a user