Skip to content

Latest commit

 

History

History
80 lines (55 loc) · 1.75 KB

README.md

File metadata and controls

80 lines (55 loc) · 1.75 KB

Chart

Chart provides an easy way to plot the outcome of the indicators and the strategies.

Chart Initialization

The Chart is used to draw the plot on a given canvas.

<canvas id="chart"></canvas>
import {Chart} from 'indicatorts';

const chart = new Chart('canvas');

Data Set

The DataSet interface provides the necessary information for ploting the data.

export interface DataSet {
  legend: string,
  values: number[],
  style?: string | string[],
  width?: number,
}

The legend is the legend to display for the data, the values are the data values, the optional style is either a single color, or an array of colors, and the optional width is the width of the line.

Add Data

The add function is used to add data to the chart.

chart.add({
    legend: 'Values',
    values: [1, 2, 3, 4],
    style: 'blue',
    width: 2,
});

Remove Data

The remove function is used to remove data from chart by the given legend value.

const removed = chart.remove(legend);

Draw Chart

The draw function is used to draw the added data to the chart.

chart.draw();

Disclaimer

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

License

Copyright (c) 2022 Onur Cinar. All Rights Reserved.

The source code is provided under MIT License.