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

Method append doesn't work #86

Closed
felipefonsecabh opened this issue Sep 2, 2017 · 7 comments
Closed

Method append doesn't work #86

felipefonsecabh opened this issue Sep 2, 2017 · 7 comments

Comments

@felipefonsecabh
Copy link

felipefonsecabh commented Sep 2, 2017

Hi, i try to use Smoothie, but the append method doesn't work.

I make the initializations in document.ready method:

$(document).ready(function(){
        var smoothie = new SmoothieChart({
        millisPerPixel:51,
        //maxValueScale:1.40,
        //minValueScale:1.37,
        interpolation:'linear',
        //scaleSmoothing:0.035,
        grid:{
            fillStyle:'#ffffff',
            strokeStyle:'rgba(119,119,119,0.90)',
            sharpLines:true,
            millisPerLine:4000,
            verticalSections:13
        },
        labels:{fillStyle:'#000000'},
        tooltip:true,
        timestampFormatter:SmoothieChart.timeFormatter
        //maxValue: 40,
        //minValue: 10
        });
       var Temp1 = new TimeSeries();
       smoothie.addTimeSeries(Temp1,{lineWidth:2,strokeStyle:'#214dbe'});
       smoothie.streamTo(document.getElementById('schart'),158);
       setInterval(refreshCharts,800,areaChartInstance,Temp1);
});

function refreshCharts(Temp1){
   //get time and y value
   Temp1.append(new Date.getTime(), y);
}

Is any wrong?

@drewnoakes
Copy link
Collaborator

What is refreshCharts?

@felipefonsecabh
Copy link
Author

I fix the code. RefreshCharts is the function called in setinterval.
I make a test now print the length of timeseries. It always shows 0.

@drewnoakes
Copy link
Collaborator

Should you be passing areaChartInstance to setInterval?

@felipefonsecabh
Copy link
Author

I do some other stuff in document.ready and in refreshcarts. I put here a part of code, to facilitate the analysys.

@drewnoakes
Copy link
Collaborator

I think Temp1 ends up being areaChartInstance, not your time series.

At any rate, append works correctly. You have a bug in your code.

@felipefonsecabh
Copy link
Author

The problem was a format Datetime. Do you have a source code of a responsive example? In site doesn't have the file.
Sorry for my mistake.

@drewnoakes
Copy link
Collaborator

Include {responsive:true} in your chart options.

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

2 participants