src/GenFx.Wpf/Controls/FitnessChart.xaml.cs
/// <summary>
/// Refreshes the chart's data.
/// </summary>
/// <param name="forceRefresh">Force the data to be refreshed.</param>
Refreshes the chart's data.
Refreshes the chart ' s data .
private void RefreshChart(bool forceRefresh)
        {
            if (!forceRefresh && this.stopwatch?.Elapsed < FitnessChart.chartDataRefreshRate)
            {
                return;
            }
            Population? population = null;
            population = this.Population;
            this.categoryAxis.Labels.Clear();
            if (population != null)
            {
                IEnumerable<GeneticEntity> entities = population.Entities;
                if (this.FitnessSortOption == FitnessSortOption.Entity)
                {
                    List<GeneticEntity> entityList = population.Entities.ToList();
                    entityList.Sort();
                    entities = entityList;
                }
                else
                {
                    entities = population.Entities.GetEntitiesSortedByFitness(this.FitnessType, FitnessEvaluationMode.Maximize);
                }
                this.columnSeries.ItemsSource = entities;
                if (this.FitnessType == FitnessType.Scaled)
                {
                    this.columnSeries.ValueField = nameof(GeneticEntity.ScaledFitnessValue);
                }
                else
                {
                    this.columnSeries.ValueField = nameof(GeneticEntity.RawFitnessValue);
                }
                for (int i = 0; i < population.Entities.Count; i++)
                {
                    this.categoryAxis.Labels.Add(String.Empty);
                }
            }
            this.Dispatcher.Invoke(() =>
            {
                this.PlotModel.InvalidatePlot(true);
            }, DispatcherPriority.Background);
            this.stopwatch?.Restart();
        }
private void RefreshChart ( bool forceRefresh ) { if ( ! forceRefresh && this . stopwatch ? . Elapsed < FitnessChart . chartDataRefreshRate ) { return ; } Population ? population = null ; population = this . Population ; this . categoryAxis . Labels . Clear ( ) ; if ( population != null ) { IEnumerable < GeneticEntity > entities = population . Entities ; if ( this . FitnessSortOption == FitnessSortOption . Entity ) { List < GeneticEntity > entityList = population . Entities . ToList ( ) ; entityList . Sort ( ) ; entities = entityList ; } else { entities = population . Entities . GetEntitiesSortedByFitness ( this . FitnessType , FitnessEvaluationMode . Maximize ) ; } this . columnSeries . ItemsSource = entities ; if ( this . FitnessType == FitnessType . Scaled ) { this . columnSeries . ValueField = nameof ( GeneticEntity . ScaledFitnessValue ) ; } else { this . columnSeries . ValueField = nameof ( GeneticEntity . RawFitnessValue ) ; } for ( int i = 0 ; i < population . Entities . Count ; i ++ ) { this . categoryAxis . Labels . Add ( String . Empty ) ; } } this . Dispatcher . Invoke ( ( ) => { this . PlotModel . InvalidatePlot ( true ) ; } , DispatcherPriority . Background ) ; this . stopwatch ? . Restart ( ) ; }
Refreshes the chart's data.
Refreshes the chart ' s data .
// Unless the data is being forced to refresh, skip the refresh if the  // specified time has not yet elapsed. // Fill the x-axis with empty labels
forceRefresh
bool
Force the data to be refreshed.
Force the data to be refreshed .