當前位置: 首頁>>代碼示例>>C#>>正文


C# Chart.SetYAxis方法代碼示例

本文整理匯總了C#中Chart.SetYAxis方法的典型用法代碼示例。如果您正苦於以下問題:C# Chart.SetYAxis方法的具體用法?C# Chart.SetYAxis怎麽用?C# Chart.SetYAxis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Chart的用法示例。


在下文中一共展示了Chart.SetYAxis方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Chart

        public ActionResult Chart(string strid, int acYr)
        {
            ArrayList xValues = new ArrayList();
            ArrayList yValues = new ArrayList();

            var myChart = new Chart(350, 300, ChartTheme.Blue);

            if (acYr == 201617)
            {
               var chart_data = db.Lecture_Attendance_Count_view_201617.Where(t => t.idsubject_faculties == strid).OrderBy(t => t.lecture_no);
                try
                {
                    chart_data.ToList().ForEach(rs => xValues.Add(rs.lecture_no));
                    chart_data.ToList().ForEach(rs => yValues.Add(rs.Total_students));
                }
                catch (Exception e)
                {
                    string msg = e.Message;
                }
                ViewBag.idsubject_faculties = strid;
                myChart = new Chart(350, 300, ChartTheme.Blue);
                myChart.AddSeries(chartType: "Line", xValue: xValues, yValues: yValues);
                myChart.SetXAxis(title: "Lecture No.", min: 1);
                myChart.SetYAxis(title: "No. of Students");

                myChart.AddTitle("Attendance Chart");
                myChart.Write("png");
                //return File(myChart.ToWebImage().GetBytes(), "image/bytes");
            }
            else if(acYr == 201516)
            {
                var chart_data = db.Lecture_Attendance_Count_view.Where(t => t.idsubject_faculties == strid).OrderBy(t => t.lecture_no);
                try
                {
                    chart_data.ToList().ForEach(rs => xValues.Add(rs.lecture_no));
                    chart_data.ToList().ForEach(rs => yValues.Add(rs.Total_students));
                }
                catch (Exception e)
                {
                    string msg = e.Message;
                }
                ViewBag.idsubject_faculties = strid;
                myChart = new Chart(350, 300, ChartTheme.Blue);
                myChart.AddSeries(chartType: "Line", xValue: xValues, yValues: yValues);
                myChart.SetXAxis(title: "Lecture No.", min: 1);
                myChart.SetYAxis(title: "No. of Students");

                myChart.AddTitle("Attendance Chart");
                myChart.Write("png");
                //return File(myChart.ToWebImage().GetBytes(), "image/bytes");
            }

            return File(myChart.ToWebImage().GetBytes(), "image/bytes");
        }
開發者ID:piit,項目名稱:ams,代碼行數:54,代碼來源:FacultyHomeController.cs

示例2: GetChart

        public ActionResult GetChart()
        {
            var user = db.Users.Include("WeightCheckIns").Where(e => e.UserName == HttpContext.User.Identity.Name).FirstOrDefault();
            var weights = user.WeightCheckIns.Select(e => e.Weight).ToList();
            var dates = user.WeightCheckIns.Select(e => e.CheckInDate).ToList();
            var chart = new Chart(width: 600, height: 440, theme: ChartTheme.Blue);
            chart.SetYAxis(min: Convert.ToDouble(Math.Round(weights.Min()) - 1), max: Convert.ToDouble(Math.Round(weights.Max()) + 1));
            chart.AddSeries(
                    name: "Checkins",
                    chartType: "Line",
                    chartArea: null,
                    xValue: dates,
                    xField: "Checkin Dates",
                    yValues: weights,
                    yFields: "Weights").Write();

            return null;
        }
開發者ID:MichaelAndCara,項目名稱:CraftyLosers,代碼行數:18,代碼來源:WeightController.cs

示例3: 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

示例4: BuildHistoryChart

 private Chart BuildHistoryChart(IEnumerable<WirelessScaleData> datas, double minYVal, int width, int height, string title)
 {
     Chart chart = new Chart(
         width: width,
         height: height);
     chart.AddTitle(title);
     //chart.AddLegend(title: "Legend", name: null);
     chart.SetYAxis(min: minYVal);
     ArrayList xValueArray = new ArrayList();
     ArrayList yValuesArray = new ArrayList();
     foreach (WirelessScaleData data in datas)
     {
         xValueArray.Add(data.ReceivedDateTime.ToString("d"));
         yValuesArray.Add(data.Value);
     }
     chart.AddSeries(
             name: "History",
             chartType: "Line",
             axisLabel: "Weight",
             xValue: xValueArray,
             yValues: yValuesArray);
     return chart;
 }
開發者ID:joeferner,項目名稱:fivevolt,代碼行數:23,代碼來源:WirelessScaleController.cs

