Пример #1
0
        /// <summary>
        /// Appends value <paramref name="value"/> to the chart (without redrawing)
        /// </summary>
        /// <param name="value">performance value</param>
        private void ChartAppend(DataSample value)
        {
            // Insert at first position
            drawValues.Insert(0, value);

            // Remove last item if maximum value count is reached
            if (drawValues.Count > chartSize)
            {
                drawValues.RemoveAt(chartSize);
            }

            // Calculate horizontal grid offset for "scrolling" effect
            gridScrollOffset += valueSpacing;
            if (gridScrollOffset > GRID_SPACING)
            {
                gridScrollOffset = gridScrollOffset % GRID_SPACING;
            }
        }
Пример #2
0
        /// <summary>
        /// Adds a value to the Chart Line
        /// </summary>
        /// <param name="value">progress value</param>
        public void AddValue(DataSample values)
        {
            switch (timerMode)
            {
            case TimerMode.Disabled:
                ChartAppend(values);
                Invalidate();
                break;

            case TimerMode.Simple:
            case TimerMode.SynchronizedAverage:
            case TimerMode.SynchronizedSum:
                // For all Timer Modes, the Values are stored in the Queue
                AddValueToQueue(values);
                break;

            default:
                throw new Exception(String.Format("Unsupported TimerMode: {0}", timerMode));
            }
        }
Пример #3
0
 /// <summary>
 /// Add value to the queue for a timed refresh
 /// </summary>
 /// <param name="value"></param>
 private void AddValueToQueue(DataSample sample)
 {
     waitingValues.Enqueue(sample);
 }