@@ -94,21 +94,36 @@ export function metricEncode(plot: PlotParams, defaultPlot: PlotParams = getNewM
9494 }
9595
9696 if ( ! dequal ( defaultPlot . events , plot . events ) ) {
97- plot . events . forEach ( ( e ) => {
98- paramArr . push ( [ prefix + GET_PARAMS . metricEvent , e ] ) ;
99- } ) ;
97+ //remove metric event
98+ if ( plot . events . length === 0 && defaultPlot . events . length > 0 ) {
99+ paramArr . push ( [ prefix + GET_PARAMS . metricEvent , removeValueChar ] ) ;
100+ } else {
101+ plot . events . forEach ( ( e ) => {
102+ paramArr . push ( [ prefix + GET_PARAMS . metricEvent , e ] ) ;
103+ } ) ;
104+ }
100105 }
101106
102107 if ( ! dequal ( defaultPlot . eventsBy , plot . eventsBy ) ) {
103- plot . eventsBy . forEach ( ( e ) => {
104- paramArr . push ( [ prefix + GET_PARAMS . metricEventBy , e ] ) ;
105- } ) ;
108+ //remove event by
109+ if ( plot . eventsBy . length === 0 && defaultPlot . eventsBy . length > 0 ) {
110+ paramArr . push ( [ prefix + GET_PARAMS . metricEventBy , removeValueChar ] ) ;
111+ } else {
112+ plot . eventsBy . forEach ( ( e ) => {
113+ paramArr . push ( [ prefix + GET_PARAMS . metricEventBy , e ] ) ;
114+ } ) ;
115+ }
106116 }
107117
108118 if ( ! dequal ( defaultPlot . eventsHide , plot . eventsHide ) ) {
109- plot . eventsHide . forEach ( ( e ) => {
110- paramArr . push ( [ prefix + GET_PARAMS . metricEventHide , e ] ) ;
111- } ) ;
119+ //remove event hide
120+ if ( plot . eventsHide . length === 0 && defaultPlot . eventsHide . length > 0 ) {
121+ paramArr . push ( [ prefix + GET_PARAMS . metricEventHide , removeValueChar ] ) ;
122+ } else {
123+ plot . eventsHide . forEach ( ( e ) => {
124+ paramArr . push ( [ prefix + GET_PARAMS . metricEventHide , e ] ) ;
125+ } ) ;
126+ }
112127 }
113128
114129 if ( defaultPlot . totalLine !== plot . totalLine ) {
@@ -128,9 +143,14 @@ export function metricEncode(plot: PlotParams, defaultPlot: PlotParams = getNewM
128143 }
129144
130145 if ( ! dequal ( defaultPlot . timeShifts , plot . timeShifts ) ) {
131- plot . timeShifts . forEach ( ( t ) => {
132- paramArr . push ( [ prefix + GET_PARAMS . metricLocalTimeShifts , t . toString ( ) ] ) ;
133- } ) ;
146+ //remove local time shifts
147+ if ( plot . timeShifts . length === 0 && defaultPlot . timeShifts . length > 0 ) {
148+ paramArr . push ( [ prefix + GET_PARAMS . metricLocalTimeShifts , removeValueChar ] ) ;
149+ } else {
150+ plot . timeShifts . forEach ( ( t ) => {
151+ paramArr . push ( [ prefix + GET_PARAMS . metricLocalTimeShifts , t . toString ( ) ] ) ;
152+ } ) ;
153+ }
134154 }
135155 if ( ! paramArr . length && ! defaultPlot . id ) {
136156 if ( plot . metricName === promQLMetric ) {
0 commit comments