Skip to content

Line drawn outside min/max since 2.9 #6631

Closed
@MaartenBent

Description

@MaartenBent

Expected Behavior

The line should start at min and stop at max, as it did in 2.8.0:
2 8

Current Behavior

The line is drawn outside min and max in 2.9.1. Note that this only becomes obvious when increasing the borderWidth.
2 9

Steps to Reproduce (for bugs)

Click here to expand and see the example code used for the images above.
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script src="https://www.chartjs.org/dist/2.9.1/Chart.min.js"></script>
</head>
<body>
	<div><canvas id="canvas"></canvas></div>
	<script>
		window.onload = function() {
			Chart.Scatter(document.getElementById('canvas').getContext('2d'), {
				data: {
					datasets: [{
						borderColor: 'red',
						data: [{x:-5,y:5},{x:-4,y:6},{x:-3,y:7},{x:-2,y:6},{x:-1,y:5},{x:0,y:4},{x:1,y:3},{x:2,y:2},{x:3,y:5},{x:4,y:7},{x:5,y:9}],
						fill: false,
						showLine: true,
						borderWidth: 20,
						pointRadius: 0,
					}]
				},
				options: {
					legend: {
						display: false
					},
					scales: {
						xAxes: [{
							ticks: {
								min: -2,
								max: 3
							}
						}]
					}
				}
			});
		};
	</script>
</body>
</html>

Environment

  • Chart.js version: 2.9.1
  • Browser name and version: Chrome 78
  • Link to your project: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions