zoukankan      html  css  js  c++  java
  • ChartControl饼状图自定义调色板

    //按状态进行分类 scheduleTasks->List集合  Status->为scheduleTasks中的一个字段

                    var QuerSily = from fx in scheduleTasks
                                   group fx by fx.Status
                                       into b
                                       select new
                                       {
                                           Key = b.Key,
                                           Data = b
                                       };
     
                    chartControl2.Series[0].Points.Clear();
                    //定义一个名为UseColor的调色板
                    Palette palette = new Palette("UseColor",PaletteScaleMode.Repeat);
                    foreach (var item in QuerSily)
                    {
                        int count = item.Data.Count();
                        //饼状图
                        if (item.Key != null)
                        {
                            //根据不同的任务状态向UseColor调色板中添加颜色
                            if (item.Key == "提前开始")
                                palette.Add(Color.Lime);
                            else if (item.Key == "任务延迟")
                                palette.Add(Color.Red);
                            else if (item.Key == "正在进行")
                                palette.Add(Color.SpringGreen);
                            else if (item.Key == "任务完成")
                                palette.Add(Color.Green);
                            else if (item.Key == "延迟开始")
                                palette.Add(Color.DarkViolet);
                            SeriesPoint seriesadd = new SeriesPoint(item.Key, count);
                            chartControl2.Series[0].Points.Add(seriesadd);
                        }
                    }
                    //将之前定义的UseColor调色板添加到chartControl2控件
                    chartControl2.PaletteRepository.Add("UseColor", palette);
                    chartControl2.PaletteName = "UseColor";
  • 相关阅读:
    Linux操作系统 (RHEL 7/CentOS 7)
    (OK) 运行cBPM in Fedora23
    (OK) 运行cBPM—Fedora23
    (OK) Install codeblocks_16.01 on Fedora23
    (OK) Fedora23——Docker——CORE—testing
    (OK) CORE nodes access Internet—虚拟节点访问互联网—commands
    (OK-half) Fedora23——Docker——CORE—testing
    (OK) running imunes in Fedora 23
    (OK-HALF) To Find a Rogue DHCP Server—tcpdump/dhclient—nmap
    (OK) shell script—Find a Rogue DHCP Server—tcpdump/dhclient—nmap
  • 原文地址:https://www.cnblogs.com/ljy0905/p/4727426.html
Copyright © 2011-2022 走看看