Chart js line example

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.js"></script>
<div style="width:75%;">
  <canvas id="canvas"></canvas>
</div>

JavaScript

function getAlignedX(vm, align) {
	return align === 'center'
		? vm.x + vm.width / 2
		: align === 'right'
			? vm.x + vm.width - vm.xPadding
			: vm.x + vm.xPadding;
}

Chart.Tooltip.prototype.drawBody = function(pt, vm, ctx) {
  var bodyFontSize = vm.bodyFontSize;
  var bodySpacing = vm.bodySpacing;
  var bodyAlign = vm._bodyAlign;
  var body = vm.body;
  var drawColorBoxes = vm.displayColors;
  var labelColors = vm.labelColors;
  var xLinePadding = 0;
  var colorX = drawColorBoxes ? getAlignedX(vm, 'left') : 0;
  var textColor;

  ctx.textAlign = bodyAlign;
  ctx.textBaseline = 'top';
  ctx.font = Chart.helpers.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);

  pt.x = getAlignedX(vm, bodyAlign);

  // Before Body
  var fillLineOfText = function(line) {
    let cols = line.split(':');
    if (bodyAlign == 'left' && cols.length > 1) {
      line = cols.slice(0, cols.length-1).join(':') + ':';
      let rightText = cols.slice(-1);
      ctx.textAlign = 'right';
      let x = getAlignedX(vm, 'right');
      ctx.fillText(rightText, x, pt.y);
      ctx.textAlign = 'left';
    }
    ctx.fillText(line, pt.x + xLinePadding, pt.y);
    pt.y += bodyFontSize + bodySpacing;
  };

  // Before body lines
  ctx.fillStyle = vm.bodyFontColor;
  Chart.helpers.each(vm.beforeBody, fillLineOfText);

  xLinePadding = drawColorBoxes && bodyAlign !== 'right'
    ? bodyAlign === 'center' ? (bodyFontSize / 2 + 1) : (bodyFontSize + 2)
  : 0;

  // Draw body lines now
  Chart.helpers.each(body, function(bodyItem, i) {
    textColor = vm.labelTextColors[i];
    ctx.fillStyle = textColor;
    Chart.helpers.each(bodyItem.before, fillLineOfText);

    Chart.helpers.each(bodyItem.lines, function(line) {
      // Draw Legend-like boxes if needed
      if (drawColorBoxes) {
        // Fill a white rect so that colours merge nicely if the opacity is < 1
        ctx.fillStyle = vm.legendColorBackground;
        ctx.fillRect(colorX, pt.y, bodyFontSize, bodyFontSize);

        //...