feat: instrument analysis
This commit is contained in:
@@ -109,7 +109,7 @@ export default function InstrumentChart({ priceData, indicators, events = [], he
|
|||||||
const next = { ...v, [key]: !v[key] }
|
const next = { ...v, [key]: !v[key] }
|
||||||
seriesRefs.current[key]?.forEach(s => s.applyOptions({ visible: next[key] }))
|
seriesRefs.current[key]?.forEach(s => s.applyOptions({ visible: next[key] }))
|
||||||
if (key === 'volatility') {
|
if (key === 'volatility') {
|
||||||
chartRef.current?.priceScale('volatility').applyOptions({ visible: next[key] })
|
chartRef.current?.priceScale('left').applyOptions({ visible: next[key] })
|
||||||
}
|
}
|
||||||
return next
|
return next
|
||||||
})
|
})
|
||||||
@@ -235,17 +235,22 @@ export default function InstrumentChart({ priceData, indicators, events = [], he
|
|||||||
seriesRefs.current.bb = [bbUpper, bbLower]
|
seriesRefs.current.bb = [bbUpper, bbLower]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volatilité réalisée (annualisée, %) — échelle dédiée, cachée par défaut
|
// Volatilité réalisée (annualisée, %) — échelle dédiée, cachée par défaut. Must use
|
||||||
|
// the built-in 'left' scale id, not a custom string: lightweight-charts treats any
|
||||||
|
// non-'left'/'right' priceScaleId as an "overlay" scale, which never renders a visible
|
||||||
|
// axis and ignores `visible` entirely (confirmed in its own typings) — that silently
|
||||||
|
// killed both the axis labels and the hover value tag on this series.
|
||||||
if (indicators.volatility?.length) {
|
if (indicators.volatility?.length) {
|
||||||
chart.priceScale('volatility').applyOptions({
|
chart.priceScale('left').applyOptions({
|
||||||
visible: visibleRef.current.volatility,
|
visible: visibleRef.current.volatility,
|
||||||
borderColor: 'rgba(236,72,153,0.25)',
|
borderColor: 'rgba(236,72,153,0.25)',
|
||||||
|
textColor: '#ec4899',
|
||||||
scaleMargins: { top: 0.78, bottom: 0.02 },
|
scaleMargins: { top: 0.78, bottom: 0.02 },
|
||||||
})
|
})
|
||||||
const volatilitySeries = chart.addLineSeries({
|
const volatilitySeries = chart.addLineSeries({
|
||||||
color: '#ec4899',
|
color: '#ec4899',
|
||||||
lineWidth: 1,
|
lineWidth: 1,
|
||||||
priceScaleId: 'volatility',
|
priceScaleId: 'left',
|
||||||
title: 'Vol. réalisée %',
|
title: 'Vol. réalisée %',
|
||||||
priceLineVisible: false,
|
priceLineVisible: false,
|
||||||
lastValueVisible: true,
|
lastValueVisible: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user