当前位置: 首页>>代码示例>>C#>>正文


C# Chart.Save方法代码示例

本文整理汇总了C#中Chart.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.Save方法的具体用法?C# Chart.Save怎么用?C# Chart.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chart的用法示例。


在下文中一共展示了Chart.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: profile_viewer_Index

        //
        // GET: /Profile_Viewers/
        public ActionResult profile_viewer_Index()
        {
            var v = db.profile_viewers.OrderByDescending(r => r.visit_date)
                .Where(r => r.profile_name == User.Identity.Name).ToList();
            ViewBag.total = v.Count();

            List<int> i = new List<int>();
            List<int> li = new List<int>();
            DateTime dt = DateTime.UtcNow;
            var z = v.Where(r => r.visit_date.Day >= (dt.Day - 7)).AsEnumerable().ToList();
            var z1 = z.Select(r => r.visit_date.Day).Distinct();
            foreach (var n in z1)
            {
                var z2 = z.Where(r => r.visit_date.Day == n).ToList();
                i.Add(z2.Count());
                li.Add(n);
            }
            // chart

            var mychart = new Chart(width: 250, height: 150, theme: ChartTheme.Blue);
            // mychart.AddTitle(dt.ToString("MMMM,yyyy"));
            mychart.AddSeries(
            "Default",
                xValue: li,
                yValues: i
                );
            //mychart.DataBindTable(i);
            string s = User.Identity.Name;
            var filename = string.Format("~/Images/pv_{0}.png", s);
            mychart.Save(filename);

            ViewBag.weeklytotal = li.Count();

            //membership check
            membership_check mc = new membership_check();
            string status = mc.member_status(s);
            ViewBag.status = status;
            if (status == "Premium")
            {
                //paging
                decimal p = v.Count();
                ViewBag.total_page = Math.Ceiling(p / 10);
                ViewBag.pagenumber = 1;
                var v1 = v.Take(10);
                //
                return View(v1);
            }
            else
            {
                var v2 = v.Take(5);
                //paging
                decimal p = v2.Count();
                ViewBag.total_page = Math.Ceiling(p / 5);
                ViewBag.pagenumber = 1;
                //
                return View(v2);
            }
        }
开发者ID:arif1613,项目名称:MyMatch,代码行数:60,代码来源:Profile_ViewersController.cs

示例2: Grapher

 /// <summary>
 /// Create a graph on the server of a data series
 /// </summary>
 /// <param name="dataSetX">IEnumerable horizontal series</param>
 /// <param name="dataSetY">IEnumberable vertical series</param>
 public Grapher(System.Collections.IEnumerable dataSetX, System.Collections.IEnumerable dataSetY)
 {
     this.dataSetX = dataSetX;
     this.dataSetY = dataSetY;
     if (!File.Exists(System.Web.Hosting.HostingEnvironment.MapPath(filePath)))
     {
         //TODO log any exceptions
         chart = new Chart(width: 600, height: 600);
         chart.AddSeries(chartType: "Line",
                 xValue: dataSetX,
                 yValues: dataSetY);
         chart.Save(filePathName, "png");
         //TODO solve file cleanup problem
     }
 }
开发者ID:ljmorsillo,项目名称:LMSamples,代码行数:20,代码来源:Grapher.cs

示例3: SaveWritesToFile

 public void SaveWritesToFile()
 {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     chart.Save(GetContext(), "SaveWritesToFile.jpg", format: "image/jpeg");
     Assert.Equal("SaveWritesToFile.jpg", Path.GetFileName(chart.FileName));
     Assert.True(File.Exists(chart.FileName));
 }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:7,代码来源:ChartTest.cs

示例4: SaveThrowsWhenPathIsNull

 public void SaveThrowsWhenPathIsNull()
 {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     Assert.ThrowsArgumentNullOrEmptyString(() => { chart.Save(GetContext(), path: null, format: "jpeg"); }, "path");
 }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:5,代码来源:ChartTest.cs

