Socket
Book a DemoInstallSign in
Socket

uplot

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uplot

A small, fast chart for time series, lines, areas, ohlc & bars

1.6.32
latest
Source
npmnpm
Version published
Weekly downloads
186K
-7.06%
Maintainers
1
Weekly downloads
 
Created

What is uplot?

uPlot is a fast, small, and simple charting library for rendering high-performance, interactive charts in the browser. It is designed to handle large datasets efficiently and provides a minimalistic API for creating various types of charts.

What are uplot's main functionalities?

Line Charts

This code demonstrates how to create a simple line chart using uPlot. The chart is configured with a title, dimensions, and a single data series with a blue stroke.

const uPlot = require('uplot');
const data = [
  [0, 1, 2, 3, 4],
  [3, 1, 4, 1, 5]
];
const opts = {
  title: 'Line Chart',
  width: 400,
  height: 300,
  series: [
    {},
    {
      label: 'Data',
      stroke: 'blue'
    }
  ]
};
new uPlot(opts, data, document.body);

Bar Charts

This code shows how to create a bar chart using uPlot. The chart is configured with a title, dimensions, and a single data series with red bars.

const uPlot = require('uplot');
const data = [
  [0, 1, 2, 3, 4],
  [3, 1, 4, 1, 5]
];
const opts = {
  title: 'Bar Chart',
  width: 400,
  height: 300,
  series: [
    {},
    {
      label: 'Data',
      fill: 'red',
      paths: uPlot.paths.bars({ size: [0.6, 0.9] })
    }
  ]
};
new uPlot(opts, data, document.body);

Real-time Data Updates

This code demonstrates how to create a chart that updates in real-time using uPlot. New data points are added every second, and the chart is updated to reflect these changes.

const uPlot = require('uplot');
let data = [
  [0, 1, 2, 3, 4],
  [3, 1, 4, 1, 5]
];
const opts = {
  title: 'Real-time Chart',
  width: 400,
  height: 300,
  series: [
    {},
    {
      label: 'Data',
      stroke: 'green'
    }
  ]
};
const plot = new uPlot(opts, data, document.body);
setInterval(() => {
  data[0].push(data[0].length);
  data[1].push(Math.random() * 10);
  plot.setData(data);
}, 1000);

Other packages similar to uplot

Keywords

micro

FAQs

Package last updated on 14 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.