Showing
1 changed file
with
9 additions
and
0 deletions
... | ... | @@ -1289,6 +1289,7 @@ export class TbFlot { |
1289 | 1289 | let value: any; |
1290 | 1290 | let lastValue = 0; |
1291 | 1291 | let minDistanceHistorical: number; |
1292 | + let deltaX = 0; | |
1292 | 1293 | const results: TbFlotHoverInfo[] = [{ |
1293 | 1294 | seriesHover: [] |
1294 | 1295 | }]; |
... | ... | @@ -1297,6 +1298,13 @@ export class TbFlot { |
1297 | 1298 | seriesHover: [] |
1298 | 1299 | }); |
1299 | 1300 | } |
1301 | + if (this.chartType === 'bar' && this.options.series.bars.align !== 'left') { | |
1302 | + if (this.options.series.bars.align === 'center') { | |
1303 | + deltaX = this.options.series.bars.barWidth / 2; | |
1304 | + } else { | |
1305 | + deltaX = this.options.series.bars.barWidth; | |
1306 | + } | |
1307 | + } | |
1300 | 1308 | for (i = 0; i < seriesList.length; i++) { |
1301 | 1309 | series = seriesList[i]; |
1302 | 1310 | let posx: number; |
... | ... | @@ -1305,6 +1313,7 @@ export class TbFlot { |
1305 | 1313 | } else { |
1306 | 1314 | posx = pos.x; |
1307 | 1315 | } |
1316 | + posx += deltaX; | |
1308 | 1317 | hoverIndex = this.findHoverIndexFromData(posx, series); |
1309 | 1318 | if (series.data[hoverIndex] && series.data[hoverIndex][0]) { |
1310 | 1319 | hoverDistance = posx - series.data[hoverIndex][0]; | ... | ... |