// // Private Methods // private TransectChart Add(GridData grid, Color color, Dictionary <GridData, TransectChart> charts, Transform container, TransectChart prefab = null) { if (charts.ContainsKey(grid)) { Debug.LogError("Grid already added to transect charts"); return(charts[grid]); } if (prefab == null) { prefab = grid.IsCategorized ? categoryChartPrefab : gridChartPrefab; } TransectChart chart = Instantiate(prefab, container, false); chart.Init(grid, color); grid.OnFilterChange += OnOtherGridFilterChange; if (lineInfo != null) { chart.SetLineInfo(lineInfo); } else { chart.SetLocator(locator); } charts.Add(grid, chart); return(chart); }
// // Public Methods // public void AddCustomGrid(GridData grid, Color color, TransectChart prefab = null) { var chart = Add(grid, color, customCharts, customChartsContainer, prefab); chart.transform.SetAsLastSibling(); }