Marker Consolidation Test

by sonylnagale

HTML

<link rel="stylesheet" type="text/css" href="https://jsfiddle.chartiq.com/chart/css/stx-chart.css" media="screen" />
<link rel="stylesheet" type="text/css" href="https://jsfiddle.chartiq.com/chart/css/chartiq.css" media="screen" />

<div class="chartContainer" style="width:100%;height:400px;position:relative;"></div>

JavaScript

import { CIQ } from "https://jsfiddle.chartiq.com/chart9.2.0/js/standard.js";
import sampleData from "https://jsfiddle.chartiq.com/chart/examples/data/STX_SAMPLE_DAILY.js";

// Activate the License Key
import getLicenseKey from "https://jsfiddle.chartiq.com/chart/key.js";
getLicenseKey(CIQ);


import quoteFeedSimulator from "https://jsfiddle.chartiq.com/chart9.2.0/examples/feeds/quoteFeedSimulator.js";

const stxx = new CIQ.ChartEngine({
  container: document.querySelector(".chartContainer")
});

stxx.attachQuoteFeed(quoteFeedSimulator, { refreshInterval: 1 });

const dt1 = new Date("2024-04-02 00:00:00");
const dt2 = new Date("2024-04-02");

function showEvents(newDate = false) {

  var datum = {
		type: "circle",
		headline: "This is a Marker for a Split",
		category: "split",
		story: "This is the story of a split",
  };
  // Stack 5 on last candle
    
  for (let i = 0; i < 5; i++) {
		new CIQ.Marker({
      stx: stxx,
      xPositioner: "date",
      x: (newDate) ? dt2 : dt1,
      label: "events",
      node: new CIQ.Marker.Simple(datum)
    });
  }
}

stxx.loadChart("SPY", () => {
	showEvents(false);    // flip to false to see behavior
});