HelloWorld - Basic chart
This is the jsfiddle implementation of helloworld.html
by sonylnagale
HTML
<link rel="stylesheet" type="text/css" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css" media="screen" />
<div class="chartContainer" style="width:100%;height:400px;position:relative;"></div>
JavaScript
import { CIQ } from "https://jsfiddle.chartiq.com/chart/js/advanced.js";
import sampleData from "https://jsfiddle.chartiq.com/chart/examples/data/STX_SAMPLE_5MIN.js";
// Declare a CIQ.ChartEngine object.
// This is the main object for drawing charts.
// Here is where you set all required defaults.
const stxx = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer"),
layout: {
"chartType": "candle",
"crosshair": true,
"candleWidth": 30,
"periodicity": 1,
"interval": 'minute',
},
preferences: {
"currentPriceLine": true,
labels: true
},
chart: {
yAxis: {
drawPriceLabels: false
}
}
});
//Now load a chart with it's data
stxx.loadChart(
"SPY", sampleData,
() => {
CIQ.Studies.addStudy(stxx, "Bollinger Bands")
CIQ.Studies.addStudy(stxx, "Bollinger Bands",null, null, null, "new")
}
);