import { CIQ } from "https://jsfiddle.chartiq.com/chart/js/advanced.js";
// Activate the License Key
import getLicenseKey from "https://jsfiddle.chartiq.com/chart/key.js";
getLicenseKey(CIQ);
// Declare a CIQ.ChartEngine object. This is the main object for drawing charts.
const stxx = new CIQ.ChartEngine({ container: document.querySelector(".chartContainer") });
// Set the periodicity to match what is in your series
stxx.setPeriodicity(1,"day");
// render a chart with no primary series:
stxx.loadBlankChart();
// Now add each series.
// 'shareYAxis' puts each series on the same y-axis
// 'permanent' prevents users from deleting a series by right clicking
stxx.addSeries("AAPL", {
color:"#FF0000",
data:[{Date:"20160210",Close:140},{Date:"20160211",Close:141},{Date:"20160212",Close:141.2},{Date:"20160220",Close:138},{Date:"20160221",Close:141.5}],
shareYAxis:true,
permanent:true
});
stxx.addSeries("SPY", {
color:"#00FF00",
data:[{Date:"20160218",Close:138},{Date:"20161108",Close:137},{Date:"20161109",Close:135}],
shareYAxis:true,
permanent:true
});
stxx.addSeries("GOOG", {
color:"#0000FF",
data:[{Date:"20161022",Close:142},{Date:"20161023",Close:140},{Date:"20161024",Close:141}],
shareYAxis:true,
permanent:true
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!