@@ -18,6 +18,7 @@ import { degToRad } from "../utils/common";
1818import semver from 'semver' ;
1919import { updateTabList } from "../utils/updateTabList" ;
2020import * as THREE from 'three' ;
21+ import * as d3 from "d3" ;
2122
2223import CryptoES from 'crypto-es' ;
2324
@@ -716,12 +717,17 @@ receiver.initialize = function (callback) {
716717 }
717718
718719 function update_ui ( ) {
719-
720720 if ( FC . RC . active_channels > 0 ) {
721-
722721 // update bars with latest data
723722 for ( let i = 0 ; i < FC . RC . active_channels ; i ++ ) {
724- meterFillArray [ i ] . css ( 'width' , `${ ( ( FC . RC . channels [ i ] - meterScale . min ) / ( meterScale . max - meterScale . min ) * 100 ) . clamp ( 0 , 100 ) } %` ) ;
723+ meterFillArray [ i ] . css (
724+ "width" ,
725+ `${ (
726+ ( ( FC . RC . channels [ i ] - meterScale . min ) /
727+ ( meterScale . max - meterScale . min ) ) *
728+ 100
729+ ) . clamp ( 0 , 100 ) } %`,
730+ ) ;
725731 meterLabelArray [ i ] . text ( FC . RC . channels [ i ] ) ;
726732 }
727733
@@ -741,53 +747,63 @@ receiver.initialize = function (callback) {
741747 rxPlotData [ i ] . shift ( ) ;
742748 }
743749 }
744-
745750 }
746751
747752 // update required parts of the plot
748- widthScale = d3 . scale . linear ( ) .
749- domain ( [ ( samples - 299 ) , samples ] ) ;
753+ widthScale = d3 . scaleLinear ( ) . domain ( [ samples - 299 , samples ] ) ;
750754
751- heightScale = d3 . scale . linear ( ) .
752- domain ( [ 800 , 2200 ] ) ;
755+ heightScale = d3 . scaleLinear ( ) . domain ( [ 800 , 2200 ] ) ;
753756
754757 update_receiver_plot_size ( ) ;
755758
756- const xGrid = d3 . svg . axis ( ) .
757- scale ( widthScale ) .
758- orient ( "bottom" ) .
759- tickSize ( - height , 0 , 0 ) .
760- tickFormat ( "" ) ;
761-
762- const yGrid = d3 . svg . axis ( ) .
763- scale ( heightScale ) .
764- orient ( "left" ) .
765- tickSize ( - width , 0 , 0 ) .
766- tickFormat ( "" ) ;
767-
768- const xAxis = d3 . svg . axis ( ) .
769- scale ( widthScale ) .
770- orient ( "bottom" ) .
771- tickFormat ( function ( d ) { return d ; } ) ;
759+ const xGrid = d3
760+ . axisBottom ( )
761+ . scale ( widthScale )
762+ . tickSize ( - height )
763+ . tickFormat ( "" ) ;
764+
765+ const yGrid = d3
766+ . axisLeft ( )
767+ . scale ( heightScale )
768+ . tickSize ( - width )
769+ . tickFormat ( "" ) ;
770+
771+ const xAxis = d3
772+ . axisBottom ( )
773+ . scale ( widthScale )
774+ . tickFormat ( function ( d ) {
775+ return d ;
776+ } ) ;
772777
773- const yAxis = d3 . svg . axis ( ) .
774- scale ( heightScale ) .
775- orient ( "left" ) .
776- tickFormat ( function ( d ) { return d ; } ) ;
778+ const yAxis = d3
779+ . axisLeft ( )
780+ . scale ( heightScale )
781+ . tickFormat ( function ( d ) {
782+ return d ;
783+ } ) ;
777784
778- const line = d3 . svg . line ( ) .
779- x ( function ( d ) { return widthScale ( d [ 0 ] ) ; } ) .
780- y ( function ( d ) { return heightScale ( d [ 1 ] ) ; } ) ;
785+ const line = d3
786+ . line ( )
787+ . x ( function ( d ) {
788+ return widthScale ( d [ 0 ] ) ;
789+ } )
790+ . y ( function ( d ) {
791+ return heightScale ( d [ 1 ] ) ;
792+ } ) ;
781793
782794 svg . select ( ".x.grid" ) . call ( xGrid ) ;
783795 svg . select ( ".y.grid" ) . call ( yGrid ) ;
784796 svg . select ( ".x.axis" ) . call ( xAxis ) ;
785797 svg . select ( ".y.axis" ) . call ( yAxis ) ;
786798
787799 const data = svg . select ( "g.data" ) ;
788- const lines = data . selectAll ( "path" ) . data ( rxPlotData , function ( d , i ) { return i ; } ) ;
800+ const lines = data
801+ . selectAll ( "path" )
802+ . data ( rxPlotData , function ( d , i ) {
803+ return i ;
804+ } ) ;
789805 lines . enter ( ) . append ( "path" ) . attr ( "class" , "line" ) ;
790- lines . attr ( 'd' , line ) ;
806+ lines . attr ( "d" , line ) ;
791807
792808 samples ++ ;
793809 }
0 commit comments