JavaScript
onload = function() {
// create the chart
var theChart = new wijmo.chart.FlexChart('#theChart', {
itemsSource: getData(),
bindingX: 'date',
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: new Date(2017, 0, 31), y: 810 },
end: { x: new Date(2017, 1, 28), 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,...