示例5: BuildChart

        private Chart BuildChart(string name, DateTime startTime, DateTime endTime, 
            List<object> x, List<object> y, string axisX, string axisY)
        {
            var chart = new Chart(300, 300);

            chart.AddTitle(string.Format("{0} {1} {2}",
                name,
                startTime != DateTime.MinValue ? "\nFrom: " + (startTime).ToString("yyyy.MM.dd H:mm"): string.Empty,
                endTime != DateTime.MinValue ? "\nUntil: " + (endTime).ToString("yyyy.MM.dd H:mm") : string.Empty
                ));
            chart.AddSeries(
                xValue: x,
                yValues: y);
            chart.SetXAxis(axisX);
            chart.SetYAxis(axisY);

            return chart;
        }
開發者ID:Fsomogyi,項目名稱:ProjectManager,代碼行數:18,代碼來源:StatisticsController.cs

示例6: GenerateGameChart

        private static Chart GenerateGameChart(IEnumerable<Player> players, int? width, int? height, bool? title)
        {
            var chart = new Chart(width: width ?? DefaultWidth, height: height ?? DefaultHeight);
            if (title ?? true) chart.AddTitle("ELO vs Games");

            var maxGames = int.MinValue;
            var minGames = int.MaxValue;
            var maxRating = int.MinValue;
            var minRating = int.MaxValue;

            foreach (var player in players.OrderBy(p => p.Name))
            {
                var ratings = player.Ratings.OrderBy(r => r.TimeFrom);

                var yValues = ratings.Select(r => r.Value).ToArray();
                var xValues = ratings.Select((x, i) => i).ToArray();

                maxGames = Math.Max(maxGames, xValues.Max());
                minGames = Math.Min(maxGames, xValues.Min());
                maxRating = Math.Max(maxRating, yValues.Max());
                minRating = Math.Min(minRating, yValues.Min());

                chart.AddSeries(
                    name: player.Name,
                    xValue: xValues,
                    yValues: yValues,
                    chartType: "Line");
            }

            chart.SetXAxis("Games", minGames, maxGames);
            chart.SetYAxis("ELO", minRating - 100, maxRating + 100);

            return chart;
        }
開發者ID:MSIH,項目名稱:ELO,代碼行數:34,代碼來源:GraphGeneratorController.cs

示例7: GenerateDateChart

        private static Chart GenerateDateChart(IEnumerable<Player> players, int? width, int? height, bool? title)
        {
            var maxDate = double.MinValue;
            var minDate = double.MaxValue;
            var maxRating = int.MinValue;
            var minRating = int.MaxValue;

            var chart = new Chart(width: width ?? DefaultWidth, height: height ?? DefaultHeight);
            if (title ?? true) chart.AddTitle("ELO vs Time");
            var now = DateTime.UtcNow;

            foreach (var player in players.OrderBy(p => p.Name))
            {
                var ratings = player.Ratings.OrderBy(r => r.TimeFrom).ToList();
                ratings.Add(new Rating { Value = ratings.Last().Value, TimeFrom = now });

                var yValues = ratings.Select(r => r.Value).ToArray();
                var xValues = ratings.Select(r => r.TimeFrom).ToArray();

                maxDate = Math.Max(maxDate, xValues.Max().ToOADate());
                minDate = Math.Min(minDate, xValues.Min().ToOADate());
                maxRating = Math.Max(maxRating, yValues.Max());
                minRating = Math.Min(minRating, yValues.Min());

                chart.AddSeries(
                    name: player.Name,
                    xValue: xValues,
                    yValues: yValues,
                    chartType: "Line");
            }

            chart.SetXAxis("Time", minDate, maxDate);
            chart.SetYAxis("ELO", minRating - 100, maxRating + 100);

            return chart;
        }
開發者ID:MSIH,項目名稱:ELO,代碼行數:36,代碼來源:GraphGeneratorController.cs

示例8: MyChart

        /// <summary>
        /// Render weight graph.
        /// </summary>
        /// <param name="username">The username to display graph for.</param>
        /// <returns></returns>
        public ActionResult MyChart(string username)
        {
            var dates = new List<DateTime>();
            var weights = new List<double>();
            var plots = _context.Users.Find(username).WeightPlots.Where(x=>x.PlotStamp>DateTime.Parse("2015-01-01")).OrderByDescending(x => x.PlotStamp);

            var minWeight = plots.Min(x => x.Weight);
            var maxWeight = plots.Max(x => x.Weight);

            minWeight -= 2;
            maxWeight += 2;

            foreach(var plot in plots)
            {
                dates.Add(plot.PlotStamp);
                weights.Add(Math.Round(plot.Weight,2));
            }

            var chart = new Chart(540,280);
            chart.AddSeries
                (
                chartType: "line",
                xValue: dates,
                yValues: weights
                );
            chart.SetYAxis("", Math.Round(minWeight,1), Math.Round(maxWeight,1));
            chart.Write("png");

            return null;
        }
開發者ID:tiddan,項目名稱:WeightMeas,代碼行數:35,代碼來源:HomeController.cs


注:本文中的Chart.SetYAxis方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。