Giter VIP home page Giter VIP logo

uplot_jupyter_widget's Introduction

soso.uplot_jupyter_widget

A feature-incomplete Jupyter widget for the incredible uPlot charting library.

Status

This library is really new, don't expect too much but feel free to send pull requests.

Quickstart

$ pip install git+https://github.com/sohailsomani/uplot_jupyter_widget

You may also need to do the following:

$ jupyter nbextension install --py --symlink --sys-prefix jp_proxy_widget
$ jupyter nbextension enable --py --sys-prefix jp_proxy_widget

The following example is taken straight from the documentation. Note that if you wish to evaluate any JS, prefix a string with __js_eval: as shown below.

from soso.uplot_jupyter_widget import uPlotWidget

data = [
  [1546300800, 1546387200],    # x-values (timestamps)
  [        35,         71],    # y-values (series 1)
  [        90,         15],    # y-values (series 2)
]

opts = {
  'title': "My Chart",
  'id': "chart1",
  'class': "my-chart",
  'width': 800,
  'height': 600,
  'series': [
    {},
    {
      # initial toggled state (optional)
      'show': True,

      'spanGaps': False,

      # in-legend display
      'label': "RAM",
      'value': '__js_eval:(self, rawValue) => "$" + rawValue.toFixed(2)',

      # series style
      'stroke': "red",
      'width': 1,
      'fill': "rgba(255, 0, 0, 0.3)",
      'dash': [10, 5],
    }
  ],    
}

plot = uPlotWidget(
  data=data,
  opts=opts,
  js="https://raw.githubusercontent.com/leeoniya/uPlot/1.6.4/dist/uPlot.iife.min.js",
  css="https://raw.githubusercontent.com/leeoniya/uPlot/1.6.4/dist/uPlot.min.css"
)
display(plot)

Results in the following:

See notebooks/notebook.ipynb.

Main Features

  • It supposedly works

Motivation

It didn't exist

Implementation

Use of the excellent jp_proxy_widget library.

uplot_jupyter_widget's People

Contributors

sohailsomani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.