Skip to content

Commit f798e5f

Browse files
committed
Persistent Drawings
1 parent 631afd4 commit f798e5f

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

lightweight_charts/js/funcs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ function calculateTrendLine(startDate, startValue, endDate, endValue, chart, ray
404404
}
405405

406406
if (startIndex === -1) {
407-
return []
407+
throw new Error(`Could not calculate start index from time ${stampToDate(startDate)}.`)
408408
}
409409
let endIndex
410410
if (ray) {

lightweight_charts/js/toolbox.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ if (!window.ToolBox) {
403403
renderDrawings() {
404404
this.drawings.forEach((item) => {
405405
if ('price' in item) return
406-
console.log('rendering')
407406
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
408407
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
409408
item.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
@@ -453,8 +452,8 @@ if (!window.ToolBox) {
453452
item.priceLine.lineStyle, item.priceLine.axisLabelVisible)
454453
}
455454
else {
456-
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
457-
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
455+
let startDate = Math.round((item.from[0]/this.chart.interval)*this.chart.interval)
456+
let endDate = Math.round((item.to[0]/this.chart.interval)*this.chart.interval)
458457

459458
drawing = new TrendLine(this.chart, item.color, item.ray)
460459
drawing.calculateAndSet(startDate, item.from[1], endDate, item.to[1])

0 commit comments

Comments
 (0)