Exemple #1
0
 protected virtual void InitLegend()
 {
     for (int i = 0; i < legend.dataList.Count; i++)
     {
         //LegendData data = legend.dataList[i];
         Button btn = ChartUtils.AddButtonObject(LEGEND_TEXT + "_" + i, transform, themeInfo.font,
                                                 themeInfo.textColor, Vector2.zero, Vector2.zero, Vector2.zero,
                                                 new Vector2(legend.itemWidth, legend.itemHeight));
         legend.SetDataButton(i, btn);
         Color bcolor = themeInfo.GetColor(i);
         btn.gameObject.SetActive(legend.show);
         btn.transform.localPosition              = GetLegendPosition(i);
         btn.GetComponent <Image>().color         = bcolor;
         btn.GetComponentInChildren <Text>().text = legend.dataList[i];
         btn.onClick.AddListener(delegate() {
             int index = int.Parse(btn.name.Split('_')[1]);
             legend.SetShowData(index, !legend.IsShowSeries(index));
             btn.GetComponent <Image>().color = legend.IsShowSeries(index) ?
                                                themeInfo.GetColor(index) : themeInfo.unableColor;
             OnYMaxValueChanged();
             OnLegendButtonClicked();
             RefreshChart();
         });
     }
 }
Exemple #2
0
        protected override void OnThemeChanged()
        {
            base.OnThemeChanged();
            radarInfo.backgroundColorList.Clear();
            switch (theme)
            {
            case Theme.Dark:
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#6f6f6f"));
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#606060"));
                break;

            case Theme.Default:
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#1F1C1E"));
                break;

            case Theme.AlphaNull:
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#1F1C1E"));
                break;

            case Theme.Light:
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#f6f6f6"));
                radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#e7e7e7"));
                break;
            }
            InitIndicator();
        }
 private void InitLegend()
 {
     for (int i = 0; i < legend.dataList.Count; i++)
     {
         LegendData data = legend.dataList[i];
         Button     btn  = ChartUtils.AddButtonObject(LEGEND_TEXT + i, transform, themeInfo.font,
                                                      themeInfo.textColor, Vector2.zero, Vector2.zero, Vector2.zero,
                                                      new Vector2(legend.itemWidth, legend.itemHeight));
         legend.dataList[i].button = btn;
         Color bcolor = data.show ? themeInfo.GetColor(i) : themeInfo.unableColor;
         btn.gameObject.SetActive(legend.show);
         btn.transform.localPosition              = GetLegendPosition(i);
         btn.GetComponent <Image>().color         = bcolor;
         btn.GetComponentInChildren <Text>().text = data.text;
         btn.onClick.AddListener(delegate()
         {
             data.show = !data.show;
             btn.GetComponent <Image>().color = data.show ? themeInfo.GetColor(i) : themeInfo.unableColor;
             OnYMaxValueChanged();
             OnLegendButtonClicked();
             RefreshChart();
         });
     }
 }
Exemple #4
0
        private void InitLegend()
        {
            for (int i = 0; i < legend.dataList.Count; i++)
            {
                LegendData data = legend.dataList[i];
                Button     btn  = ChartUtils.AddButtonObject(LEGEND_TEXT + i, transform, themeInfo.font,
                                                             themeInfo.textColor, Vector2.zero, Vector2.zero, Vector2.zero,
                                                             new Vector2(legend.itemWidth, legend.itemHeight));
                btn.name = data.key;
                legend.dataList[i].button = btn;
                Color bcolor = data.show ? themeInfo.GetColor(i) : themeInfo.unableColor;
                btn.gameObject.SetActive(legend.show);
                btn.transform.localPosition              = GetLegendPosition(i);
                btn.GetComponent <Image>().color         = bcolor;
                btn.GetComponentInChildren <Text>().text = data.text;
                //btn.onClick.AddListener(delegate ()
                //{
                //    Debug.Log(btn.name + "Clicked!");
                //    //data.show = !data.show;
                //    //btn.GetComponent<Image>().color = data.show ? themeInfo.GetColor(i) : themeInfo.unableColor;
                //    //OnYMaxValueChanged();
                //    //OnLegendButtonClicked();
                //    //RefreshChart();
                //});
            }

            checkTheme = theme;

            checkLegend.checkDataListCount = legend.dataList.Count;
            checkLegend.itemWidth          = legend.itemWidth;
            checkLegend.itemHeight         = legend.itemHeight;
            checkLegend.itemGap            = legend.itemGap;
            checkLegend.left     = legend.left;
            checkLegend.right    = legend.right;
            checkLegend.bottom   = legend.bottom;
            checkLegend.top      = legend.top;
            checkLegend.location = legend.location;
            checkLegend.show     = legend.show;
        }