• Stars
    star
    866
  • Rank 52,675 (Top 2 %)
  • Language
    JavaScript
  • License
    Other
  • Created about 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Declarative and modular timeseries charting components for React

logo

React Timeseries Charts

Build Status npm version

Zooming

This library contains a set of modular charting components used for building flexible interactive charts. It was built for React from the ground up, specifically to visualize timeseries data and network traffic data in particular. Low level elements are constructed using d3, while higher level composability is provided by React. Charts can be stacked as rows, overlaid on top of each other, or any combination, all in a highly declarative manner.

The library is used throughout the public facing ESnet Portal.

Current features of the library include:

  • Declarative layout of charts using JSX
  • Interactivity, including pan and zoom
  • Add new chart types or overlays
  • Multiple axis, multiple rows
  • Line, area, scatter, bar and boxplot charts
  • Brushing
  • Legends
  • Overlay markers

Please browse the examples for a feel for the library.

Getting started

This charts library is intended to be installed with npm and the built into your project with a tool like Webpack. It expects React to be present, as well as our TimeSeries abstraction library, pond.js. More on this below. To install:

npm install react-timeseries-charts pondjs --save

Once installed, you can import the necessary components from the library:

import { Charts, ChartContainer, ChartRow, YAxis, LineChart } from "react-timeseries-charts";

Then we construct our chart in the render() function of our component. For a simple example we create a chart with two line charts on it, specified in JSX:

<ChartContainer timeRange={series1.timerange()} width={800}>
    <ChartRow height="200">
        <YAxis id="axis1" label="AUD" min={0.5} max={1.5} width="60" type="linear" format="$,.2f"/>
        <Charts>
            <LineChart axis="axis1" series={series1}/>
            <LineChart axis="axis2" series={series2}/>
        </Charts>
        <YAxis id="axis2" label="Euro" min={0.5} max={1.5} width="80" type="linear" format="$,.2f"/>
    </ChartRow>
</ChartContainer>

At the outer most layer, we add a <ChartContainer> which contains our time range for the x-axis. All charts within a ChartContainer share the same x-axis. In this case we get the TimeRange from the TimeSeries itself, but you could specify one yourself. You also need to provide a width for the chart, or wrap the chart in a <Resizable> component and that will inject a width for you.

For the next layer of the layout we make a <ChartRow>. We can have multiple charts stacked on top of each other by using more than one row. In this case we just have one row. Each row has a specific height in the layout, so we specify that as 200px high here.

Next up we want to put something in our row. Rows contain two parts:

  1. a central flexible sized area in which charts can be added and
  2. axes on either the left or right of the central area.

This central area is surrounded in the JSX by the <Charts> tag. Each chart in this area is composited on top of each other. In this case we are adding two <LineChart>s, one for each of our timeseries. As a result they will be drawn on top of each other. (Note that as of v0.9, it is also possible to draw multiple channels of a TimeSeries as multiple line charts). For scaling each chart will reference an axis that will define the scale as well as display that scale visually as the y-axis.

Finally, we specify the axes that the charts reference. These go either before or after the <Charts> group, depending on if you want the axis before (to the left) or after the charts (to the right). You can specify any number of axes on either side. For each <YAxis> you specify the id so that a chart can reference it, the label you want displayed alongside the axis and, importantly, the scale using min and max. You can also specify the type of the axis (linear, log, etc), a non-default width and the format.

For more details, please see the API docs.

Data format

This charting library is built on the ESnet timeseries library called pond.js. Pond.js was created to provide a common representation for things like time series, time ranges, events and other structures as well as to implement common operations on those structures.

For the purpose of using the charting library, you need to create a TimeSeries object as your time series, which will be rendered by the chart code. Constructing a TimeSeries is pretty simple. You just need to pass it an object that contains, at a minimum, the column names as an array, and a list of points.

For example:

import { TimeSeries, TimeRange } from "pondjs";

