Skip to content

Black bar on hover #795

@Fedex75

Description

@Fedex75

Hi. I'm having an issue where after building the project the tooltips render a black bar instead of the gray, semitransparent bar I see in development. I'm using layerchart version "^2.0.0-next.27".

This is the chart:

<BarChart
	data={currentContractsChartData}
	x={['startDate', 'endDate']}
	xScale={scaleTime()}
	y="name"
	grid={{ x: false, y: true, bandAlign: 'between' }}
	orientation="horizontal"
	padding={{ left: 12, bottom: 36 }}
	props={{
		yAxis: { format: () => '' },
		xAxis: {
			format: (d: Date) => {
				return d.toLocaleDateString('es-AR', { month: 'short', year: '2-digit' });
			}
		},
		bars: { fill: 'var(--chart-1)' }
	}}
>
	{#snippet tooltip({ context })}
		<Tooltip.Root {context}>
			{#snippet children({ data })}
				<Tooltip.Header>{data.name}</Tooltip.Header>
				<Tooltip.List>
					<Tooltip.Item
						label="Inicio"
						value={data.startDate}
						format={(d) =>
							new Date(d).toLocaleDateString('es-ES', {
								month: 'long',
								year: 'numeric'
							})}
					/>
					<Tooltip.Item
						label="Fin"
						value={data.endDate}
						format={(d) =>
							new Date(d).toLocaleDateString('es-ES', {
								month: 'long',
								year: 'numeric'
							})}
					/>
					<Tooltip.Separator />
					<Tooltip.Item label="Duración" valueAlign="right">
						{data.contract.rentalOffer.expectedDurationAmount}
						{#if data.contract.rentalOffer.expectedDurationType === 'MONTHS'}
							{data.contract.rentalOffer.expectedDurationAmount === 1
								? 'mes'
								: 'meses'}
						{:else}
							{data.contract.rentalOffer.expectedDurationAmount === 1
								? 'día'
								: 'días'}
						{/if}
					</Tooltip.Item>
				</Tooltip.List>
			{/snippet}
		</Tooltip.Root>
	{/snippet}

	{#snippet aboveMarks({ context })}
		{#each currentContractsChartData as d (d.contract.id)}
			<Text
				value={d.contract.rentalOffer.property.name}
				x={context.xScale(d.startDate) + 2}
				y={context.yScale(d.name) + context.yScale.bandwidth!() / 2}
				textAnchor="start"
				verticalAnchor="middle"
				class="text-sm text-white"
			/>
		{/each}
	{/snippet}
</BarChart>

This is what it looks like in dev:

Image

And this is what it looks like in production:

Image

If it helps, the "black bar" is this component:
<rect x="0" y="5" width="1588" height="28" rx="0" ry="0" class="lc-rect lc-highlight-area"></rect>

Which has this CSS:

@layer base
:where(.lc-rect) {
  --fill-color: var(--color-surface-content, currentColor);
  --stroke-color: initial;
  }

If I disable the --fill-color it looks OK again, so maybe it's related to the --color-curface-content variable?

It's just very weird that it behaves differently after building. Any idea what could be happening? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions