huww98/TimeChart

Point position bug on scale

temaivanoff opened this issue · 4 comments

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

artifacts:

  1. Hover point position bug
  2. Of drag graph line position artifacts
2022-08-19.16.48.27.mov

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

2022-08-19.16.50.35.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,
    });
`

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.

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