Exemplo n.º 1
0
        public override void ApplyTheme(ChartTheme theme)
        {
            //int itemsSpace = ItemsSpace;
            //int layerSpace = LayerSpace;
            //Font font = Font;

            //Style.Copy(theme);
            BackColor     = theme.BackColor;
            ForeColor     = theme.ForeColor;
            LineColor     = theme.LineColor;
            BorderColor   = theme.BorderColor;
            LineWidth     = theme.LineWidth;
            BorderWidth   = theme.BorderWidth;
            NodeBackColor = theme.NodeBackColor;
            NodeForeColor = theme.NodeForeColor;
            SelectColor   = theme.SelectColor;
            HoverColor    = theme.HoverColor;
            LinkLineColor = theme.LinkLineColor;
            ItemsSpace    = theme.ItemsSpace;
            LayerSpace    = theme.LayerSpace;

            if (Root != null)
            {
                Root.Style.BackColor   = theme.RootBackColor;
                Root.Style.ForeColor   = theme.RootForeColor;
                Root.Style.BorderColor = theme.RootBorderColor;
            }
        }
Exemplo n.º 2
0
        public override ChartTheme GetChartTheme()
        {
            var theme = new ChartTheme();

            //theme.Copy(this.Style);

            theme.BackColor     = this.BackColor;
            theme.ForeColor     = this.ForeColor;
            theme.LineColor     = this.LineColor;
            theme.BorderColor   = this.BorderColor;
            theme.Font          = this.Font;
            theme.LineWidth     = this.LineWidth;
            theme.BorderWidth   = this.BorderWidth;
            theme.NodeBackColor = this.NodeBackColor;
            theme.NodeForeColor = this.NodeForeColor;
            theme.SelectColor   = this.SelectColor;
            theme.HoverColor    = this.HoverColor;
            theme.LinkLineColor = this.LinkLineColor;
            theme.ItemsSpace    = this.ItemsSpace;
            theme.LayerSpace    = this.LayerSpace;

            if (Root != null)
            {
                theme.RootBackColor   = Root.Style.BackColor;
                theme.RootForeColor   = Root.Style.ForeColor;
                theme.RootBorderColor = Root.Style.BorderColor;
            }

            return(theme);
        }
Exemplo n.º 3
0
 public override void ApplyChartTheme(ChartTheme theme)
 {
     if (Map != null)
     {
         BeginUpdateView();
         Map.ApplyTheme(theme);
         EndUpdateView(ChangeTypes.Visual);
     }
 }
Exemplo n.º 4
0
        ThemeNode CreateThemeNode(ChartTheme theme)
        {
            ThemeNode node = new ThemeNode(theme);

            node.ImageIndex      = node.SelectedImageIndex = GetImageIndex(theme.Icon);
            node.StateImageIndex = IsDefaultTheme(theme) ? 1 : 0;
            // node.Text = theme.Name;

            return(node);
        }
Exemplo n.º 5
0
 void CkbDefaultTheme_CheckedChanged(object sender, EventArgs e)
 {
     if (CurrentTheme != null)
     {
         if (CkbDefaultTheme.Checked)
         {
             DefaultTheme = CurrentTheme;
         }
         else if (DefaultTheme == CurrentTheme)
         {
             DefaultTheme = null;
         }
     }
 }
Exemplo n.º 6
0
        IEnumerator ComponentVisualMap()
        {
            chart.title.subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";

            chart.visualMap.enable     = true;
            chart.visualMap.show       = true;
            chart.visualMap.orient     = Orient.Vertical;
            chart.visualMap.calculable = true;
            chart.visualMap.min        = 0;
            chart.visualMap.max        = 100;
            chart.visualMap.range[0]   = 0;
            chart.visualMap.range[1]   = 100;

            var colors = new List <string> {
                "#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
                "#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"
            };

            chart.visualMap.inRange.Clear();
            foreach (var str in colors)
            {
                chart.visualMap.inRange.Add(ChartTheme.GetColor(str));
            }
            chart.grid.left   = 80;
            chart.grid.bottom = 100;
            chart.RefreshChart();

            yield return(new WaitForSeconds(1f));

            while (chart.visualMap.rangeMin < 40)
            {
                chart.visualMap.rangeMin += speed * Time.deltaTime;
                chart.RefreshChart();
                yield return(null);
            }
            while (chart.visualMap.rangeMax > 60)
            {
                chart.visualMap.rangeMax -= speed * Time.deltaTime;
                chart.RefreshChart();
                yield return(null);
            }
            while (chart.visualMap.rangeMin > 0 || chart.visualMap.rangeMax < 100)
            {
                chart.visualMap.rangeMin -= speed * Time.deltaTime;
                chart.visualMap.rangeMax += speed * Time.deltaTime;
                chart.RefreshChart();
                yield return(null);
            }
        }
