Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84c95fb

Browse files
committed
Fix in region lines
1 parent 303bd1c commit 84c95fb

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

Chart.BarFunnel.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,22 @@
160160
if(rectangleElementOptions.stepLabel.display && (index != 0)) {
161161
var label = (dataset.data[index] / dataset.data[0]) * 100;
162162

163-
// Draw Step Label
164-
ctx.font = vm.stepLabelFontSize + "px " + options.defaultFontFamily;
165-
ctx.fillStyle = vm.stepLabelColor;
166-
ctx.textAlign = "center";
167-
ctx.fillText(label.toFixed(0) + "%", vm.x, vm.y - vm.stepLabelFontSize);
163+
if (dataset.data[index] > 0) {
164+
// Draw Step Label
165+
ctx.font = vm.stepLabelFontSize + "px " + options.defaultFontFamily;
166+
ctx.fillStyle = vm.stepLabelColor;
167+
ctx.textAlign = "center";
168+
ctx.fillText(label.toFixed(0) + "%", vm.x, vm.y - vm.stepLabelFontSize);
169+
}
168170
}
169171

170172
if (chartOptions.region.display && (index < meta.data.length - 1)) {
171173
var nextVm = meta.data[index + 1]._view;
172-
var nextModel = meta.data[index + 1]._model;
173174

174175
var regionCorners = [
175176
[vm.x + halfWidth, top],
176-
[nextModel.x - halfWidth, nextVm.base - (nextVm.base - nextVm.y)],
177-
[nextModel.x - halfWidth, nextVm.base],
177+
[nextVm.x - halfWidth, nextVm.base - (nextVm.base - nextVm.y - 1)],
178+
[nextVm.x - halfWidth, nextVm.base],
178179
[vm.x + halfWidth, vm.base]
179180
];
180181

Chart.BarFunnel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/chart.barfunnel.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,22 @@
150150
if(rectangleElementOptions.stepLabel.display && (index != 0)) {
151151
var label = (dataset.data[index] / dataset.data[0]) * 100;
152152

153-
// Draw Step Label
154-
ctx.font = vm.stepLabelFontSize + "px " + options.defaultFontFamily;
155-
ctx.fillStyle = vm.stepLabelColor;
156-
ctx.textAlign = "center";
157-
ctx.fillText(label.toFixed(0) + "%", vm.x, vm.y - vm.stepLabelFontSize);
153+
if (dataset.data[index] > 0) {
154+
// Draw Step Label
155+
ctx.font = vm.stepLabelFontSize + "px " + options.defaultFontFamily;
156+
ctx.fillStyle = vm.stepLabelColor;
157+
ctx.textAlign = "center";
158+
ctx.fillText(label.toFixed(0) + "%", vm.x, vm.y - vm.stepLabelFontSize);
159+
}
158160
}
159161

160162
if (chartOptions.region.display && (index < meta.data.length - 1)) {
161163
var nextVm = meta.data[index + 1]._view;
162-
var nextModel = meta.data[index + 1]._model;
163164

164165
var regionCorners = [
165166
[vm.x + halfWidth, top],
166-
[nextModel.x - halfWidth, nextVm.base - (nextVm.base - nextVm.y)],
167-
[nextModel.x - halfWidth, nextVm.base],
167+
[nextVm.x - halfWidth, nextVm.base - (nextVm.base - nextVm.y - 1)],
168+
[nextVm.x - halfWidth, nextVm.base],
168169
[vm.x + halfWidth, vm.base]
169170
];
170171

0 commit comments

Comments
 (0)