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


C# Highcharts.SetOptions方法代码示例

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


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

示例1: Index

        //
        // GET: /Home/
        public ActionResult Index()
        {
            DbDataContext dt = new DbDataContext();

             //Fetching data from db:
            var voltageValues = dt.Values.Where(v => v.FieldName == "Voltage").OrderBy(v => v.Datetime).ToList<Value>();
            var currentValues = dt.Values.Where(v => v.FieldName == "Current").OrderBy(v => v.Datetime).ToList<Value>();

            Highcharts Chart = new Highcharts("Chart");
            // Initiizing chart
            // Making month and days persian, however it is not accurate at all!
            Chart.SetOptions(new GlobalOptions
            {
                Lang = new DotNet.Highcharts.Helpers.Lang
                {
                    Loading = "در حال بارگذاری",
                    Months = new string[] { "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند" },
                    Weekdays = new string[] { "شنبه", "یک شنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنج شنبه", "جمعه" },
                    ShortMonths = new string[] { "فرور", "اردی", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند" }
                }
            });
            Chart.InitChart(new Chart
                {
                    DefaultSeriesType = ChartTypes.Line,
                    MarginRight = 130,
                    MarginBottom = 55,
                    ClassName = "chart",
                    ZoomType = ZoomTypes.X
                })
            .SetTitle(new Title
                {
                    Text = "نمودار تغییرات داده ها "
                })
            .SetSubtitle(new Subtitle
                {
                    Text = "نمونه استفاده نمودار",
                    X = -20
                })
            .SetXAxis(new XAxis
                {
                    Type = AxisTypes.Datetime,
                    Title = new XAxisTitle
                    {
                        Text = "بازه زمانی از ... تا..."
                    },
                    MinorTickInterval = 3600 * 1000,
                    TickLength = 1,
                    MinRange = 3600 * 1000,
                    MinTickInterval = 3600 * 1000,
                    GridLineWidth = 1,
                    Labels = new XAxisLabels
                    {
                        Align = HorizontalAligns.Right,
                        Rotation = -30,
                    },
                    DateTimeLabelFormats = new DateTimeLabel
                    {
                        Second = "%H:%M:%S",
                        Minute = "%H:%M",
                        Hour = "%H:%M",
                        Day = "%e %b",
                        Week = "%e %b",
                        Month = "%b",
                        Year = "%Y",
                    },
                    ShowEmpty = false,

                })
                .SetLegend(new Legend
                {
                    Layout = Layouts.Vertical,
                    Align = HorizontalAligns.Left,
                    X = 20,
                    VerticalAlign = VerticalAligns.Top,
                    Y = 80,
                    BackgroundColor = new BackColorOrGradient(System.Drawing.ColorTranslator.FromHtml("#FFFFFF"))
                });

            YAxis[] yAxis = new YAxis[2];
            yAxis[0] = (new YAxis
            {
                Title = new YAxisTitle
                {
                    Text = string.Format("{0} ({1})", "Voltage", "V"),

                },
                Labels = new YAxisLabels
                {
                    //Align = HorizontalAligns.Right,
                    Formatter = "function() { return this.value; }",
                },
                Opposite = true,
                GridLineWidth = 0
            });
            yAxis[1] = (new YAxis
            {
                Title = new YAxisTitle
                {
//.........这里部分代码省略.........
开发者ID:charreal,项目名称:HighchartsDbSample,代码行数:101,代码来源:HomeController.cs


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