const data = {
    name: "traffic",
    columns: ["time", "in", "out"],
    points: [
        [1400425947000, 52, 41],
        [1400425948000, 18, 45],
        [1400425949000, 26, 49],
        [1400425950000, 93, 81],
        ...
    ]
};

const timeseries = new TimeSeries(data);

Generally columns must have 'time' as the first column (see the Pond.js docs for other options), and points is of the format:

[[time, value], [time, value], ...]

Note that there are several ways to construct a TimeSeries. The above is what we call our wire format.

To specify a ChartContainer you also need to provide the time range to plot on the x-axis. This is done with a pond.js TimeRange. You could either get the TimeRange from the TimeSeries directly:

var timerange = timeseries.timerange()

Or construct a new one:

var timerange = new TimeRange([begin, end]);

where begin and end are times (Javascript Dates, usually).

How you manage this is application specific. We often have pages where the current time range being shown is kept in the this.state of the component and is updated during pan and zoom, both via interaction with the charts or via other controls on the page.

Developing

The repo contains the examples website. This is very helpful in developing new functionality. Within a cloned repo, you first need to run:

yarn install

This will install the development dependencies into your node_modules directory.

You can then start up the test server:

npm run start-website

Then, point your browser to:

http://localhost:3000/

Before submitting a Pull Request, run:

npm run build

In case you want to demonstrate an issue with the library via an example, you can use CodeSandBox.

A simple BarChart example has been built here - https://codesandbox.io/s/3j0540mo5

Supported Browsers

The most recent release of Firefox or Chrome is recommended.

Thanks

Thanks to Chromatic for providing the visual testing platform that help us catch unexpected changes on time.

License

This code is distributed under a BSD style license, see the LICENSE file for complete information.

Copyright

ESnet's React Timeseries Charts, Copyright (c) 2015 - present, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Technology Transfer Department at [email protected].

NOTICE. This software is owned by the U.S. Department of Energy. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from the U.S. Department of Energy, and subject to any subsequent five (5) year renewals, the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.

More Repositories

1

iperf

iperf3: A TCP, UDP, and SCTP network bandwidth measurement tool
C
6,808
star
2

gdg

Grafana Dashboard Manager
Go
336
star
3

pond

Immutable timeseries data structures built with Typescript
TypeScript
205
star
4

react-network-diagrams

Contains ESnet network mapping and circuit rendering code, as used in the ESnet portal.
JavaScript
195
star
5

esnet-smartnic-hw

ESnet SmartNIC hardware design repository.
SystemVerilog
39
star
6

react-dynamic-forms

Dynamic forms library for React
JavaScript
36
star
7

dpdk-plugin

C++
23
star
8

xilinx-tools-docker

Docker image containing Xilinx build tools
Dockerfile
20
star
9

EScp

EScp is a high performance transfer tool that uses a command line interface similar to scp.
Rust
17
star
10

zeek-exporter

Prometheus Exporter for Zeek
C++
17
star
11

enos

ESnet Network Operating System (NOT ACTIVELY MAINTAINED)
Python
15
star
12

zeek-dpdk

11
star
13

grafana-esnet-networkmap-panel

A geographic bidirectional network map based on d3 and leaflet
JavaScript
11
star
14

oscars

Java
11
star
15

esnet-fpga-library

ESnet general-purpose FPGA design library.
SystemVerilog
10
star
16

esnet-perfsonar-mesh

Shell
9
star
17

react-axis

Axis components built for React
JavaScript
9
star
18

TCP-monitor

Simple Python Program to monitor TCP sockets
Python
8
star
19

esnet-smartnic-fw

ESnet SmartNIC firmware design repository.
C
7
star
20

react-timeseries-barchart

A horizontal barchart that summarizes a list of TimeSeries objects
JavaScript
7
star
21

simple-lookup-service

sLS code
Java
7
star
22

docker

Files for various Science DMZ use cases. This repository is no longer being maintained and serves as an example only.
7
star
23

