Load A Drawing
Sample of how to load a drawing programmatically
by sonylnagale
HTML
<link rel="stylesheet" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css">
<div class="chartContainer" style="width:600px;height:400px;position:relative;"></div>
<script src="https://jsfiddle.chartiq.com/chart/js/chartiq.js"></script>
<script src="https://jsfiddle.chartiq.com/chart/examples/feeds/quoteFeedSimulator.js"></script>
JavaScript
// start the chart engine
var stxx = new CIQ.ChartEngine({
container: $$$(".chartContainer")
});
// attach quoteFeed
stxx.attachQuoteFeed(quoteFeedSimulator, {
refreshInterval: 0
});
// render a chart
stxx.loadChart("AAPL", function() {
stxx.importDrawings([{
"name": "rectangle",
"pnl": "chart",
"col": "auto",
"fc": "#7DA6F5",
"ptrn": "solid",
"lw": 1,
"d0": stxx.chart.dataSegment[stxx.chart.dataSegment.length - 10].Date,
"d1": stxx.chart.dataSegment[stxx.chart.dataSegment.length - 5].Date,
"tzo0": 300,
"tzo1": 300,
"v0": stxx.pixelFrom,
"v1": stxx.chart.yAxis.lowValue+2
}]);
stxx.draw();
});