Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vegaprotocol/pennant
A charting library for Vega Console
https://github.com/vegaprotocol/pennant
chart charting-library react vega-protocol
Last synced: about 2 months ago
JSON representation
A charting library for Vega Console
- Host: GitHub
- URL: https://github.com/vegaprotocol/pennant
- Owner: vegaprotocol
- License: mit
- Created: 2021-02-15T15:28:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-31T23:04:03.000Z (2 months ago)
- Last Synced: 2024-11-01T00:17:29.841Z (2 months ago)
- Topics: chart, charting-library, react, vega-protocol
- Language: TypeScript
- Homepage: https://pennant.vega.xyz
- Size: 11 MB
- Stars: 29
- Watchers: 16
- Forks: 8
- Open Issues: 52
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![CI status](https://github.com/vegaprotocol/pennant/actions/workflows/test.yml/badge.svg)](https://github.com/vegaprotocol/pennant/actions/workflows/test.yml)
[![GitHub license](https://img.shields.io/npm/l/pennant?style=plastic)](https://github.com/vegaprotocol/pennant/blob/main/LICENSE)
[![NPM](https://img.shields.io/npm/v/pennant?style=plastic&color=green)](https://npmjs.com/package/pennant/)
Pennant
A React component library for visualising historical and streaming financial market data.
View Demo
·
Report Bug
·
Request Feature
Table of Contents
## About The Project
A React chart component visualising historical and streaming financial market data. Built for the Vega platform but can be embedded in any application.
## Getting Started
Pennant is available from npm.
### Prerequisites
Pennant has `react` and `react-dom` as peer dependencies.
```sh
yarn add react react-dom
```### Installation
```sh
yarn add pennant
```## Usage
```jsx
import React from "react";
import { CandlestickChart } from "pennant";const dataSource = new DataSource();
const options = {
chartType: "candle",
studies: [],
overlays: [],
};export const App = () => (
);
```The minimum props required are:
- dataSource
- options
- interval### Styling pennant
You may customize the styling of pennant components by overriding the default CSS variables.
```css
/**
* You can override the default pennant variables.
* Note: this is not a complete list of --pennant- variables.
*/
:root {
--pennant-color-success: #26ff8a;
--pennant-color-danger: #ff261a;
}
```## Data
Pennant displays financial data using a DataSource object you pass as a prop to the React CandlestickChart component. This object must implement the DataSource interface, and typically takes the form of a class.
It provides a set of methods such as `query` and `subscribe` which will be called by the chart to get historical and streaming data respectively.
Several reference implementations are provided.
## Contributing
### Development
We use [Storybook](https://storybook.js.org/).
```sh
yarn storybook
```Open [http://localhost:6006](http://localhost:6006) to view in the browser.
We try our best to follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This lets use [standard-version](https://github.com/conventional-changelog/standard-version) for semantic versioning and CHANGELOG generation.
### Building
To build the library run
```sh
yarn build
```The output can be found in the `dist` directory.
### Testing
To run the tests
```sh
yarn test
```### Releasing a new version
We use [standard-version](https://github.com/conventional-changelog/standard-version) for semantic versioning and CHANGELOG generation.
As long as your git commit messages are conventional and accurate, you no longer need to specify the semver type. It will be calculated for you.
An npm script is provided for convenience.```sh
yarn release
```If successful you can push up the new commit and tag with
```sh
git push --follow-tags origin main
```To release as a pre-release use the flag `--prerelease`.
```sh
yarn release -- --prerelease alpha --release-as minor
```### Adding a new chart type
Add the new chart type in `chart-types.ts`. Add a new case in `helpers-spec.ts` which specifies how to draw the new chart type.
## License
Pennant is available under the [MIT license](https://opensource.org/licenses/MIT).