Skip to content

ArcChart renders grid lines by default (grid not disabled) #869

@Stadly

Description

@Stadly

Description

ArcChart renders Y-axis grid lines by default because it passes axis={false} to the underlying Chart component but does not disable grid.

In ChartChildren.base.svelte, grid defaults to true:

grid = true,

And is rendered when truthy:

{:else if grid}
  <Grid
    x={context.valueAxis === 'x' || context.radial}
    y={context.valueAxis === 'y' || context.radial}
    {...getObjectOrNull(grid)}
    {...props.grid}
  />
{/if}

Since ArcChart.base.svelte only sets axis={false} on the Chart, the grid still renders — producing horizontal lines behind the arcs.

Reproduction

<ArcChart
  label="browser"
  value="visitors"
  outerRadius={-17}
  innerRadius={-12.5}
  maxValue={275}
  series={[
    { key: "chrome", color: "red", data: [{ browser: "chrome", visitors: 275 }] },
    { key: "safari", color: "blue", data: [{ browser: "safari", visitors: 200 }] },
  ]}
/>

This renders <g class="lc-grid"><g class="lc-grid-y"> with several <line> elements.

Expected

No grid lines rendered for ArcChart (same as PieChart behavior).

Workaround

<ArcChart ... props={{ grid: { x: false, y: false } }} />

Suggested fix

In ArcChart.base.svelte, pass grid={false} to the <Chart> component (similar to how axis={false} is already passed).

Version

layerchart@2.0.0-next.63

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