Exemple #1
0
        public async void LoadGraph()
        {
            var tg     = GetTimeGrain();
            var result = await _client.MetricValues(
                SelectedResource.Value,
                SelectedMetric.Value,
                tg,
                Start.Value,
                End.Value,
                SelectedMetricDimension.Value?.Value,
                SelectedDimensionValue.Value?.Value
                );

            var data  = result.Single().Data;
            var title = SelectedMetric.Value.Name.LocalizedValue;
            var md    = result.Single().MetadataValues.FirstOrDefault();

            if (md != null)
            {
                title += $" ({md.Name.LocalizedValue} = {md.Value})";
            }
            var labels = data.Select(x => x.TimeStamp).ToList();

            Labels.Clear();
            foreach (var l in labels)
            {
                Labels.Add(l.ToString());
            }
            MinLabel.Value = labels.First();
            MaxLabel.Value = labels.Last();
            Series.Clear();
            Series.Add(new LineSeries
            {
                Title  = title,
                Values = new ChartValues <float>(data.Select(x => x.Average))
            });
        }