type: 'line',
data: {
datasets: [{
- data: [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
+ data: [8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8],
pointBorderColor: '#ff0000',
pointBackgroundColor: '#00ff00',
showLine: false
showLine: false
}, {
label: '',
- data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ data: [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
showLine: false
}],
labels: ['', '', '', '', '', '', '', '', '', '', '']
expect(tooltip.options.xPadding).toEqual(6);
expect(tooltip.options.yPadding).toEqual(6);
- expect(tooltip.xAlign).toEqual('center');
- expect(tooltip.yAlign).toEqual('top');
+ expect(tooltip.xAlign).toEqual('left');
+ expect(tooltip.yAlign).toEqual('center');
expect(tooltip.options.bodyFont).toEqual(jasmine.objectContaining({
color: '#fff',
}]
}));
- expect(tooltip.x).toBeCloseToPixel(214);
- expect(tooltip.y).toBeCloseToPixel(190);
+ expect(tooltip.x).toBeCloseToPixel(267);
+ expect(tooltip.y).toBeCloseToPixel(75);
done();
});
title: ITitleOptions;
}
+export type TooltipAlignment = 'start' | 'center' | 'end';
+
export interface TooltipModel {
// The items that we are rendering in the tooltip. See Tooltip Item Interface section
dataPoints: ITooltipItem[];
// Positioning
- xAlign: 'start' | 'center' | 'end';
- yAlign: 'start' | 'center' | 'end';
+ xAlign: TooltipAlignment;
+ yAlign: TooltipAlignment;
// X and Y properties are the top left of the tooltip
x: number;
*/
position: 'average' | 'nearest';
+ /**
+ * Override the tooltip alignment calculations
+ */
+ xAlign: TooltipAlignment;
+ yAlign: TooltipAlignment;
+
/**
* Sort tooltip items.
*/