huww98 / TimeChart

An chart library specialized for large-scale time-series data, built on WebGL.
https://huww98.github.io/TimeChart
MIT License
365 stars 31 forks source link

Point position bug on scale #48

Closed temaivanoff closed 2 years ago

temaivanoff commented 2 years ago

Hi Снимок экрана 2022-08-19 в 15 46 41

huww98 commented 2 years ago

Thank you for your interest. Please attach a dataset so that I can reproduce this.

Also please refer to "Due to the limitation of single-precision floating-point numbers ..." in the README

temaivanoff commented 2 years ago

artifacts:

  1. Hover point position bug
  2. Of drag graph line position artifacts

https://user-images.githubusercontent.com/11176223/185633794-585577dc-9f59-413f-b464-4c5cbdfbe0e9.mov

if generate long range period 2023 - 2028 (20k points) have artifacts. var timeStep = 1000000;

https://user-images.githubusercontent.com/11176223/185633836-5c94424a-d3a1-4475-afd1-48e4d6a476e7.mov

if generate period one mount (20k points) - no artifacts var timeStep = 10000;


    const data = [];

    let y = 10;
    let timeStep = 1000000;

    for (let x = 0; x < 200000 * timeStep; x = x + timeStep) {
      data.push({ x: x, y: y });
      y = y + 10;

      if (y > 100) {
        y = 0;
      }
    }

    const chart = new TimeChart(el, {
      baseTime: Date.now(),
      series: [
        { name: 'Line 1', data: data, color: 'blue' },
      ],
      plugins: {
          lineChart,
          d3Axis,
          legend,
          crosshair,
          nearestPoint,
          zoom: new TimeChartZoomPlugin({ x: { autoRange: true } }),
      },
      tooltip: true,
      renderPaddingLeft: 45,
    });
`
huww98 commented 2 years ago

Hi @fast0490f . I've identified and fixed the main source of precision loss. Please see https://huww98.github.io/TimeChart/demo/large_data_range.html. Dragging is still not perfectly smooth if you zoom in enough. But it is a lot better.

I think this is enough for you. Please let me know if not.

temaivanoff commented 2 years ago

Hi @huww98 I test mobile phone, it’s work great 👍 Very thanks 🙏