netshell

Kernel and companion software that support ENOS applications (NOT ACTIVELY MAINTAINED)
Java
6
star
24

react-timeseries-table

Got a TimeSeries? Build a Table.
JavaScript
6
star
25

mini-portal

Demonstration of toolkits used to build the MyESnet portal.
JavaScript
5
star
26

sense-rtmon

Custom Scripts for Dynamic End-To-End Flow-Specific Grafana Dashboards
Python
5
star
27

sans-holiday-hack-2018

ESnet Security Team's SANS Holiday Hack 2018 Report
HTML
5
star
28

pypond

A python library to manipulate and transmit time-series data.
Python
5
star
29

nml-mrml

MRML: Multi-Resource Markup Language - Modeling Schemas and Tools
Java
5
star
30

cookiecutter-zeekpackage

Cookiecutter template for Zeek packages
Python
5
star
31

arborq

Python library for querying Arbor PeakFlow devices.
Python
4
star
32

netgraf

Real-time network monitoring tool that uses machine learning
Jupyter Notebook
4
star
33

xilinx-qdma-for-opennic

Variant of Xilinx QDMA IP Drivers for DPDK that is compatible with Xilinx opennic-shell.
C
4
star
34

smartnic-dpdk-docker

Docker container with dpdk + xilinx qdma + pktgen-dpdk for use in high speed test setups
Dockerfile
4
star
35

ansible_network_capture

Jinja
3
star
36

eZeeKonfigurator

Web-based configuration for your Zeek clusters
Python
3
star
37

sense-rm

SENSE Resource Manager
Java
3
star
38

shibboleth_session_auth

Simplistic Shibboleth integration with Django sessions
Python
3
star
39

esnet-arcdiagram-panel

An arch diagram panel plugin for Grafana
TypeScript
2
star
40

indira_networkIntent

Python
2
star
41

calibers

Exploring shaping traffic at the edge of the network
Jupyter Notebook
2
star
42

oscars-frontend

JavaScript
2
star
43

hylia_networkprediction

Jupyter Notebook
2
star
44

oscars-topology-json

Publishes the OSCARS NMWG topology and list of circuits in a JSON format
Python
2
star
45

regio

Tools for working with FPGA register maps (including code generators for C and SystemVerilog interfaces).
Python
2
star
46

workflow-databooks

Repository of sample data related to distributed data workflows for scientific research. Data is explained and exercise through a set of Jupyter notebooks. Anyone is invited to share relevant date, including all aspects of workflows, including but not limited, WAN, LAN, I/O, CPU, memory.
Jupyter Notebook
2
star
47

hps-rl

Hyperparameter tuning for deep RL applications
Python
1
star
48

xilinx-labtools-docker

Docker image to provide Xilinx LabTools
Dockerfile
1
star
49

testing-harness

A harness for executing jobs across multiple hosts and collecting output.
Jupyter Notebook
1
star
50

netpredict

Real-time network traffic prediction with deep learning
Jupyter Notebook
1
star
51

esviz

DEPRECATED. ESnet charts visualizations can be found at react-timeseries-charts.
JavaScript
1
star
52

docker-tooling

Misc tools that can be in your $PATH to make life easier
Shell
1
star
53

esnet-matrix-panel

TypeScript
1
star
54

zeek_perfsonar_owamp

OWAMP protocol analyzer plugin for Bro/Zeek
JavaScript
1
star
55

arista-tapagg-ansible

HTML
1
star
56

hhc19

SANS Holiday Hack 2019
HTML
1
star
57

sense-nrm-oscars

Python
1
star
58

stardust-snmp-pipeline

The data processing pipeline the ESnet Stardust project uses to enrich data collected from SNMP.
Ruby
1
star
59

janus-client

Python
1
star
60

simpleML4Networks

examples for trying out multiple machine learning on network data sets
Jupyter Notebook
1
star