post-order line draw improvements

This commit is contained in:
tim
2024-11-04 18:39:09 -04:00
parent cfcba95445
commit 28dd64b1cf
20 changed files with 140 additions and 106 deletions

View File

@@ -187,7 +187,7 @@ const colorRanges = {
sell: ['#CC0033', '#CCCC33'],
}
export function sideColor(buy, index) {
export function sideColor(buy, index=0) {
const range = buy ? colorRanges.buy : colorRanges.sell
const a = new Color(range[0]).rgb()
const b = new Color(range[1]).rgb()
@@ -232,7 +232,7 @@ export function intervalToSeconds(interval) {
: interval.endsWith('S') ? 1
: 60 // if no unit char, then it's minutes
const result = parseInt(/\d+/.exec(interval)[0]) * unit
console.log('intervalToSeconds', interval, result)
// console.log('intervalToSeconds', interval, result)
return result
}
@@ -252,4 +252,9 @@ export function computeInterceptSlope(time0, price0, time1, price1) {
const slope = (price1 - price0) / (t1 - t0)
const intercept = price1 - slope * t1
return [intercept, slope]
}
}
export function defined(v) {
return v !== undefined && v !== null
}