Exemplo n.º 1
0
        /// <summary>
        /// Set the trainer and hook. Attach the hook.
        /// </summary>
        /// <param name="trainer">The trainer that will be set.</param>
        /// <param name="hook">The hook that will be applied.</param>
        protected void Init(ITrainer trainer, VisualAccumulatedValueReporterHook hook)
        {
            Trainer      = trainer;
            AttachedHook = hook;
            Trainer.AddHook(hook);
            Trainer.AddGlobalHook(new LambdaHook(TimeStep.Every(1, TimeScale.Stop), (registry, resolver) => Clear()));

            // TODO: is a formatter the best solution?
            AxisX.LabelFormatter = number => (number * hook.TimeStep.Interval).ToString(CultureInfo.InvariantCulture);
            AxisX.Unit           = hook.TimeStep.Interval;
        }
Exemplo n.º 2
0
 ///  <summary>
 ///  Create a TrainerChartPanel with a given title.
 ///  This <see ref="ChartPanel{T,TSeries,TData}"/> automatically receives data via a hook and adds it to the chart.
 ///  If a title is not sufficient modify <see cref="SigmaPanel.Header" />.
 ///  </summary>
 /// <param name="title">The given tile.</param>
 /// <param name="trainer">The trainer to attach the hook to.</param>
 /// <param name="hook">The hook (that is responsible for getting the desired value) which will be attached to the trainer. </param>
 /// <param name="headerContent">The content for the header. If <c>null</c> is passed,
 /// the title will be used.</param>
 protected TrainerChartPanel(string title, ITrainer trainer, VisualAccumulatedValueReporterHook hook, object headerContent = null) : base(title, headerContent)
 {
     Init(trainer, hook);
 }
Exemplo n.º 3
0
        ///  <summary>
        ///  Create a TrainerChartPanel with a given title.
        ///  This <see ref="ChartPanel{T,TSeries,TData}"/> automatically receives data via a hook and adds it to the chart.
        ///  If a title is not sufficient modify <see cref="SigmaPanel.Header" />.
        ///  </summary>
        /// <param name="title">The given tile.</param>
        /// <param name="trainer">The trainer to attach the hook to.</param>
        /// <param name="hookedValues">The values that will get hooked (i.e. the value identifiers of <see cref="AccumulatedValueReporter"/>).</param>
        /// <param name="timestep">The <see cref="TimeStep"/> for the hook.</param>
        /// <param name="headerContent">The content for the header. If <c>null</c> is passed,
        /// the title will be used.</param>
        public TrainerChartPanel(string title, ITrainer trainer, ITimeStep timestep, bool averageMode = false, object headerContent = null, params string[] hookedValues) : base(title, headerContent)
        {
            VisualAccumulatedValueReporterHook hook = new VisualAccumulatedValueReporterHook(this, hookedValues, timestep, averageMode);

            Init(trainer, hook);
        }