@@ -34,6 +34,9 @@ internal sealed class DashboardViewModel : INotifyPropertyChanged
3434 private Axis [ ] _sourcesXAxes = [ ] ;
3535 private Axis [ ] _sourcesYAxes = [ ] ;
3636
37+ private Axis [ ] _eventIdsXAxes = [ ] ;
38+ private Axis [ ] _eventIdsYAxes = [ ] ;
39+
3740 public DashboardViewModel ( ILogRepository repository )
3841 {
3942 _repository = repository ?? throw new ArgumentNullException ( nameof ( repository ) ) ;
@@ -114,6 +117,18 @@ public Axis[] TimelineYAxes
114117 private set => SetProperty ( ref _timelineYAxes , value ) ;
115118 }
116119
120+ public Axis [ ] EventIdsXAxes
121+ {
122+ get => _eventIdsXAxes ;
123+ private set => SetProperty ( ref _eventIdsXAxes , value ) ;
124+ }
125+
126+ public Axis [ ] EventIdsYAxes
127+ {
128+ get => _eventIdsYAxes ;
129+ private set => SetProperty ( ref _eventIdsYAxes , value ) ;
130+ }
131+
117132 public ISeries [ ] TopSourcesSeries
118133 {
119134 get => _topSourcesSeries ;
@@ -186,6 +201,27 @@ private void InitializeChartAxes()
186201 MinLimit = 0
187202 }
188203 ] ;
204+
205+ EventIdsYAxes =
206+ [
207+ new Axis
208+ {
209+ Labels = [ ] ,
210+ LabelsPaint = new SolidColorPaint ( SKColors . LightGray ) ,
211+ TextSize = 12
212+ }
213+ ] ;
214+
215+ EventIdsXAxes =
216+ [
217+ new Axis
218+ {
219+ Name = "Count" ,
220+ NamePaint = new SolidColorPaint ( SKColors . White ) ,
221+ LabelsPaint = new SolidColorPaint ( SKColors . LightGray ) ,
222+ MinLimit = 0
223+ }
224+ ] ;
189225 }
190226
191227 public async Task LoadSessionsAsync ( )
@@ -363,24 +399,46 @@ private void UpdateTopEventIdsChart(List<(int EventId, int Count)> topEventIds)
363399 if ( topEventIds . Count == 0 )
364400 {
365401 TopEventIdsSeries = [ ] ;
402+ EventIdsYAxes = [ new Axis { Labels = [ ] } ] ;
366403 return ;
367404 }
368405
369- var data = topEventIds
370- . Select ( e => new { Label = $ "ID: { e . EventId } ", Value = e . Count } )
371- . ToList ( ) ;
406+ var labels = topEventIds . Select ( e => $ "ID: { e . EventId } ") . ToArray ( ) ;
407+ var values = topEventIds . Select ( e => e . Count ) . ToArray ( ) ;
372408
373409 TopEventIdsSeries =
374410 [
375411 new RowSeries < int >
376412 {
377413 Name = "Event Count" ,
378- Values = data . Select ( d => d . Value ) . ToArray ( ) ,
414+ Values = values ,
379415 Fill = new SolidColorPaint ( SKColors . Coral ) ,
380416 Stroke = null ,
381417 MaxBarWidth = 25 ,
382418 DataLabelsPaint = new SolidColorPaint ( SKColors . White ) ,
383- DataLabelsPosition = LiveChartsCore . Measure . DataLabelsPosition . End
419+ DataLabelsPosition = LiveChartsCore . Measure . DataLabelsPosition . End ,
420+ DataLabelsFormatter = point => point . Coordinate . PrimaryValue . ToString ( CultureInfo . InvariantCulture )
421+ }
422+ ] ;
423+
424+ EventIdsYAxes =
425+ [
426+ new Axis
427+ {
428+ Labels = labels ,
429+ LabelsPaint = new SolidColorPaint ( SKColors . LightGray ) ,
430+ TextSize = 11
431+ }
432+ ] ;
433+
434+ EventIdsXAxes =
435+ [
436+ new Axis
437+ {
438+ Name = "Count" ,
439+ NamePaint = new SolidColorPaint ( SKColors . White ) ,
440+ LabelsPaint = new SolidColorPaint ( SKColors . LightGray ) ,
441+ MinLimit = 0
384442 }
385443 ] ;
386444 }
0 commit comments