@@ -310,7 +310,7 @@ if (!window.Chart) {
310310 return num . toString ( ) . padStart ( 8 , ' ' ) ;
311311 }
312312
313- legendHandler ( param ) {
313+ legendHandler ( param , usingPoint = false ) {
314314 let options = this . chart . series . options ( )
315315
316316 if ( ! param . time ) {
@@ -319,8 +319,6 @@ if (!window.Chart) {
319319 return
320320 }
321321
322- let usingPoint = ! param . point && param . time
323-
324322 let data , logical
325323
326324 if ( usingPoint ) {
@@ -353,7 +351,14 @@ if (!window.Chart) {
353351 str += '| ' + percentStr
354352 }
355353 }
356- let volumeData = param . seriesData . get ( this . chart . volumeSeries )
354+
355+ let volumeData ;
356+ if ( usingPoint ) {
357+ volumeData = this . chart . volumeSeries . dataByIndex ( logical )
358+ }
359+ else {
360+ volumeData = param . seriesData . get ( this . chart . volumeSeries )
361+ }
357362 if ( volumeData ) {
358363 str += this . ohlcEnabled ? `<br>V ${ this . shorthandFormat ( volumeData . value ) } ` : ''
359364 }
@@ -390,24 +395,31 @@ if (!window.Chart) {
390395 window . Legend = Legend
391396}
392397
393- function syncCharts ( childChart , parentChart ) {
398+ function syncCharts ( childChart , parentChart , crosshairOnly = false ) {
394399
395400 function crosshairHandler ( chart , point ) {
396401 if ( ! point ) {
397402 chart . chart . clearCrosshairPosition ( )
398403 return
399404 }
400405 chart . chart . setCrosshairPosition ( point . value || point . close , point . time , chart . series ) ;
401- chart . legend . legendHandler ( point )
406+ chart . legend . legendHandler ( point , true )
402407 }
403408
404409 function getPoint ( series , param ) {
405410 if ( ! param . time ) return null ;
406411 return param . seriesData . get ( series ) || null ;
407412 }
408413
409- let setChildRange = ( timeRange ) => childChart . chart . timeScale ( ) . setVisibleLogicalRange ( timeRange )
410- let setParentRange = ( timeRange ) => parentChart . chart . timeScale ( ) . setVisibleLogicalRange ( timeRange )
414+ let setChildRange , setParentRange ;
415+ if ( crosshairOnly ) {
416+ setChildRange = ( timeRange ) => { }
417+ setParentRange = ( timeRange ) => { }
418+ }
419+ else {
420+ setChildRange = ( timeRange ) => childChart . chart . timeScale ( ) . setVisibleLogicalRange ( timeRange )
421+ setParentRange = ( timeRange ) => parentChart . chart . timeScale ( ) . setVisibleLogicalRange ( timeRange )
422+ }
411423
412424 let setParentCrosshair = ( param ) => {
413425 crosshairHandler ( parentChart , getPoint ( childChart . series , param ) )
0 commit comments