Multiple charts with quotefeed
This jsfiddle illustrates how to implement multiple charts on one page using the quoteFeed
by ChartIQ Library
HTML
<link rel="stylesheet" type="text/css" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css" media="screen" />
<div class="chartContainer1" style="width:100%;height:150px;position:relative;"></div>
<div class="chartContainer2" style="width:100%;height:150px;position:relative;"></div>
<div class="chartContainer3" style="width:100%;height:150px;position:relative;"></div>
CSS
/* turn off zoom buttons
#chartSize {
display: none;
}
*/
/* don't display the symbol label
.stx-panel-title {
display: none;
}
*/
JavaScript
import { CIQ } from "https://jsfiddle.chartiq.com/chart/js/advanced.js";
import quoteFeedSimulator from "https://jsfiddle.chartiq.com/chart/examples/feeds/quoteFeedSimulator.js";
// Activate the License Key
import getLicenseKey from "https://jsfiddle.chartiq.com/chart/key.js";
getLicenseKey(CIQ);
const stxx1 = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer1"),
layout: {
"chartType": "candle"
}
});
const stxx2 = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer2"),
layout: {
"chartType": "line"
}
});
const stxx3 = new CIQ.ChartEngine({
container: document.querySelector(".chartContainer3"),
layout: {
"chartType": "mountain"
}
});
stxx1.attachQuoteFeed(quoteFeedSimulator, {
refreshInterval: 10
});
stxx2.attachQuoteFeed(quoteFeedSimulator, {
refreshInterval: 10
});
stxx3.attachQuoteFeed(quoteFeedSimulator, {
refreshInterval: 10
});
stxx1.loadChart("SPY", {
periodicity: {
period: 1,
interval: 5
}
});
stxx2.loadChart("IBM", {
periodicity: {
period: 1,
interval: 10
}
});
stxx3.loadChart("GE", {
periodicity: {
period: 1,
interval: 30
}
});