Chart provides an easy way to plot the outcome of the indicators and the strategies.
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');
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.
The add function is used to add data to the chart.
chart.add({
legend: 'Values',
values: [1, 2, 3, 4],
style: 'blue',
width: 2,
});
The remove function is used to remove data from chart by the given legend value.
const removed = chart.remove(legend);
The draw function is used to draw the added data to the chart.
chart.draw();
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.
Copyright (c) 2022 Onur Cinar. All Rights Reserved.
The source code is provided under MIT License.