コード例 #1
0
        /// <summary>
        /// 获取echarts所需信息.
        /// </summary>
        /// <returns>Json.</returns>
        public ActionResult GetEcharts()
        {
            var projects = Db.Queryable <Project>().Where(it => it.Status == "进行中").OrderBy(it => it.Id, OrderByType.Desc).ToList();

            if (projects[0] != null)
            {
                List <Echarts> list      = new List <Echarts>();
                int            voteNum   = projects[0].HasVote;
                int            noVoteNum = projects[0].ExpertCount - voteNum;
                Echarts        vote      = new Echarts
                {
                    value = voteNum,
                    name  = "已评审",
                };
                Echarts noVote = new Echarts
                {
                    value = noVoteNum,
                    name  = "未评审",
                };
                list.Add(vote);
                list.Add(noVote);
                return(Json(new { code = 200, data = list, count = list.Count() }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { code = 400 }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        /// <summary>
        /// 获取管理员echarts所需信息.
        /// </summary>
        /// <returns>Json.</returns>
        public ActionResult GetEchartsOne()
        {
            var            orderOne   = Db.Queryable <RepairOrder>().Where(it => it.Status == "已完成").Count();
            var            orderTwo   = Db.Queryable <RepairOrder>().Where(it => it.Status == "进行中").Count();
            var            orderThree = Db.Queryable <RepairOrder>().Where(it => it.Status == "待分配").Count();
            List <Echarts> list       = new List <Echarts>();
            Echarts        one        = new Echarts
            {
                value = orderOne,
                name  = "已完成",
            };
            Echarts two = new Echarts
            {
                value = orderTwo,
                name  = "进行中",
            };
            Echarts three = new Echarts
            {
                value = orderThree,
                name  = "待分配",
            };

            list.Add(one);
            list.Add(two);
            list.Add(three);
            return(Json(new { code = 200, data = list, count = list.Count() }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: wangrd/EChartsNet
 private void ShowCharts(DataTable dataTable, Echarts echarts)
 {
     echarts.CreateTableLayout(2, 3, (browser.Width - 20) / 3, (browser.Height - 20) / 2);//创建布局
     echarts[1, 1] = new SimpleBar(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'基础柱状图'",
         }
     }, 1);
     echarts[1, 2] = new BasicLineChart(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'基础折线图'",
         }
     }, 1);
     echarts[1, 3] = new BasicScatter(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'基础散点图'",
         }
     }, 1);
     echarts[2, 1] = new SmoothedLineChart(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'基础曲线图'",
         }
     }, 1);
     echarts[2, 2] = new StackBar(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'堆叠柱状图'",
         }
     }, 1);
     echarts[2, 3] = new BasicPie(dataTable, new CompleteOption()
     {
         title = new Title()
         {
             text = "'简单饼图'",
         }
     }, 1);
     echarts.Show();//显示
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: wangrd/EChartsNet
        //自适应两行三列
        static void ShowECharts(WebBrowser browser, DataTable dataTable, Echarts echarts)
        {
            echarts.AddTheme(Theme.roma);
            echarts.CreateTableLayout(row, col, (browser.Width - 20) / col, (browser.Height - 20) / row);

            echarts[1, 1] = new SimpleBar(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础柱状图'",
                }
            }, 1);
            echarts[1, 2] = new BasicLineChart(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础折线图'",
                }
            }, 1);
            echarts[1, 3] = new BasicScatter(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础散点图'",
                }
            }, 1);
            //echarts[1, 3] = new BasicAreachart(dataTable,new CompleteOption() { title = new Title() { text = "'基础面积图'", } }, 1);
            echarts[2, 1] = new SmoothedLineChart(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础曲线图'",
                }
            }, 1);
            echarts[2, 2] = new StackBar(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'堆叠柱状图'",
                }
            }, 1);
            echarts[2, 3] = new BasicPie(dataTable, new CompleteOption(), 1);
            echarts.Show();
        }
