public ActionResult Details(int width = 500, int height = 500)
        {
            var chart = new Chart {
                Height = height, Width = width
            };
            var chartArea = new ChartArea("Area1")
            {
                AxisX = { Interval = 1 }, Area3DStyle = { Enable3D = true }
            };

            chart.ChartAreas.Add(chartArea);

            var seriescountAll = new Series("项目统计");
            var countAll       =
                _iProjectInfoStateService.GetAll().Select(a => new { Key = a.ProjectInfoStateName, Count = a.ProjectInfos.Count(b => !b.Deleted) });

            seriescountAll.ChartArea           = "Area1";
            seriescountAll.IsVisibleInLegend   = true;
            seriescountAll.IsValueShownAsLabel = true;
            seriescountAll.Label = "#VALX  #VALY";
            seriescountAll.Points.DataBind(countAll, "Key", "Count", "");
            seriescountAll.ChartType = SeriesChartType.Funnel;
            chart.Series.Add(seriescountAll);

            var imageStream = new MemoryStream();

            chart.SaveImage(imageStream, ChartImageFormat.Png);
            imageStream.Position = 0;
            return(new FileStreamResult(imageStream, "image/png"));
        }
Пример #2
0
        // 知识库
        // GET: /Platform/ProjectInfoState/

        public ActionResult Index(string keyword, string ordering, int pageIndex = 1)
        {
            var model =
                _iProjectInfoStateService.GetAll()
                .Select(
                    a =>
                    new
            {
                a.ProjectInfoStateName,
                a.SystemId,
                a.CreatedDate,
                a.Remark,
                a.Id
            }).Search(keyword);


            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            if (!string.IsNullOrEmpty(Request["report"]))
            {
                //导出
                var reportModel = new Report(model.ToReportSource());
                return(new ReportResult(reportModel));
            }

            return(View(model.ToPagedList(pageIndex)));
        }