File tree Expand file tree Collapse file tree
ChartJs.Blazor.Samples/Client/Pages/Charts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 122122
123123 private void RemoveData ()
124124 {
125- if (_config .Data .Datasets .Count == 0 )
125+ if (_config .Data .Datasets .Count == 0 ||
126+ _config .Data .Labels .Count == 0 )
127+ {
126128 return ;
129+ }
127130
128131 _config .Data .Labels .RemoveAt (_config .Data .Labels .Count - 1 );
129132
Original file line number Diff line number Diff line change 1010@code {
1111 private const int InitalCount = 7 ;
1212 private BarConfig _config ;
13- private Random _rng = new Random ();
1413 private Chart _chart ;
1514
1615 protected override void OnInitialized ()
Original file line number Diff line number Diff line change 122122
123123 private void RemoveData ()
124124 {
125- if (_config .Data .Datasets .Count == 0 )
125+ if (_config .Data .Datasets .Count == 0 ||
126+ _config .Data .Labels .Count == 0 )
127+ {
126128 return ;
129+ }
127130
128131 _config .Data .Labels .RemoveAt (_config .Data .Labels .Count - 1 );
129132
Original file line number Diff line number Diff line change 1313@code {
1414 private const int InitalCount = 7 ;
1515 private LineConfig _config ;
16- private Random _rng = new Random ();
1716 private Chart _chart ;
1817
1918 protected override void OnInitialized ()
140139
141140 private void RemoveData ()
142141 {
143- if (_config .Data .Datasets .Count == 0 )
142+ if (_config .Data .Datasets .Count == 0 ||
143+ _config .Data .Labels .Count == 0 )
144+ {
144145 return ;
146+ }
145147
146148 _config .Data .Labels .RemoveAt (_config .Data .Labels .Count - 1 );
147149
Original file line number Diff line number Diff line change 1212@code {
1313 private const int InitalCount = 5 ;
1414 private PieConfig _config ;
15- private Random _rng = new Random ();
1615 private Chart _chart ;
1716
1817 protected override void OnInitialized ()
You can’t perform that action at this time.
0 commit comments