コード例 #1
0
        public void UpdateSeries(string path, DateTime timestamp, float value)
        {
            long id = GetCounterId(path);

            UpdateDatabase(id, timestamp, value);

            MeasureModel newValue = new MeasureModel(timestamp, Math.Round(value, 2));

            List <Series> listeners;

            if (CounterListeners.TryGetValue(path, out listeners))
            {
                foreach (Series series in listeners)
                {
                    IChartValues values = series.Values;
                    values.Add(newValue);

                    // Update axis limits if chart is visible
                    if (series.DataContext != BindingOperations.DisconnectedSource)
                    {
                        var chartItem = (ChartItem)series.DataContext;
                        chartItem?.SetAxisLimits(timestamp);
                    }

                    if (values.Count > maxPointsPerChart)
                    {
                        values.RemoveAt(0);
                    }
                }
            }
        }
コード例 #2
0
        public void AddCounterListener(string path, Series series)
        {
            List <Series> listeners;

            if (!CounterListeners.TryGetValue(path, out listeners))
            {
                listeners = new List <Series>();
                CounterListeners.Add(path, listeners);
            }
            listeners.Add(series);
        }