public void Generate(CandleChart parent, Rect viewRect, IList <CandleChartData.CandleValue> value, CandleChartData.CandleSettings settings) { if (parent.IsCanvas == false) { Debug.LogWarning("prefab is meant to be used with canvas candle chart only"); return; } if (mCandle == null) { mCandle = CreateCandleGraphic(); } if (settings.Fill == null || settings.CandleThicknessMultiplier < 0.0001f) { mCandle.SetCandle(0, mEmptyCandle, settings); } else { mCandle.SetCandle(0, value, settings); } mCandle.HoverTransform(transform); mCandle.SetViewRect(viewRect, new Rect()); mCandle.SetHoverPrefab(settings.CandleHoverPrefab); mCandle.material = settings.Fill; if (mLine == null) { mLine = CreateCandleGraphic(); } if (settings.Line == null || settings.LineThickness < 0.0001f) { mLine.SetCandle(1, mEmptyCandle, settings); } else { mLine.SetCandle(1, value, settings); } mLine.HoverTransform(transform); mLine.SetHoverPrefab(settings.CandleHoverPrefab); mLine.material = settings.Line; mLine.SetViewRect(viewRect, new Rect()); if (mOutline == null) { mOutline = CreateCandleGraphic(); } mOutline.material = settings.Outline; mOutline.SetViewRect(viewRect, new Rect()); if (settings.Outline == null || settings.OutlineThickness < 0.0001f) { mOutline.SetCandle(2, mEmptyCandle, settings); } else { mOutline.SetCandle(2, value, settings); } }
bool RenameCategory(string oldName, string newName) { CandleChart graph = (CandleChart)serializedObject.targetObject; try { graph.DataSource.RenameCategory(oldName, newName); } catch (Exception) { return(false); } serializedObject.Update(); if (graph.gameObject.activeInHierarchy) { graph.GenerateChart(); } else { EditorUtility.SetDirty(graph); } return(true); }