示例5: SaveThrowsWhenFormatIsNull

 public void SaveThrowsWhenFormatIsNull()
 {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     Assert.ThrowsArgumentNullOrEmptyString(() => { chart.Save(GetContext(), "chartPath", format: null); }, "format");
 }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:5,代码来源:ChartTest.cs

示例6: SaveThrowsWhenFormatIsInvalid

 public void SaveThrowsWhenFormatIsInvalid()
 {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     Assert.ThrowsArgument(() => { chart.Save(GetContext(), "chartPath", format: "foo"); }, "format", "\"foo\" is invalid image format. Valid values are image format names like: \"JPEG\", \"BMP\", \"GIF\", \"PNG\", etc.");
 }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:5,代码来源:ChartTest.cs

示例7: SaveWorksWhenFormatIsJPG

        public void SaveWorksWhenFormatIsJPG()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            string fileName = "chartPath";

            chart.Save(GetContext(), "chartPath", format: "jpg");
            byte[] a = File.ReadAllBytes(fileName);

            chart.Save(GetContext(), "chartPath", format: "jpeg");
            byte[] b = File.ReadAllBytes(fileName);

            Assert.Equal(a, b);
        }
开发者ID:chrissimon-au,项目名称:aspnetwebstack,代码行数:14,代码来源:ChartTest.cs

示例8: GetWeightImage

        public User GetWeightImage(User user)
        {
            List<double> weightList = new List<double>();
            List<string> weightDatesList = new List<string>();

            foreach (Weight kvp in user.WeightList)
            {

                weightDatesList.Add(kvp.date.ToShortDateString());
                weightList.Add(kvp.value);
            }

            Chart weightChart = new Chart(width: 800, height: 400);
            weightChart.AddSeries(chartType: "Line", xValue: weightDatesList,
                yValues: weightList);
            weightChart.SetYAxis(min: 190, max:230);

            var path = Path.Combine(Server.MapPath("~/Images/userWeight"), user.userId.ToString() + ".jpeg");
            weightChart.Save(path);

            user.ImageWeightUrl = "../Images/userWeight/" + user.userId + ".jpeg";

            return user;
        }
开发者ID:bratao,项目名称:HeathServicesDataAggregator,代码行数:24,代码来源:HomeController.cs

示例9: GetTotalNumberOfStepsImage

        public User GetTotalNumberOfStepsImage(User user)
        {
            List<int> TotalNumberOfStepsList = new List<int>();
            List<string> TotalNumberOfStepsDatesList = new List<string>();

            foreach (TotalNumberOfSteps kvp in user.TotalNumberOfStepsList)
            {

                TotalNumberOfStepsDatesList.Add(kvp.date);
                TotalNumberOfStepsList.Add(kvp.value);
            }

            Chart TotalNumberOfStepsChart = new Chart(width: 800, height: 400);
            TotalNumberOfStepsChart.AddSeries(chartType: "Line", xValue: TotalNumberOfStepsDatesList,
                yValues: TotalNumberOfStepsList);
            //FatFreeMassChart.SetYAxis(min: 190, max: 230);

            var path = Path.Combine(Server.MapPath("~/Images/userTotalNumberOfSteps"), user.userId.ToString() + ".jpeg");
            TotalNumberOfStepsChart.Save(path);

            user.ImageTotalFloorsClimbledUrl = "../Images/userTotalNumberOfSteps/" + user.userId + ".jpeg";

            return user;
        }
开发者ID:bratao,项目名称:HeathServicesDataAggregator,代码行数:24,代码来源:HomeController.cs

