An open API service indexing awesome lists of open source software.

https://github.com/deftio/plotly-streaming-charts-demo

Simple streaming scrolling charts in javascript using plotlyjs
https://github.com/deftio/plotly-streaming-charts-demo

Last synced: 4 months ago
JSON representation

Simple streaming scrolling charts in javascript using plotlyjs

Awesome Lists containing this project

README

          

# Streaming / Scrolling Charts Demo

Quick repo for wrapping plotly.js into simple streaming and scrolling charts.

See live demo here [streaming charts](https://deftio.github.io/plotly-streaming-charts-demo/)

![](./assets/sample-charts.png)

## Usage
See basic.html for a simple example or index.html for 2 charts running with different update rates inside some boxes (shown above)

BSD-2 license (see LICENSE.TXT)

If python3 is installed one can run a local webserver via:
```bash
python3 -m http.server 8000
```
Then open a browser window at localhost:8000

Otherwise this should also work as a file:// url

### Example code snippet
```html

Real-Time Chart with Plotly.js

// sample simulated data
function getData() {
return Math.random()-0.5;
}

// make a new chart
newPlotlyLineChart(
"chart", // dom id of chart
2, // number of traces (can be 1 to any)
{yaxis:{range:[-1,1]}} // optional layout (see plotlyjs docs)
);

// set interval updates the chart by calling getData() every
setInterval(
function(){
updatePlotlyLineChart("chart",[getData(),getData()]); // update chart
},
25 // every 25 milliseconds this is called
);

```