コード例 #5
0
        /// <summary>
        /// 获取echarts饼图所需信息.
        /// </summary>
        /// <returns>Json.</returns>
        public ActionResult GetEchartsOne()
        {
            var departments   = Db.Queryable <Department>().ToList();
            var departmentNum = departments.Count();

            List <Echarts> list = new List <Echarts>();

            for (int i = 0; i < departmentNum; i++)
            {
                Echarts echarts = new Echarts
                {
                    value = departments[i].Cost,
                    name  = departments[i].Name,
                };
                list.Add(echarts);
            }

            return(Json(new { code = 200, data = list, count = list.Count() }, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: wangrd/EChartsNet
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //01.使用DataTable 承载映射数据
            DataTable dataTable = new DataTable("temp");

            dataTable.Columns.Add("产品", typeof(string));
            dataTable.Columns.Add("2015", typeof(float));
            dataTable.Columns.Add("2016", typeof(float));
            dataTable.Columns.Add("2017", typeof(float));
            dataTable.Rows.Add("中国", 43.3, 85.8, 93.7);
            dataTable.Rows.Add("美国", 83.1, 73.4, 55.1);
            dataTable.Rows.Add("日本", 86.4, 65.2, 82.5);
            dataTable.Rows.Add("英国", 72.4, 53.9, 39.1);
            //02.添加承载,调用显示
            Echarts echarts = new Echarts(browser); //新建 以browser承载

            echarts.AddTheme(Theme.roma);           //增加主题
            //03.显示和添加浏览器大小更改自适应事件
            ShowCharts(dataTable, echarts);
            browser.SizeChanged += delegate { ShowCharts(dataTable, echarts); };
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: wangrd/EChartsNet
        private static void ThreadStart()
        {
            //01 初始化数据,默认列名作标签轴
            DataTable dataTable = new DataTable("temp");

            dataTable.Columns.Add("产品", typeof(string));
            dataTable.Columns.Add("2015", typeof(float));
            dataTable.Columns.Add("2016", typeof(float));
            dataTable.Columns.Add("2017", typeof(float));
            dataTable.Rows.Add("中国", 43.3, 85.8, 93.7);
            dataTable.Rows.Add("美国", 83.1, 73.4, 55.1);
            dataTable.Rows.Add("日本", 86.4, 65.2, 82.5);
            dataTable.Rows.Add("英国", 72.4, 53.9, 39.1);

            //02.add browser
            WebBrowser browser = new WebBrowser();

            browser.Dock     = DockStyle.Fill;
            browser.TabIndex = 0;

            //browser.Size = new Size(col * width, row * height);

            //EchartsInitialize.SupportEchartsGL = true;
            //EchartsInitialize.SupportBootstrap = true;
            //03.创建布局,增加图,Show()显示图
            Echarts echarts = new Echarts(browser);

            ShowECharts(browser, dataTable, echarts);
            browser.SizeChanged += delegate { try { ShowECharts(browser, dataTable, echarts); } catch { } };
            //04 - -
            Form form = new Form();

            form.FormClosing += delegate { browser.Dispose(); Environment.Exit(0); };
            //form.Size = new Size(col * width + 45, row * height + 60);
            form.Controls.Add(browser);
            form.Size          = new Size(800, 600);
            form.StartPosition = FormStartPosition.CenterScreen;
            Application.Run(form);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: xiaoxiongnpu/EChartsNet
        private static void ThreadStart()
        {
            //01 初始化数据,默认列名作标签轴
            DataTable dataTable = new DataTable("temp");

            dataTable.Columns.Add("产品", typeof(string));
            dataTable.Columns.Add("2015", typeof(float));
            dataTable.Columns.Add("2016", typeof(float));
            dataTable.Columns.Add("2017", typeof(float));
            dataTable.Rows.Add("中国", 43.3, 85.8, 93.7);
            dataTable.Rows.Add("美国", 83.1, 73.4, 55.1);
            dataTable.Rows.Add("日本", 86.4, 65.2, 82.5);
            dataTable.Rows.Add("英国", 72.4, 53.9, 39.1);

            //02.add browser
            int        row = 2, col = 3, width = 500, height = 370;
            WebBrowser browser = new WebBrowser();

            browser.Dock     = DockStyle.Fill;
            browser.TabIndex = 0;
            browser.Size     = new Size(col * width, row * height);

            //EchartsInitialize.SupportEchartsGL = true;
            //EchartsInitialize.SupportBootstrap = true;
            //03.创建布局,增加图,Show()显示图
            Echarts echarts = new Echarts(browser);

            echarts.AddTheme(Theme.roma);
            echarts.CreateTableLayout(row, col, width, height);

            echarts[1, 1] = new SimpleBar(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础柱状图'",
                }
            }, 1);
            echarts[1, 2] = new BasicLineChart(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础折线图'",
                }
            }, 1);
            echarts[1, 3] = new BasicScatter(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础散点图'",
                }
            }, 1);
            //echarts[1, 3] = new BasicAreachart(dataTable,new CompleteOption() { title = new Title() { text = "'基础面积图'", } }, 1);
            echarts[2, 1] = new SmoothedLineChart(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'基础曲线图'",
                }
            }, 1);
            echarts[2, 2] = new StackBar(dataTable, new CompleteOption()
            {
                title = new Title()
                {
                    text = "'堆叠柱状图'",
                }
            }, 1);
            echarts[2, 3] = new BasicPie(dataTable, new CompleteOption(), 1);
            echarts.Show();

            //04 - -
            Form form = new Form();

            form.FormClosing += delegate { browser.Dispose(); Environment.Exit(0); };
            form.Size         = new Size(col * width + 45, row * height + 60);
            form.Controls.Add(browser);
            form.StartPosition = FormStartPosition.CenterScreen;
            Application.Run(form);
        }