@@ -7,10 +7,27 @@ import { useCallback, useState } from 'react';
7
7
import { StatisticType , YAxisType , createStatResolver } from './StatisticResolver' ;
8
8
import MinecraftStatisticLineChart from './controls/MinecraftStatisticLineChart' ;
9
9
import MinecraftStatisticStackedLineChart from './controls/MinecraftStatisticStackedLineChart' ;
10
- import { MultipleStatisticProvider , SimpleStatisticProvider } from './StatisticProvider' ;
10
+ import MinecraftStatisticStackedBarChart from './controls/MinecraftStatisticStackedBarChart' ;
11
+ import { MultipleStatisticProvider , SimpleStatisticProvider , StatisticUpdatedMessage } from './StatisticProvider' ;
11
12
12
13
import * as statPrefabs from './StatisticPrefabs' ;
13
14
15
+ // Filter out events with a value of zero that haven't been previously subscribed to
16
+ function constructSubscribedSignalFilter ( ) {
17
+ const nonFilteredValues : string [ ] = [ ] ;
18
+
19
+ const func = ( event : StatisticUpdatedMessage ) => {
20
+ if ( event . values . length === 1 && event . values [ 0 ] === 0 && ! nonFilteredValues . includes ( event . id ) ) {
21
+ return false ;
22
+ }
23
+
24
+ nonFilteredValues . push ( event . id ) ;
25
+ return true ;
26
+ } ;
27
+
28
+ return func ;
29
+ }
30
+
14
31
function App ( ) {
15
32
// State
16
33
const [ selectedPlugin , setSelectedPlugin ] = useState < string > ( 'no_plugin_selected' ) ;
@@ -37,6 +54,7 @@ function App() {
37
54
< VSCodePanelTab id = "tab-5" > Networking - Packets</ VSCodePanelTab >
38
55
< VSCodePanelTab id = "tab-6" > Networking - Bandwidth</ VSCodePanelTab >
39
56
< VSCodePanelTab id = "tab-7" > Handle Counts</ VSCodePanelTab >
57
+ < VSCodePanelTab id = "tab-8" > Subscriber Counts</ VSCodePanelTab >
40
58
< VSCodePanelView id = "view-1" style = { { flexDirection : 'column' } } >
41
59
< div style = { { flexDirection : 'row' , display : 'flex' } } >
42
60
{ statPrefabs . entityCount . reactNode }
@@ -166,6 +184,29 @@ function App() {
166
184
} }
167
185
/>
168
186
</ VSCodePanelView >
187
+ < VSCodePanelView id = "view-8" >
188
+ < StatGroupSelectionBox
189
+ labelName = "Script Plugin"
190
+ defaultDropdownId = "no_plugin_selected"
191
+ statParentId = "fine_grained_subscribers"
192
+ onChange = { handlePluginSelection }
193
+ />
194
+ < MinecraftStatisticStackedBarChart
195
+ title = "Signal Subscribers"
196
+ yLabel = "Number of World and System Before and After Event Subscribers Broken Down By Signal"
197
+ statisticDataProvider = {
198
+ new MultipleStatisticProvider ( {
199
+ statisticParentId : new RegExp ( `fine_grained_subscribers_${ selectedPlugin } ` ) ,
200
+ valuesFilter : constructSubscribedSignalFilter ( ) ,
201
+ } )
202
+ }
203
+ statisticResolver = { createStatResolver ( {
204
+ type : StatisticType . Absolute ,
205
+ tickRange : 20 * 15 /* About 15 seconds */ ,
206
+ yAxisType : YAxisType . Absolute ,
207
+ } ) }
208
+ />
209
+ </ VSCodePanelView >
169
210
</ VSCodePanels >
170
211
</ main >
171
212
) ;
0 commit comments