// So we don't try to draw so huge rectangles.
// https://github.com/chartjs/Chart.js/issues/5247
// TODO: use borderWidth instead (need to move the parsing from rectangle)
- const base = _limitValue(vScale.getPixelForValue(start),
+ let base = _limitValue(vScale.getPixelForValue(start),
vScale._startPixel - 10,
vScale._endPixel + 10);
if (minBarLength !== undefined && Math.abs(size) < minBarLength) {
size = size < 0 ? -minBarLength : minBarLength;
+ if (value === 0) {
+ base -= size / 2;
+ }
head = base + size;
}
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2],
+ datasets: [
+ {
+ data: [0, -0.01, -30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ indexAxis: 'y',
+ scales: {
+ x: {
+ ticks: {
+ display: false
+ }
+ },
+ y: {display: false}
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2],
+ datasets: [
+ {
+ data: [0, 0.01, 30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ indexAxis: 'y',
+ scales: {
+ x: {
+ ticks: {
+ display: false
+ }
+ },
+ y: {display: false}
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2, 3, 4],
+ datasets: [
+ {
+ data: [0, -0.01, 0.01, 30, -30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ indexAxis: 'y',
+ scales: {
+ x: {
+ ticks: {
+ display: false
+ }
+ },
+ y: {display: false}
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2],
+ datasets: [
+ {
+ data: [0, -0.01, -30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ scales: {
+ x: {display: false},
+ y: {
+ ticks: {
+ display: false
+ }
+ }
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2],
+ datasets: [
+ {
+ data: [0, 0.01, 30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ scales: {
+ x: {display: false},
+ y: {
+ ticks: {
+ display: false
+ }
+ }
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};
--- /dev/null
+module.exports = {
+ config: {
+ type: 'bar',
+ data: {
+ labels: [0, 1, 2, 3, 4],
+ datasets: [
+ {
+ data: [0, -0.01, 0.01, 30, -30],
+ backgroundColor: '#00ff00',
+ borderWidth: 0,
+ minBarLength: 20
+ }
+ ]
+ },
+ options: {
+ legend: false,
+ title: false,
+ scales: {
+ x: {display: false},
+ y: {
+ ticks: {
+ display: false
+ }
+ }
+ }
+ }
+ },
+ options: {
+ canvas: {
+ height: 512,
+ width: 512
+ }
+ }
+};