JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q45926F
  • License MIT

plot inside a video

Package Exports

  • videoplot

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (videoplot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Videoplot

npm install videoplot

Example

First example Second example
Example video Example video

Usage

const Videoplot = require('videoplot');

var plot = new Videoplot({ w:600, h:600, duration: 30, fps: 8 });

// create random data
const y = [];
for(var i = 0; i< 10; i++){
    y.push(Math.random());
}

// chartjs dataset format

const datasets = [];
datasets.push({
    label : "graph",
    borderColor: "#FFFFFF",
    backgroundColor: "#888888",
    fill: false,
    data : y
});

// chartjs dataset format
plot.drawVideoChart({
        type: 'line',
        wScale: 4,
        data: {
            datasets : datasets
        },
        options: {
            elements: {
                point : {
                    pointStyle : 'line'
                }
            },
            scales: {
                xAxes: [{
                    ticks: {
                        display: false
                    }
                }],
                yAxes: [{
                    ticks: {
                        display: false,
                        beginAtZero: true,
                        suggestedMax: 1
                    }
                }],
            }
        }
})
.then(() => {
    console.log("Chart is created");
    // chart is created
    return plot.writeVideoToFile({filename: './examples/example.gif'});
    //return plot.getVideoStream('image/gif');
})
.catch(err => {
    console.error("Error : ", err)
})
.then(() => {
    console.log("Chart is saved into ./examples/example.gif");
})

TO DO

  • better x scale management (labels ...)
  • more chartjs options handling
  • video output handling

Thanks

thanks to fluent-ffmpeg and chartjs-node