Persistent Drawings
This commit is contained in:
@ -404,7 +404,7 @@ function calculateTrendLine(startDate, startValue, endDate, endValue, chart, ray
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (startIndex === -1) {
|
if (startIndex === -1) {
|
||||||
return []
|
throw new Error(`Could not calculate start index from time ${stampToDate(startDate)}.`)
|
||||||
}
|
}
|
||||||
let endIndex
|
let endIndex
|
||||||
if (ray) {
|
if (ray) {
|
||||||
|
|||||||
@ -403,7 +403,6 @@ if (!window.ToolBox) {
|
|||||||
renderDrawings() {
|
renderDrawings() {
|
||||||
this.drawings.forEach((item) => {
|
this.drawings.forEach((item) => {
|
||||||
if ('price' in item) return
|
if ('price' in item) return
|
||||||
console.log('rendering')
|
|
||||||
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
|
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
|
||||||
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
|
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
|
||||||
item.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
|
item.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
|
||||||
@ -453,8 +452,8 @@ if (!window.ToolBox) {
|
|||||||
item.priceLine.lineStyle, item.priceLine.axisLabelVisible)
|
item.priceLine.lineStyle, item.priceLine.axisLabelVisible)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
|
let startDate = Math.round((item.from[0]/this.chart.interval)*this.chart.interval)
|
||||||
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
|
let endDate = Math.round((item.to[0]/this.chart.interval)*this.chart.interval)
|
||||||
|
|
||||||
drawing = new TrendLine(this.chart, item.color, item.ray)
|
drawing = new TrendLine(this.chart, item.color, item.ray)
|
||||||
drawing.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
|
drawing.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
|
||||||
|
|||||||
Reference in New Issue
Block a user