examples/client/client-example.js
function drawChart(canvas, data) {
        var ctx = canvas.getContext('2d'),
            color = 'rgba(0, 0, 0, 0.75)',
            height = canvas.height - 2,
            width = canvas.width,
            total = data.length,
            max = Math.max.apply(Math, data),
            xstep = 1,
            ystep = max / height,
            x = 0,
            y = height - data[0] / ystep;

        ctx.clearRect(0, 0, width, height);
        ctx.beginPath();
        ctx.strokeStyle = color;
        ctx.moveTo(x, y);

        for (var i = 1; i < total; i++) {
            x += xstep;
            y = height - data[i] / ystep + 1;
            ctx.moveTo(x, height);
            ctx.lineTo(x, y);
        }

        ctx.stroke();
    }
function drawChart(canvas, data) {
        var ctx = canvas.getContext('2d'),
            color = 'rgba(0, 0, 0, 0.75)',
            height = canvas.height - 2,
            width = canvas.width,
            total = data.length,
            max = Math.max.apply(Math, data),
            xstep = 1,
            ystep = max / height,
            x = 0,
            y = height - data[0] / ystep;

        ctx.clearRect(0, 0, width, height);
        ctx.beginPath();
        ctx.strokeStyle = color;
        ctx.moveTo(x, y);

        for (var i = 1; i < total; i++) {
            x += xstep;
            y = height - data[i] / ystep + 1;
            ctx.moveTo(x, height);
            ctx.lineTo(x, y);
        }

        ctx.stroke();
    }
function drawChart ( canvas , data ) { var ctx = canvas . getContext ( '2d' ) , color = 'rgba(0, 0, 0, 0.75)' , height = canvas . height - 2 , width = canvas . width , total = data . length , max = Math . max . apply ( Math , data ) , xstep = 1 , ystep = max / height , x = 0 , y = height - data [ 0 ] / ystep ; ctx . clearRect ( 0 , 0 , width , height ) ; ctx . beginPath ( ) ; ctx . strokeStyle = color ; ctx . moveTo ( x , y ) ; for ( var i = 1 ; i < total ; i ++ ) { x += xstep ; y = height - data [ i ] / ystep + 1 ; ctx . moveTo ( x , height ) ; ctx . lineTo ( x , y ) ; } ctx . stroke ( ) ; }
Just a simple chart drawer, not related to SSE-channel
Just a simple chart drawer not related to SSE - channel