public Vector3 GetValuePopupPosition(BarEntry entry, int dataSetIndex) { Vector3 barPosition = GetBarPosition((int)entry.Position, dataSetIndex); Vector2 barSize = GetBarSize(entry.Value); return(new Vector3(barPosition.x + calculatedBarWidth / 2, barPosition.y + barSize.y, 0)); }
private void OnBarClick(BarEntry entry, int dataSetIndex) { if (Config.BarChartClickAction != null) { Config.BarChartClickAction.Invoke(entry, dataSetIndex); } ShowHideValuePopup(entry, dataSetIndex); }
private void HideCurrentValuePopup() { if (currentValuePopup != null) { currentValuePopup.gameObject.SetActive(false); currentValuePopupEntry = null; } }
private Bar UpdateBarWithEntry(Bar barInstance, BarEntry entry, Color color, int dataSetIndex) { barInstance.transform.localPosition = positioner.GetBarPosition((int)entry.Position, dataSetIndex); barInstance.GetComponent <RectTransform> ().sizeDelta = positioner.GetBarSize(entry.Value); barInstance.SetColor(color); barInstance.button.onClick.RemoveAllListeners(); barInstance.button.onClick.AddListener(delegate { OnBarClick(entry, dataSetIndex); }); return(barInstance); }
private void ShowHideValuePopup(BarEntry entry, int dataSetIndex) { if (currentValuePopup == null) { currentValuePopup = viewCreator.InstantiateChartPopup(contentView.transform, Config.PopupPrefab); } if (entry != currentValuePopupEntry) { UpdateValuePopup(entry, dataSetIndex); currentValuePopupEntry = entry; } else { HideCurrentValuePopup(); } }
private void UpdateValuePopup(BarEntry entry, int dataSetIndex) { currentValuePopup.transform.localPosition = positioner.GetValuePopupPosition(entry, dataSetIndex); currentValuePopup.text.text = "" + entry.Value; currentValuePopup.gameObject.SetActive(true); }