Exemplo n.º 7
0
        void DeleteTheme(ChartTheme theme)
        {
            if (theme == null)
            {
                throw new ArgumentNullException();
            }

            ThemeNode node = FindTreeNode(theme);

            if (node != null)
            {
                node.Remove();
                DeleteThemes.Add(theme);
            }
        }
Exemplo n.º 8
0
        void CopyTheme(ChartTheme sourceTheme)
        {
            ChartTheme theme = new ChartTheme(sourceTheme);

            theme.SetIsInternal(false);
            if (sourceTheme.IsInternal)
            {
                theme.Name = string.Format("{0} {1}", Lang._("Copy of"), Lang._(sourceTheme.Name));
            }
            else
            {
                theme.Name = string.Format("{0} {1}", Lang._("Copy of"), sourceTheme.Name);
            }
            AddNewTheme(theme);
        }
Exemplo n.º 9
0
        ThemeNode FindTreeNode(TreeNodeCollection nodes, ChartTheme theme)
        {
            foreach (TreeNode node in nodes)
            {
                if (node is ThemeNode && ((ThemeNode)node).Theme == theme)
                {
                    return((ThemeNode)node);
                }

                ThemeNode sn = FindTreeNode(node.Nodes, theme);
                if (sn != null)
                {
                    return(sn);
                }
            }

            return(null);
        }
Exemplo n.º 10
0
        void OnDefaultThemeChanged(ChartTheme old)
        {
            if (old != null)
            {
                var n = FindTreeNode(old);
                if (n != null)
                {
                    n.StateImageIndex = 0;
                }
            }

            if (DefaultTheme != null)
            {
                var n = FindTreeNode(DefaultTheme);
                if (n != null)
                {
                    n.StateImageIndex = 1;
                }
            }
        }
Exemplo n.º 11
0
        void AddNewTheme(ChartTheme theme)
        {
            ChartThemeManage.Default.Extensions.Themes.Add(theme);
            ThemeFolderNode node = FindTreeNode(ChartThemeManage.Default.Extensions);

            if (node != null)
            {
                node.Nodes.Add(CreateThemeNode(theme));
            }

            CurrentTheme = theme;

            if (tabControl1.SelectedIndex != 1)
            {
                tabControl1.SelectedIndex = 1;
            }

            if (TxbThemeName.CanFocus && !TxbThemeName.Focused)
            {
                TxbThemeName.Focus();
            }
        }
Exemplo n.º 12
0
 public abstract void ApplyTheme(ChartTheme chartTheme);
Exemplo n.º 13
0
 public override void ApplyTheme(ChartTheme chartTheme)
 {
 }
Exemplo n.º 14
0
 bool IsDefaultTheme(ChartTheme theme)
 {
     return(DefaultTheme == theme);
 }
