visjs / vis-timeline

📅 Create a fully customizable, interactive timelines and 2d-graphs with items and ranges.
https://visjs.github.io/vis-timeline/
Other
1.74k stars 302 forks source link

Line graph with binary data [Graph2D] #1785

Open Beregit opened 3 months ago

Beregit commented 3 months ago

I'm looking to create a line graph like the following one but I think that Graph2D does not allow it.

image

I've done the following chart by inserting points with the opposite value 1 second before the real one and using interpolation: false option but this is cheating.

image

      {
        content: "item 0.0",
        x: new Date("2013-04-20 00:00:00"),
        y: 0,
        group: 1,
      },
      {
        content: "item 1.0",
        x: new Date("2013-04-20 10:00:00"),
        y: 0,
        group: 1,
      },
      {
        content: "item 1.1",
        x: new Date("2013-04-20 10:00:01"),
        y: 1,
        group: 1,
      },
      {
        content: "item 2.1",
        x: new Date("2013-04-20 15:00:00"),
        y: 1,
        group: 1,
      },
      {
        content: "item 2.0",
        x: new Date("2013-04-20 15:00:01"),
        y: 0,
        group: 1,
      },
      {
        content: "item 3.0",
        x: new Date("2013-04-20 20:00:00"),
        y: 0,
        group: 1,
      },
    ]