示例10: GetMinutesAsSleepImage

        public User GetMinutesAsSleepImage(User user)
        {
            List<int> MinutesAsSleepList = new List<int>();
            List<string> MinutesAsSleepDatesList = new List<string>();

            foreach (MinutesAsSleep kvp in user.MinutesAsSleepList)
            {

                MinutesAsSleepDatesList.Add(kvp.date);
                MinutesAsSleepList.Add(kvp.value);
            }

            Chart MinutesAsSleepChart = new Chart(width: 800, height: 400);
            MinutesAsSleepChart.AddSeries(chartType: "Line", xValue: MinutesAsSleepDatesList,
                yValues: MinutesAsSleepList);
            //FatFreeMassChart.SetYAxis(min: 190, max: 230);

            var path = Path.Combine(Server.MapPath("~/Images/userMinutesAsSleep"), user.userId.ToString() + ".jpeg");
            MinutesAsSleepChart.Save(path);

            user.ImageMinutesAsSleepUrl = "../Images/userMinutesAsSleep/" + user.userId + ".jpeg";

            return user;
        }
开发者ID:bratao,项目名称:HeathServicesDataAggregator,代码行数:24,代码来源:HomeController.cs

示例11: GetFatRationImage

        public User GetFatRationImage(User user)
        {
            List<double> FatRationList = new List<double>();
            List<string> FatRationDatesList = new List<string>();

            foreach (FatRation kvp in user.FatRationList)
            {

                FatRationDatesList.Add(kvp.date.ToShortDateString());
                FatRationList.Add(kvp.value);
            }

            Chart FatRationChart = new Chart(width: 800, height: 400);
            FatRationChart.AddSeries(chartType: "Line", xValue: FatRationDatesList,
                yValues: FatRationList);
            //FatRationChart.SetYAxis(min: 190, max: 230);

            var path = Path.Combine(Server.MapPath("~/Images/userFatRation"), user.userId.ToString() + ".jpeg");
            FatRationChart.Save(path);

            user.ImageFatRationUrl = "../Images/userFatRation/" + user.userId + ".jpeg";

            return user;
        }
开发者ID:bratao,项目名称:HeathServicesDataAggregator,代码行数:24,代码来源:HomeController.cs

示例12: GetCaloriesImage

        public User GetCaloriesImage(User user)
        {
            List<int> CaloriesList = new List<int>();
            List<string> CaloriesDatesList = new List<string>();

            foreach (Calories kvp in user.CaloriesList)
            {

                CaloriesDatesList.Add(kvp.date);
                CaloriesList.Add(kvp.value);
            }

            Chart CaloriesChart = new Chart(width: 800, height: 400);
            CaloriesChart.AddSeries(chartType: "Line", xValue: CaloriesDatesList,
                yValues: CaloriesList);
            //FatFreeMassChart.SetYAxis(min: 190, max: 230);

            var path = Path.Combine(Server.MapPath("~/Images/userCalories"), user.userId.ToString() + ".jpeg");
            CaloriesChart.Save(path);

            user.ImageFatFreeMassUrl = "../Images/userCalories/" + user.userId + ".jpeg";

            return user;
        }
开发者ID:bratao,项目名称:HeathServicesDataAggregator,代码行数:24,代码来源:HomeController.cs

示例13: SaveThrowsWhenPathIsEmpty

 public void SaveThrowsWhenPathIsEmpty() {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     ExceptionAssert.ThrowsArgNullOrEmpty(() => {
         chart.Save(GetContext(), path: String.Empty, format: "jpeg");
     }, "path");
 }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:6,代码来源:ChartTest.cs

示例14: SaveThrowsWhenFormatIsEmpty

 public void SaveThrowsWhenFormatIsEmpty() {
     var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);
     ExceptionAssert.ThrowsArgNullOrEmpty(() => {
         chart.Save(GetContext(), "chartPath", format: String.Empty);
     }, "format");
 }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:6,代码来源:ChartTest.cs

