Skip to content

[BUG] Line chart connects points between different groups #45

@spren9er

Description

@spren9er

Describe the bug

When grouping line charts via z, some lines are drawn where there should be none.
It seems to happen only in case of single element groups.

To Reproduce

Consider following example:

<script>
  import { Plot, Line } from 'svelteplot';
</script>

<Plot>
  <Line
    data={[{ x: 1, y: 1 }, { x: 1, y: 3 }, { x: 2, y: 5 }, { x: 3, y: 2 }]}
    x="x"
    y="y"
    z="x"
    marker={true}
  />
</Plot>

It connects dots from group 2 and 3.

Image

See also https://svelte.dev/playground/f9a5cd905657450c9f6d7e935d5365f6?version=5.30.2

Expected behavior

Lines should only be drawn within a z group, not between them.

Here is corresponding example in Observable Plot

Plot.line(
  [{ x: 1, y: 1 }, { x: 1, y: 3 }, { x: 2, y: 5 }, { x: 3, y: 2 }],
  { x: "x", y: "y", z: "x", marker: true }
).plot()

and its output

Image

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy