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


C# Highcharts.SetPlotOptions方法代码示例

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


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

示例1: Index

        //
        // GET: /HighChartsSampleModel/
        public ActionResult Index()
        {
            var highchartSample = new List<HighChartsSampleModel>
            {
                new HighChartsSampleModel() {Parameters = "Event", GoodScore = 23.45D, AverageScore = 15.32D,BadScore = 9.4D,ActualScore=78.33D},
                new HighChartsSampleModel() {Parameters = "Weather",GoodScore=45.67D,AverageScore = 33.24D,BadScore = 12.23D,ActualScore = 56.22D},
                new HighChartsSampleModel() {Parameters = "User Review",GoodScore=67.23D,AverageScore = 31.23D,BadScore = 10.11D,ActualScore = 29.44D},
                new HighChartsSampleModel() {Parameters = "Tweets",GoodScore = 89.67D,AverageScore = 12.33D,BadScore = 3.43D,ActualScore = 88.11D},
                new HighChartsSampleModel() {Parameters = "Persona",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 35.08D},
                new HighChartsSampleModel() {Parameters = "Crime",GoodScore=38.34D,AverageScore = 25.34D,BadScore = 16.43D,ActualScore = 24.87D}
            };

            var xDataParameters = highchartSample.Select(i => i.Parameters).ToArray();
            var actualScore = highchartSample.Select(i => i.ActualScore);

            var chart = new Highcharts("chart");
            chart.InitChart(new Chart { DefaultSeriesType = ChartTypes.Bar });
            chart.SetTitle(new Title { Text = "Risk Score Profiling" });
            chart.SetSubtitle(new Subtitle { Text = "Risk predicting using social media" });
            chart.SetXAxis(new XAxis { Categories = xDataParameters });
            chart.SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Scores" }, Max = 100 });
            chart.SetLegend(new Legend { Enabled = false, });
            chart.SetTooltip(new Tooltip
            {
                Enabled = true,
                Formatter = @"function(){return '<b>' + this.series.name +'</b><br/>' + this.x+':' + this.y;}"
            });
            chart.SetPlotOptions(new PlotOptions
            {
                //Series = new PlotOptionsSeries() { Stacking = Stackings.Normal },
                Bar = new PlotOptionsBar
                {
                    DataLabels = new PlotOptionsBarDataLabels { Enabled = true,Color = Color.Maroon,Shadow = true},
                    //PointWidth = 10,
                    //GroupPadding = 1,
                    //PointPadding = 0,
                    Shadow = true,
                    BorderWidth = 1,
                    BorderColor = Color.FloralWhite,
                }
            });
            Data data = new Data(
                actualScore.Select(y => new Point { Color = GetBarColor(y), Y = y}).ToArray()
            );

            chart.SetSeries(new Series { Name = "Actual Score", Data = data });

            return View(chart);
        }
开发者ID:travipl2015,项目名称:UserProfiler,代码行数:51,代码来源:HighChartsSampleController.cs

示例2: ChartOrders

        public ActionResult ChartOrders()
        {
            Highcharts orders = new Highcharts("OrderID");
            orders.SetTitle(new Title() { Text = Resources.Resource.OrdersRoma });
            orders.SetYAxis(new YAxis
            {
                Title = new YAxisTitle() { Text = Resources.Resource.CountRoma },
            });

            //var ord = orderManager.GetQueryableOrders();
            var drivers = userManager.GetQueryableDrivers();

            //var res = ord.Join(drivers, x => x.DriverId, y => y.Id, (x, y) => new { Name = y.UserName, Orders = 1 }).GroupBy(x=>x.Name).ToList();

            List<Series> series = new List<Series>();
            List<object> serieData = new List<object>();

            /*foreach (var i in res)
            {

                Series serie = new Series();
                serie.Name = i.Key;
                serie.Type = ChartTypes.Column;
                serieData.Clear();
                serieData.Add(i.Count());
                serie.Data = new Data(serieData.ToArray());
                series.Add(serie);

            }*/

            orders.SetSeries(series.ToArray());
            orders.SetLegend(new Legend()
            {
                Align = HorizontalAligns.Right,
                Layout = Layouts.Vertical,
                VerticalAlign = VerticalAligns.Top
            });

            orders.SetPlotOptions(new PlotOptions()
            {
                Area = new PlotOptionsArea() { Stacking = Stackings.Normal }
            });

            orders.SetCredits(new Credits() { Enabled = false });

            ViewBag.Order = orders;

            return View();
        }
开发者ID:CH033dotNET,项目名称:Taxi,代码行数:49,代码来源:ReportChartsController.cs

示例3: LineChart

        public static Highcharts LineChart(string chartTitle, Number width, Number height, string[] categories,
            Series[] series, string fakeChartName, string yAxisDescriptions, string chartSubtitle, string pointFormatter,
            string plotOptionsLineMarker)
        {
            var chart = new Highcharts(fakeChartName.Replace(" ", ""))
                .InitChart(new Chart
                {
                    Width = width,
                    Height = height,
                    DefaultSeriesType = ChartTypes.Line,
                })
                .SetTitle(new Title { Text = chartTitle })
                .SetXAxis(new XAxis
                {
                    Categories = categories,
                    Labels =
                        new XAxisLabels
                        {
                            Style = "background: '#ffffff'",
                            Enabled = true,
                            Align = HorizontalAligns.Center
                        }
                })
                .SetYAxis(new YAxis
                {
                    Title = new YAxisTitle { Text = yAxisDescriptions, Style = "background: '#ffffff'" }
                })
                .SetPlotOptions(new PlotOptions
                {
                    Series =
                        new PlotOptionsSeries
                        {
                            DataLabels =
                                new PlotOptionsSeriesDataLabels
                                {
                                    Enabled = false,
                                    Style = "background: '#ffffff'",
                                    Formatter =
                                        @"function() { return '<span style=""font-size:10px; font-family:Calibri"">' + this.y + '</span>' ;}"
                                }
                        }
                })
                .SetTooltip(new Tooltip
                {
                    PointFormat = pointFormatter,
                    Enabled = true,
                    FollowPointer = true,
                    Shared = true,
                    HeaderFormat = "",
                    Crosshairs = new Crosshairs(true)
                })
                .SetLegend(new Legend { BorderWidth = 0 })
                .SetSeries(series ?? new Series[] { })
                .SetCredits(new Credits { Enabled = false });

            if (!string.IsNullOrEmpty(chartSubtitle))
            {
                chart
                    .SetSubtitle(new Subtitle
                    {
                        Style = "color: '#ff0000'",
                        Text = chartSubtitle
                    });
            }

            if (!string.IsNullOrEmpty(plotOptionsLineMarker))
            {
                chart.SetPlotOptions(new PlotOptions
                {
                    Line =
                        new PlotOptionsLine
                        {
                            Marker = new PlotOptionsLineMarker { Symbol = plotOptionsLineMarker, Enabled = true }
                        }
                });
            }

            return chart;
        }
开发者ID:gpierzchala,项目名称:InternetStore,代码行数:79,代码来源:ChartHelper.cs

示例4: GetAreaChart

        private void GetAreaChart()
        {
            DashboardViewModel dashboard = new DashboardViewModel();
            dashboard.ViewModelEvent += dashboard_ViewModelEvent;

            // Get statistics
            List<Dictionary<string, object>> values = dashboard.GetAreaChart();

            if (values != null)
            {
                Highcharts areaChart = new Highcharts("areaChart");
                areaChart.InitChart(new Chart()
                {
                    DefaultSeriesType = ChartTypes.Area,
                    BackgroundColor = new DotNet.Highcharts.Helpers.BackColorOrGradient(Color.Transparent),
                    Height = 300
                });
                areaChart.SetPlotOptions(new PlotOptions()
                {
                    Series = new PlotOptionsSeries()
                    {
                        ConnectNulls = true,
                        ConnectEnds = true
                    }
                });
                areaChart.SetLegend(new DotNet.Highcharts.Options.Legend()
                {
                    Align = DotNet.Highcharts.Enums.HorizontalAligns.Center,
                    Layout = DotNet.Highcharts.Enums.Layouts.Horizontal,
                    VerticalAlign = DotNet.Highcharts.Enums.VerticalAligns.Bottom,
                    BorderWidth = 0
                });
                areaChart.SetCredits(new DotNet.Highcharts.Options.Credits() { Enabled = false });
                areaChart.SetTitle(new DotNet.Highcharts.Options.Title() { Text = "" });

                YAxis yAxis = new YAxis();
                yAxis.Title = new DotNet.Highcharts.Options.YAxisTitle() { Text = "" };
                yAxis.Min = 0;

                XAxis xAxis = new XAxis();
                xAxis.Categories = values[0].Keys.ToArray();

                List<Series> seriesCollection = new List<Series>();

                Series seriesUsers = new Series();
                seriesUsers.Data = new DotNet.Highcharts.Helpers.Data(values[0].Values.ToArray());
                seriesUsers.Name = "Users";
                seriesCollection.Add(seriesUsers);

                Series seriesMailbox = new Series();
                seriesMailbox.Data = new DotNet.Highcharts.Helpers.Data(values[1].Values.ToArray());
                seriesMailbox.Name = "Mailbox";
                seriesCollection.Add(seriesMailbox);

                if (StaticSettings.CitrixEnabled)
                {
                    Series seriesCitrix = new Series();
                    seriesCitrix.Data = new DotNet.Highcharts.Helpers.Data(values[2].Values.ToArray());
                    seriesCitrix.Name = "Citrix";
                    seriesCollection.Add(seriesCitrix);
                }

                areaChart.SetXAxis(xAxis);
                areaChart.SetYAxis(yAxis);
                areaChart.SetSeries(seriesCollection.ToArray());

                litAreaChart.Text = areaChart.ToHtmlString();
            }
            else
                litAreaChart.Text = "Error populating chart.";
        }
开发者ID:blinds52,项目名称:CloudPanel,代码行数:71,代码来源:Dashboard.aspx.cs

示例5: DorinTewst

        private void DorinTewst()
        {
            Queue<string> categoriesQueue = new Queue<string>(new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" });
            for (int i = 0; i < DateTime.Now.Month; i++)
            {
                categoriesQueue.Enqueue(categoriesQueue.Dequeue());
            }
            var categories = categoriesQueue.ToArray();
            Highcharts chart = new Highcharts("FuelConsumptionID");
            chart.SetTitle(new Title() { Text = Resources.Resource.FuelConsumDorin });
            ///var list = orderManager.AnnualFuelConsumption();

            List<object> obList = new List<object>();
            /*foreach (var item in list)
            {
                var iut = (int)item;
                obList.Add((object)iut);
            }*/

            chart.SetYAxis(new YAxis
            {
                Title = new YAxisTitle() { Text = Resources.Resource.FuleLDorin },

            });

            chart.SetXAxis(new XAxis
            {
                Title = new XAxisTitle() { Text = Resources.Resource.FuleMonthDorin },
                Categories = categories
            });

            List<Series> series = new List<Series>();

            Series serie = new Series();
            serie.Name = Resources.Resource.LetresDorin;
            serie.Type = ChartTypes.Column;
            //serie.Data = new Data(serieData.ToArray());
            serie.Data = new Data(obList.ToArray());
            series.Add(serie);

            chart.SetSeries(series.ToArray());
            chart.SetLegend(new Legend()
            {
                Align = HorizontalAligns.Right,
                Layout = Layouts.Vertical,
                VerticalAlign = VerticalAligns.Top
            });

            chart.SetPlotOptions(new PlotOptions()
            {
                Area = new PlotOptionsArea() { Stacking = Stackings.Normal }
            });

            chart.SetCredits(new Credits() { Enabled = false });

            ViewBag.Chart = chart;
        }
开发者ID:CH033dotNET,项目名称:Taxi,代码行数:57,代码来源:ReportChartsController.cs

示例6: DriversIncome

        public void DriversIncome()
        {
            //var DriversInc = orderManager.GetDriversIncome();

            Highcharts driversIncomeChart = new Highcharts("driversChartId");

            driversIncomeChart.SetTitle(new Title() { Text = Resources.Resource.DriversIncome });

            driversIncomeChart.SetXAxis(new XAxis() {
                Title = new XAxisTitle() { Text = @Resources.Resource.Drivers },
                Categories = new string[] {Resources.Resource.Info}
            });
            driversIncomeChart.SetYAxis(new YAxis() {
                Title = new YAxisTitle() { Text = @Resources.Resource.IncomeUAH }});

            List<Series> series = new List<Series>();
            List<object> serieData = new List<object>();

            Series serie = new Series();

            /*foreach (ChartsColumnDTO item in DriversInc)
            {
                serie = new Series();
                serie.Name = item.ColumnName;
                serie.Type = ChartTypes.Column;
                serieData.Clear();
                serieData.Add(new object[] { item.Value });
                serie.Data = new Data(serieData.ToArray());
                series.Add(serie);

            };*/

            driversIncomeChart.SetSeries(series.ToArray());

            driversIncomeChart.SetLegend(new Legend()
            {
                Align = HorizontalAligns.Right,
                Layout = Layouts.Vertical,
                VerticalAlign = VerticalAligns.Top
            });

            driversIncomeChart.SetPlotOptions(new PlotOptions()
            {
                Area = new PlotOptionsArea() { Stacking = Stackings.Normal }
            });

            driversIncomeChart.SetCredits(new Credits() { Enabled = false });
            ViewBag.DriversIncomeChart = driversIncomeChart;
        }
开发者ID:CH033dotNET,项目名称:Taxi,代码行数:49,代码来源:ReportChartsController.cs


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