Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function() {
var dispatch = d3.dispatch(event.viewChange);
var zeroLine = fc.annotation.line()
.value(0)
.label('');
var renderer = fc.indicator.renderer.macd();
var algorithm = fc.indicator.algorithm.macd();
var chart = base()
.series([zeroLine, renderer])
.yTicks(5)
.mapping(function(series) {
return series === zeroLine ? [0] : this;
})
.decorate(function(g) {
g.enter()
.attr('class', function(d, i) {
return ['multi zero', 'multi'][i];
});
var crosshair = fc.tool.crosshair()
.xLabel('')
.yLabel('')
.on('trackingmove', function(updatedCrosshairData) {
if (updatedCrosshairData.length > 0) {
dispatch.crosshairChange(updatedCrosshairData[0].datum);
} else {
dispatch.crosshairChange(undefined);
}
})
.on('trackingend', function() {
dispatch.crosshairChange(undefined);
});
crosshair.id = util.uid();
var gridlines = fc.annotation.gridline()
.xTicks(0);
var closeLine = fc.annotation.line()
.orient('horizontal')
.value(currentYValueAccessor)
.label('')
.decorate(function(g) {
g.classed('close-line', true);
});
closeLine.id = util.uid();
var multi = fc.series.multi()
.key(function(series) { return series.id; })
.mapping(function(series) {
switch (series) {
case closeLine:
return [this.data[this.data.length - 1]];
.yLabel('')
.on('trackingmove', function(updatedCrosshairData) {
if (updatedCrosshairData.length > 0) {
dispatch.crosshairChange(updatedCrosshairData[0].datum);
} else {
dispatch.crosshairChange(undefined);
}
})
.on('trackingend', function() {
dispatch.crosshairChange(undefined);
});
crosshair.id = util.uid();
var gridlines = fc.annotation.gridline()
.xTicks(0);
var closeLine = fc.annotation.line()
.orient('horizontal')
.value(currentYValueAccessor)
.label('')
.decorate(function(g) {
g.classed('close-line', true);
});
closeLine.id = util.uid();
var multi = fc.series.multi()
.key(function(series) { return series.id; })
.mapping(function(series) {
switch (series) {
case closeLine:
return [this.data[this.data.length - 1]];
case crosshair:
return crosshairData;