Exemplo n.º 15
0
        void Awake()
        {
            chart = gameObject.GetComponent <HeatmapChart>();
            if (chart == null)
            {
                chart = gameObject.AddComponent <HeatmapChart>();
            }
            chart.title.text   = "HeatmapChart";
            chart.tooltip.type = Tooltip.Type.None;
            chart.grid.left    = 100;
            chart.grid.right   = 60;
            chart.grid.bottom  = 60;
            //目前只支持Category
            chart.xAxes[0].type = Axis.AxisType.Category;
            chart.yAxes[0].type = Axis.AxisType.Category;

            chart.xAxes[0].boundaryGap = true;
            chart.xAxes[0].boundaryGap = true;

            chart.xAxes[0].splitNumber = 10;
            chart.yAxes[0].splitNumber = 10;

            //清空数据重新添加
            chart.RemoveData();
            var serie = chart.AddSerie(SerieType.Heatmap, "serie1");

            //设置样式
            serie.itemStyle.show        = true;
            serie.itemStyle.borderWidth = 1;
            serie.itemStyle.borderColor = Color.clear;

            //设置高亮样式
            serie.emphasis.show                  = true;
            serie.emphasis.itemStyle.show        = true;
            serie.emphasis.itemStyle.borderWidth = 1;
            serie.emphasis.itemStyle.borderColor = Color.black;

            //设置视觉映射组件
            chart.visualMap.enable          = true;
            chart.visualMap.max             = 10;
            chart.visualMap.range[0]        = 0f;
            chart.visualMap.range[1]        = 10f;
            chart.visualMap.orient          = Orient.Vertical;
            chart.visualMap.calculable      = true;
            chart.visualMap.location.align  = Location.Align.BottomLeft;
            chart.visualMap.location.bottom = 100;
            chart.visualMap.location.left   = 30;

            //清空颜色重新添加
            chart.visualMap.inRange.Clear();

            var heatmapGridWid = 10f;
            int xSplitNumber   = (int)(chart.grid.runtimeWidth / heatmapGridWid);
            int ySplitNumber   = (int)(chart.grid.runtimeHeight / heatmapGridWid);
            var colors         = new List <string> {
                "#313695", "#4575b4", "#74add1", "#abd9e9", "#e0f3f8", "#ffffbf",
                "#fee090", "#fdae61", "#f46d43", "#d73027", "#a50026"
            };

            foreach (var str in colors)
            {
                chart.visualMap.inRange.Add(ChartTheme.GetColor(str));
            }
            //添加xAxis的数据
            for (int i = 0; i < xSplitNumber; i++)
            {
                chart.AddXAxisData((i + 1).ToString());
            }
            //添加yAxis的数据
            for (int i = 0; i < ySplitNumber; i++)
            {
                chart.AddYAxisData((i + 1).ToString());
            }
            for (int i = 0; i < xSplitNumber; i++)
            {
                for (int j = 0; j < ySplitNumber; j++)
                {
                    var value = 0f;
                    var rate  = Random.Range(0, 101);
                    if (rate > 70)
                    {
                        value = Random.Range(8f, 10f);
                    }
                    else
                    {
                        value = Random.Range(1f, 8f);
                    }
                    var list = new List <float> {
                        i, j, value
                    };
                    //至少是一个三位数据:(x,y,value)
                    chart.AddData(0, list);
                }
            }
        }
Exemplo n.º 16
0
 ThemeNode FindTreeNode(ChartTheme theme)
 {
     return(FindTreeNode(treeView1.Nodes, theme));
 }
Exemplo n.º 17
0
 public virtual void ApplyChartTheme(ChartTheme chartTheme)
 {
 }
Exemplo n.º 18
0
 public ThemeNode(ChartTheme theme)
 {
     Theme = theme;
 }
Exemplo n.º 19
0
 public static void setChartTheme(ChartTheme theme)
 {
   if (theme == null)
   {
     string str = "Null 'theme' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     ChartFactory.currentTheme = theme;
     if (!(theme is StandardChartTheme))
       return;
     if (String.instancehelper_equals(((StandardChartTheme) theme).getName(), (object) "Legacy"))
     {
       BarRenderer.setDefaultBarPainter((BarPainter) new StandardBarPainter());
       XYBarRenderer.setDefaultBarPainter((XYBarPainter) new StandardXYBarPainter());
     }
     else
     {
       BarRenderer.setDefaultBarPainter((BarPainter) new GradientBarPainter());
       XYBarRenderer.setDefaultBarPainter((XYBarPainter) new GradientXYBarPainter());
     }
   }
 }