Skip to content

Commit

Permalink
build: v8.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
liihuu committed Oct 29, 2022
1 parent 4ff7afc commit fdef0f9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/en/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 8.6.3
`2022-10-29`
+ 💄 Optimize the display of high and low prices.

## 8.6.2
`2022-09-18`
+ 🐞 Fix `scrollToXxx` related bugs.
Expand Down
4 changes: 4 additions & 0 deletions docs/zh-CN/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 更新日志
## 8.6.3
`2022-10-29`
+ 💄 最优化高最低价显示。

## 8.6.2
`2022-09-18`
+ 🐞 修复`scrollToXxx`相关错误。
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "klinecharts",
"version": "8.6.2",
"version": "8.6.3",
"description": "Lightweight k-line chart built with html5 canvas",
"main": "index.js",
"types": "./types/index.d.ts",
Expand Down
17 changes: 14 additions & 3 deletions src/view/CandleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,31 @@ export default class CandleView extends TechnicalIndicatorView {
]
)

let lineEndX
let textStartX
if (startX > this._width / 2) {
lineEndX = startX - 5
textStartX = lineEndX - options.textMargin
this._ctx.textAlign = 'right'
} else {
lineEndX = startX + 5
this._ctx.textAlign = 'left'
textStartX = lineEndX + options.textMargin
}

// 绘制竖线
const y = startY + offset[1]
renderLine(
this._ctx,
[
{ x: startX, y: startY },
{ x: startX, y },
{ x: startX + 5, y }
{ x: lineEndX, y }
]
)

this._ctx.font = createFont(options.textSize, options.textWeight, options.textFamily)
const text = formatPrecision(price, precision)
this._ctx.fillText(text, startX + 5 + options.textMargin, y)
this._ctx.fillText(text, textStartX, y)
}

/**
Expand Down

0 comments on commit fdef0f9

Please sign in to comment.