public ChartBuilder AddDatasetY(decimal[] data, int?pointRadii = null, int?dp = null, string label = null, string bgcolor = null, string borderColor = null, int borderWidth = 1, string xAxisId = null, string yAxisId = null) { if (_type.Equals(ChartType.scatter)) { return(null); } if (dp.HasValue) { var x = (int)dp; data = data.Select(d => Math.Round(d, x)).ToArray(); } var dataset = new Dataset { Data = data }; if (pointRadii.HasValue) { dataset.PointRadius = (int)pointRadii; } if (!string.IsNullOrWhiteSpace(label)) { dataset.Label = label; } if (!string.IsNullOrWhiteSpace(yAxisId)) { dataset.YAxisID = yAxisId; } if (!string.IsNullOrWhiteSpace(xAxisId)) { dataset.XAxisID = xAxisId; } dataset.BorderWidth = borderWidth; if (!string.IsNullOrWhiteSpace(bgcolor)) { dataset.BackgroundColor = new string[] { bgcolor } } ; if (!string.IsNullOrWhiteSpace(borderColor)) { dataset.BorderColor = new string[] { borderColor } } ; if (_chart.Data.Datasets != null && _chart.Data.Datasets.Length != 0) { var existing = _chart.Data.Datasets; var datasets = new Dataset[existing.Length + 1]; datasets.CopyTo(existing, 0); datasets[^ 1] = dataset;