示例15: TrialReport

        //Shows individual trial report
        public ActionResult TrialReport(int id)
        {
            var trial = _db.Trials.FirstOrDefault(t => t.Id == id);
            if (trial == null)
            {
                ModelState.AddModelError("", "Trial not found");
                return View("Index");
            }
            var m = new Professional_Experience.Models.TrialReportViewModel();
            m.TrialName = trial.Name;
            m.NumberOfMales = trial.Trial_Participant.Where(tp => tp.Participant.Gender == "Male").Count();
            m.NumberOfFemales = trial.Trial_Participant.Count - m.NumberOfMales;
            m.NumberOfInterventionParticipant = trial.Trial_Participant.Where(tp => tp.Classification == PX_Model.Trial_Participant.CLASSIFICATION_INTERVENTION).Count();
            m.NumberOfExperimentalParticipant = trial.Trial_Participant.Count - m.NumberOfInterventionParticipant;

            var xAxisValues = new List<string>();
            var yAxisValues = new List<int>();

            if (m.NumberOfMales != 0)
            {
                xAxisValues.Add("Male");
                yAxisValues.Add(m.NumberOfMales);
            }
            if (m.NumberOfFemales != 0)
            {
                xAxisValues.Add("Female");
                yAxisValues.Add(m.NumberOfFemales);
            }

            //Create gender pie char
            var genderChart = new Chart(width: 600, height: 400)
                .AddTitle("Number of participants according to gender")
                .AddSeries(
                    chartType: "Pie",
                    name: "Trials",
                    xValue: xAxisValues.ToArray(),
                    yValues: yAxisValues.ToArray());
            genderChart.Save("~/Charts/gender.jpg");

            xAxisValues.Clear();
            yAxisValues.Clear();
            if (m.NumberOfInterventionParticipant != 0)
            {
                xAxisValues.Add("Intervention");
                yAxisValues.Add(m.NumberOfInterventionParticipant);
            }
            if (m.NumberOfExperimentalParticipant != 0)
            {
                xAxisValues.Add("Experimental");
                yAxisValues.Add(m.NumberOfExperimentalParticipant);
            }

            //Create classification pie chart
            var classificationChart = new Chart(width: 600, height: 400)
                .AddTitle("Number of participants according to classification")
                .AddSeries(
                    chartType: "Pie",
                    name: "Trials",
                    xValue: xAxisValues.ToArray(),
                    yValues: yAxisValues.ToArray());
            classificationChart.Save("~/Charts/classification.jpg");

            m.BaselineAssessments = new List<TrialReportViewModel.BaselineAssessment>();
            var baselineAssessments = _db.Assessment_Type.Where(ba => ba.Trial_Id == id);

            //Calculate the percentage for each options chosen by the participant while
            //taking the baseline assessment
            foreach (var baselineAssessment in baselineAssessments)
            {
                var baseline = new TrialReportViewModel.BaselineAssessment();
                baseline.Name = baselineAssessment.Name;
                baseline.Questions = new List<TrialReportViewModel.Question>();
                var questions = baselineAssessment.Assessment_Type_Question.Where(q => q.Question_Type != 0);
                foreach (var question in questions) {
                    var options = new List<TrialReportViewModel.Option>();
                    double count = question.Assessment_Type_Question_Answer.Count;
                    foreach (var option in question.Assessment_Type_Option)
                    {
                        var opt = new TrialReportViewModel.Option();
                        opt.Opt = option.Opt;
                        opt.Percentage = ((double)question.Assessment_Type_Question_Answer.Where(qa => qa.Answer == option.Opt).Count() / count) * 100.0;
                        options.Add(opt);
                    }
                    var q = new TrialReportViewModel.Question();
                    q.Q = question.Question;
                    q.Options = options;
                    baseline.Questions.Add(q);
                }
                if (questions.Count() != 0)
                {
                    m.BaselineAssessments.Add(baseline);
                }
            }

            return View(m);
        }
开发者ID:Prads-,项目名称:UWS-RTMS-2015,代码行数:97,代码来源:AdministratorController.cs


注:本文中的Chart.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。