leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.51k stars 371 forks source link

weird dataset with single/same timestamps not rendering #861

Closed leeoniya closed 9 months ago

leeoniya commented 9 months ago

not really valid, but should still be render-able. other stuff will probably be broken, tho.

let data = [
  [1686658288174,1686658288174,1686658288174,1686658288174],
  [1,null,null,null],
  [null,2,null,null],
  [null,null,3,null],
  [null,null,null,4],
];

const opts = {
  width: 800,
  height: 600,
  ms: 1,
  scales: {
    x: {
      range: (u, dataMin, dataMax, scaleKey) => {
        console.log('!');
        return [dataMin, dataMax];
      },
    },
  },
  series: [
    {},
    {
      label: "101",
      stroke: 'red',
      points: {
        show: true,
      }
    },
    {
      label: "102",
      stroke: 'blue',
      points: {
        show: true,
      }
    },
    {
      label: "103",
      stroke: 'green',
      points: {
        show: true,
      }
    },
    {
      label: "104",
      stroke: 'magenta',
      points: {
        show: true,
      }
    },
  ],
};

let u = new uPlot(opts, data, document.body);