1.5.3 • Published 1 year ago

canvasjs-technical-indicators v1.5.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CanvasJS Technical Indicators

This plugin allows you to add technical indicators to CanvasJS Charts & StockCharts. Check out Demo.

Options

#OptionDescriptionOptions / Examples
1enabledBoolean Denoting if the indicator is enabled or nottrue, false
2linkedDataSeriesIndexTo which Series does the Indicator is linked to0, 1, etc.
3periodDuration of Moving Average5, 7, etc.
4colorColor of the Dataseries"#000", "red", etc.
5showInLegendBoolean denoting if the indicator name should be shwon in legend or nottrue, false
6nameName of the Dataseries"SMA", "EMA", etc.

Importing Script

/* HTML Script Tag */
<script src="/dist/canvasjs-technical-indicators.min.js"></script>

/* React Apps */
import CanvasJSReact from './canvasjs.react';
window.CanvasJS = CanvasJSReact.CanvasJS;
require('canvasjs-technical-indicators');

How to Use?

  • Enable all the Technical Indicators under Chart-Options
  • Render the chart
/* Chart */
var chart = new CanvasJS.Chart("chartContainer", {
.
.
.
technicalIndicators: {
	sma: {
		enabled: true,
		linkedDataSeriesIndex: 0,
		period: 7,
		color: "green",
		showInLegend: true,
		name: "SMA"
	},
	ema: {
		enabled: true,
		linkedDataSeriesIndex: 0,
		period: 7,
		color: "red",
		showInLegend: true,
		name: "EMA"
	}
},
//Chart Options
.
.
.
});
chart.render();

/* StockChart */
var stockChart = new CanvasJS.StockChart("chartContainer", {
.
.
.
technicalIndicators: {
	sma: {
		enabled: true,
		linkedChartIndex: 0,
		linkedDataSeriesIndex: 0,
		period: 7,
		color: "green",
		showInLegend: true,
		name: "SMA"
	},
	ema: {
		enabled: true,
		linkedChartIndex: 0,
		linkedDataSeriesIndex: 0,
		period: 7,
		color: "red",
		showInLegend: true,
		name: "EMA"
	}
},
//StockChart Options
.
.
.
});
stockChart.render();

BuyMeACoffee