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

Onrefresh function is not calling ..i cant see console.log in browser #79

Closed
maniprasad opened this issue Jun 10, 2019 · 3 comments
Closed
Assignees
Labels

Comments

@maniprasad
Copy link

maniprasad commented Jun 10, 2019

this.datasets = [{
  label: 'Dataset 1 (linear interpolation)',
  backgroundColor: "red",
  borderColor: "yellow",
  fill: false,
  lineTension: 0,
  borderDash: [8, 4],
  data: [
    {y: 0.74, x: 1558531380957},
    {y: 0.96, x: 1558531379950},
    {y: 1.08, x: 1558531378942},
    {y: 1.11, x: 1558531377939},
  ]
}, {
  label: 'Dataset 2 (cubic interpolation)',
  backgroundColor: "pink",
  borderColor: "green",
  fill: false,
  cubicInterpolationMode: 'monotone',
  data:[{y: 0.74, x: 1558531380957},
    {y: 0.96, x: 1558531379950},
    {y: 4.08, x: 1558531378942},
    {y: 0.11, x: 1558531377939},
    {y: 0.13, x: 1558531376932},
  ]
}];
this.options =  {
  scales: {
    xAxes: [{
      type: 'time',
      realtime: {
        duration: 20,
        refresh: 1000,
        delay: 1000,
        pause: false,
        ttl: undefined,
        // a callback to update datasets
        onRefresh: (chart: any) => {
          console.log("chart");
          // append the new data array to the existing chart data
          // Array.prototype.push.apply(chart.data.datasets[0].data, data);
        }
      }
    }]
  },
  plugins: {
    streaming: {            // per-chart option
      frameRate: 30       // chart is drawn 30 times every second
    }
  }
};
@maniprasad
Copy link
Author

plz , help me to fix this..

@maniprasad maniprasad changed the title Ornrefresh is not calling Onrefresh function is not calling ..i cant see console.log in browser Jun 10, 2019
@nagix
Copy link
Owner

nagix commented Jun 15, 2019

Your configuration works as expected generating log output (see https://jsfiddle.net/nagix/azownchs/).
By the way, duration is in millisecond, so 20 is too small to see. Try to set it to 20000.

@nagix nagix self-assigned this Jun 15, 2019
@nagix nagix added the question label Jun 15, 2019
@nagix
Copy link
Owner

nagix commented Jun 13, 2021

Closing as answered.

@nagix nagix closed this as completed Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants