Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kersh1337228/react-plots

React components and common JS plotting tools
https://github.com/kersh1337228/react-plots

frontend library react typescript ui

Last synced: about 1 month ago
JSON representation

React components and common JS plotting tools

Awesome Lists containing this project

README

        

# react-plots · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kersh1337228/react-plots/blob/master/LICENSE)
React components and common JS plotting tools.

## Details
### Supported data types
```ts
type PointNumeric = [number, number | null];
type ObjectNumeric = {
timestamp: number;
[ numericType: string ]: number | null;
[ anyType: string ]: any;
};

type PointTimeSeries = [string, number | null];
type ObjectTimeSeries = {
timestamp: string;
[ numericType: string ]: number | null;
[ anyType: string ]: any;
};

interface Quotes extends ObjectTimeSeries {
open: number | null;
high: number | null;
low: number | null;
close: number | null;
volume: number | null;
}
```

### Drawing data
```ts
const sin: PointNumeric[] = [],
cos: PointNumeric[] = [];
for (let i = 0; i < 10; i += 0.1) {
const j = round(i, 1);
sin.push([j, j + Math.sin(j)]);
cos.push([j + 1, Math.cos(j + 1)]);
}

const raw = {
timestamp: ibm.chart.result[0].timestamp,
...ibm.chart.result[0].indicators.quote[0]
};
const quotes = new Array(raw.timestamp.length).fill(0).map((_, i) => {
return {
timestamp: new Date(raw.timestamp[i] * 1000).toLocaleDateString('sv'),
open: raw.open[i],
high:raw.high[i],
low: raw.low[i],
close: raw.close[i],
volume: raw.volume[i]
}
}) as Quotes[];
```

### Component usage
```tsx

















```
### Result
![demo](demo.png)