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));
        }
Exemplo n.º 2
0
 private void OnBarClick(BarEntry entry, int dataSetIndex)
 {
     if (Config.BarChartClickAction != null)
     {
         Config.BarChartClickAction.Invoke(entry, dataSetIndex);
     }
     ShowHideValuePopup(entry, dataSetIndex);
 }
Exemplo n.º 3
0
 private void HideCurrentValuePopup()
 {
     if (currentValuePopup != null)
     {
         currentValuePopup.gameObject.SetActive(false);
         currentValuePopupEntry = null;
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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();
            }
        }
Exemplo n.º 6
0
 private void UpdateValuePopup(BarEntry entry, int dataSetIndex)
 {
     currentValuePopup.transform.localPosition = positioner.GetValuePopupPosition(entry, dataSetIndex);
     currentValuePopup.text.text = "" + entry.Value;
     currentValuePopup.gameObject.SetActive(true);
 }