Demo - Annotations

HTML

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.input.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.chart.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.chart.annotation.min.js"></script>
<div class="container">

  <h1>
    Annotations
  </h1>

  <p>
    Annotations are extra elements displayed over the chart to
    highlight notable points or areas on the chart.</p>
  <p>
    To add annotations to a FlexChart, create an <b>annotationLayer</b> 
    attached to the chart and populate it with annotation objects.</p>
  <p>
    There are several types of annotation objects, including
    Rectangle, Square, Circle, Ellipse, Line, Polygon, Image, and
    Text. They may be attached to data points or to arbitrary
    points in data or page coordinates.</p>
  <p>
    The chart below has an Ellipse annotation attached to data 
    point 15 and a Line annotation attached to the month of 
    February:</p>    
    
  <div id="theChart"></div>
</div>

CSS

.wj-flexchart {
  height: 300px;
}
.wj-control {
  margin-bottom: 6px;
}

body {
  margin-bottom: 24pt;
}

JavaScript

onload = function() {

  // create the chart
  var theChart = new wijmo.chart.FlexChart('#theChart', {
    itemsSource: getData(),
    bindingX: 'vol',
    chartType: 'Candlestick',
    legend: { position: 'None' },
    series: [
    	{ binding: 'low,high,open,close', name: 'Alphabet Inc' }
		]
  });

	// add annotation layer
  var annotations = new wijmo.chart.annotation.AnnotationLayer(theChart, [
    { // show a trendline between Jan 31 and Feb 27
    	type: 'Line',
    	tooltip: 'This is a <b>Line</b><br/>annotation', 
      position: 'Center',
      content: 'There should be content here',
      attachment: 'DataCoordinate',
			start: { x: 1000000, y: 810 },
    	end: { x: 3000000, y: 840 },
    	style: { stroke: 'darkgreen', strokeWidth: 4, opacity: .5 }
    }
  ]);

  // some stock data from Google Finance
  function getData() {
    return [
			{ date: new Date(2017,2,15), open: 867.94, high: 869.88, low: 861.3, close: 868.39, vol: 1332885},
			{ date: new Date(2017,2,14), open: 863.75, high: 867.58, low: 860.13, close: 865.91, vol: 1061692},
			{ date: new Date(2017,2,13), open: 860.83, high: 867.13, low: 860.82, close: 864.58, vol: 1166605},
			{ date: new Date(2017,2,10), open: 862.7, high: 864.23, low: 857.61, close: 861.4, vol: 1336585},
			{ date: new Date(2017,2,9), open: 853.69, high: 860.71, low: 852.67, close: 857.84, vol: 1347697},
			{ date: new Date(2017,2,8), open: 853.12, high: 856.93, low: 851.25, close: 853.64, vol: 1029834},
			{ date: new Date(2017,2,7), open: 847.26, high: 853.33, low: 845.52, close: 851.15, vol: 1038696},
			{ date: new Date(2017,2,6), open: 846.86, high: 848.94, low: 841.17, close: 847.27, vol: 1047872},
			{ date: new Date(2017,2,3), open: 848.94, high: 850.82, low: 844.7, close: 849.08, vol: 1006612},
			{ date: new Date(2017,2,2), open: 856.31, high: 856.49, low: 848.72, close: 849.85, vol: 1250938},
			{ date: new Date(2017,2,1), open: 851.38, high: 858, low: 849.02, close: 856.75, vol: 1818671},
			{ date: new...