ArcGISPortalViewer.Popup.Primitives.Charting.LineChart.GenerateDataPoint C# (CSharp) Method

GenerateDataPoint() private method

private GenerateDataPoint ( Grid points, double>.KeyValuePair kvp, Range range ) : void
points Windows.UI.Xaml.Controls.Grid
kvp double>.KeyValuePair
range Range
return void
        private void GenerateDataPoint(Grid points, KeyValuePair<string, double> kvp, Range range)
        {
            // Add a column and add a grid in this column
            points.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            Grid point = new Grid();
            Grid.SetColumn(point, points.ColumnDefinitions.Count - 1);
            points.Children.Add(point);

            // Divide the grid in 3 rows
            double val = kvp.Value;
            double fraction = range.Fraction(val);

            point.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1 - fraction, GridUnitType.Star) });
            point.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Pixel) });
            point.RowDefinitions.Add(new RowDefinition { Height = new GridLength(fraction, GridUnitType.Star) });

            // Put a point in the middle row
            Ellipse ellipse = new Ellipse
                              	{
                              		Height = 10,
                              		Width = 10,
                              		Fill = GetColorByIndex(0),
                              		HorizontalAlignment = HorizontalAlignment.Center,
                              		VerticalAlignment = VerticalAlignment.Center,
                              		Margin = new Thickness(0, -20, 0, -20),
                              		Stroke = ForegroundColor,
                              		StrokeThickness = 1
                                };

            Grid.SetRow(ellipse, 1);
            SetTooltip(ellipse, kvp.Key, FormattedValue(kvp.Value));
            point.Children.Add(ellipse);
        }