Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample not spread over the chart #8

Open
hodbauer opened this issue Jul 11, 2019 · 2 comments
Open

sample not spread over the chart #8

hodbauer opened this issue Jul 11, 2019 · 2 comments

Comments

@hodbauer
Copy link

Hello,
I'm using next versions of chart.js:

chart.js: 2.8.0
chartjs-plugin-zoom: 0.7.0
chartjs-plugin-downsample: 1.1.0

I have the next configuration for my graph:

const config = {
  type: 'line',
  options: {
    downsample: {
      enabled: true
    },
    plugins: {
      zoom: {
        zoom: {
          enabled: true,
          mode: 'x'
        }
      }
    }
  }
}

I create a graph and only after a few milliseconds the data arrived from a server.
I have thousands of points (almost 20K points).

After I update the graph with the data i call chart.update() to render the data.

As I expected, there is only 1000 points that displayed on the canvas, but the points appears only in the beginning of the graph (unfortunately I cannot add snapshot of the situation), it's mean that the x axes has a relevant range for all my points but the data not spread from begin to end.
As a workaround to check what went wrong I call manually to chart.downsample(1000) and then chart.update() and it fix the problem, but I dont think that this should be the solution.

can I get any hint what i do wrong?

@kmlbgn
Copy link

kmlbgn commented Jan 13, 2020

Running into the same problem...
ended up doing the same, stealing the downsample() function, and doing it manually.
Something is not properly behaving in the script.

@AlbinoDrought
Copy link
Owner

I realize this issue was opened quite some time ago, but in case it is still any help, does the newly-added data render as expected if the configuration has preferOriginalData: true?

const config = {
  type: 'line',
  options: {
    downsample: {
      enabled: true,
      preferOriginalData: true,
    },
    plugins: {
      zoom: {
        zoom: {
          enabled: true,
          mode: 'x'
        }
      }
    }
  }
}

I've added a new sample here for #10 (comment) that adds data dynamically and it requires preferOriginalData: true to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants