本文整理汇总了C#中DotNet.Highcharts.Highcharts.SetXAxis方法的典型用法代码示例。如果您正苦于以下问题:C# Highcharts.SetXAxis方法的具体用法?C# Highcharts.SetXAxis怎么用?C# Highcharts.SetXAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNet.Highcharts.Highcharts
的用法示例。
在下文中一共展示了Highcharts.SetXAxis方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AllGoalsByMonthNet
public string AllGoalsByMonthNet()
{
var now = DateTime.Now;
var currentMonth = new DateTime(now.Year, now.Month, 1);
var startDate = currentMonth.AddYears(-1);
var highchart = new Highcharts("AllGoalsMonth");
var chart = new Chart()
{
Type = ChartTypes.Column
};
highchart.InitChart(chart);
highchart.SetTitle(new Title() {Text = "Goals by Month"});
var yaxis = new YAxis {Max = 2};
highchart.SetYAxis(yaxis);
var series = new Series {Name = "Steps"};
var xaxis = new XAxis();
var categories = new List<string>();
var data = new List<object>();
for (var i = startDate; i <= currentMonth; i = i.AddMonths(1))
{
categories.Add(i.Month.ToString() + "-" + i.Year.ToString());
data.Add(pedometerCalcService.MonthPct(i.Month, i.Year));
}
xaxis.Categories = categories.ToArray();
series.Data = new Data(data.ToArray());
highchart.SetXAxis(xaxis);
highchart.SetSeries(series);
return highchart.ToHtmlString();
}
示例2: 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);
}
示例3: Contact
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
var lists = new List<HomeModel>{
new HomeModel(){ Date = new DateTime(2015, 08, 10), Weight = 232.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 11), Weight = 232.6 },
new HomeModel(){ Date = new DateTime(2015, 08, 12), Weight = 233 },
new HomeModel(){ Date = new DateTime(2015, 08, 13), Weight = 232.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 14), Weight = 233.4 },
new HomeModel(){ Date = new DateTime(2015, 08, 15), Weight = 233 },
new HomeModel(){ Date = new DateTime(2015, 08, 16), Weight = 233 },
new HomeModel(){ Date = new DateTime(2015, 08, 17), Weight = 232.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 18), Weight = 231.2 },
new HomeModel(){ Date = new DateTime(2015, 08, 19), Weight = 231.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 20), Weight = 230.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 21), Weight = 231.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 22), Weight = 231 },
new HomeModel(){ Date = new DateTime(2015, 08, 23), Weight = 230.2 },
new HomeModel(){ Date = new DateTime(2015, 08, 24), Weight = 232.2 },
new HomeModel(){ Date = new DateTime(2015, 08, 25), Weight = 232 },
new HomeModel(){ Date = new DateTime(2015, 08, 26), Weight = 231.6 },
new HomeModel(){ Date = new DateTime(2015, 08, 27), Weight = 230 },
new HomeModel(){ Date = new DateTime(2015, 08, 28), Weight = 230 },
new HomeModel(){ Date = new DateTime(2015, 08, 29), Weight = 231.4 },
new HomeModel(){ Date = new DateTime(2015, 08, 30), Weight = 231.8 },
new HomeModel(){ Date = new DateTime(2015, 08, 31), Weight = 230.6 },
new HomeModel(){ Date = new DateTime(2015, 09, 01), Weight = 230.4 },
new HomeModel(){ Date = new DateTime(2015, 09, 02), Weight = 229.2 },
new HomeModel(){ Date = new DateTime(2015, 09, 03), Weight = 229.8 },
new HomeModel(){ Date = new DateTime(2015, 09, 04), Weight = 230 },
new HomeModel(){ Date = new DateTime(2015, 09, 05), Weight = 229.4 },
new HomeModel(){ Date = new DateTime(2015, 09, 06), Weight = 230.2 },
new HomeModel(){ Date = new DateTime(2015, 09, 07), Weight = 229.4 },
new HomeModel(){ Date = new DateTime(2015, 09, 08), Weight = 228.8 }
};
var xDataDate = lists.Select(x => x.Date).ToArray();
string[] xDate = xDataDate.Select(x => x.ToString("yyyy/MM/dd")).ToArray();
var yDataWeight = lists.Select(x => new object[] { x.Weight }).ToArray();
var chart = new Highcharts("charts");
chart.InitChart(new Chart { DefaultSeriesType = ChartTypes.Line });
chart.SetTitle(new Title { Text = "Weight for last month" });
chart.SetSubtitle(new Subtitle { Text = "August 8 - September 8" });
chart.SetXAxis(new XAxis { Categories = xDate });
chart.SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Weight in lbs" } })
.SetTooltip(new Tooltip
{
Enabled = true,
Formatter = @"function() { return '<b>' + this.series.name + '</b><br/>' + this.x +': ' + this.y; }"
})
.SetPlotOptions(new PlotOptions
{
Line = new PlotOptionsLine
{
DataLabels = new PlotOptionsLineDataLabels
{
Enabled = true
},
EnableMouseTracking = false
}
})
.SetSeries(new[] {
new Series{ Name = "Date", Data = new Data(yDataWeight)},
});
return View(chart);
}
示例4: _SingleLine
public ActionResult _SingleLine()
{
Series series = new Series
{
Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
};
XAxis xaxis = new XAxis
{
Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
};
Highcharts chart = new Highcharts("chart_single_line");
chart.SetXAxis(xaxis);
chart.SetSeries(series);
return PartialView(new SmartCity.Models.Global.HighchartModel { highChart=chart });
}
示例5: 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.";
}
示例6: CurrentMonthGoalProgressNet
public string CurrentMonthGoalProgressNet()
{
var now = DateTime.Now;
var daysInMonth = DateTime.DaysInMonth(now.Year, now.Month);
var expectedPct = ((decimal)now.Day / daysInMonth);
var remainingDays = daysInMonth - now.Day;
var stepsPR = pedometerCalcService.StepsPR();
var remainingSteps = (int) (stepsPR-pedometerCalcService.MonthStepsActual())/remainingDays;
var highchart = new Highcharts("CurrentMonthGoal");
var chart = new Chart() {Type = ChartTypes.Bar};
var categories = new List<string> {"Steps"};
var yaxis = new YAxis {Max = 1};
var seriesArray = new List<Series>();
var series = new Series {Name = "Expected",Color = Color.Red};
var data = new List<object> {pedometerCalcService.MonthPctExpected(now)};
var plotoptions = new PlotOptionsBar
{
Grouping = false,
Shadow = false,
DataLabels = new PlotOptionsBarDataLabels()
{
Enabled = false,
Format = string.Format("Expected: {0}", (int) (stepsPR*expectedPct)),
Color = Color.White
}
};
series.Data = new Data(data.ToArray());
series.PlotOptionsBar = plotoptions;
seriesArray.Add(series);
series = new Series {Name = "Actual", Color = Color.Green};
data = new List<object> { pedometerCalcService.MonthPct(now.Month, now.Year) };
plotoptions = new PlotOptionsBar
{
Grouping = false,
Shadow = false,
DataLabels = new PlotOptionsBarDataLabels()
{
Enabled = true,
Format = string.Format("Remaining: {0}/day", remainingSteps),
Color = Color.White,
Shadow = false
}
};
series.Data = new Data(data.ToArray());
series.PlotOptionsBar = plotoptions;
seriesArray.Add(series);
highchart.InitChart(chart);
highchart.SetTitle(new Title() {Text = "Month Progress"});
highchart.SetXAxis(new XAxis() {Categories = categories.ToArray()});
highchart.SetYAxis(yaxis);
highchart.SetSeries(seriesArray.ToArray());
highchart.SetTooltip(new Tooltip() {Enabled = false});
return highchart.ToHtmlString();
}
示例7: 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;
}
示例8: YearIncome
public ActionResult YearIncome()
{
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("IncomeByMonthes");
chart.SetTitle(new Title() { Text = Resources.Resource.AllDriversIncomeHeader });
//var list = orderManager.YearIncome().ToList();
/*var data = list.Select(x => (object)x).ToArray();
chart.SetSeries(new Series()
{
Name = Resources.Resource.TotalDriversIncomeA,
Type = ChartTypes.Column,
Data = new Data(data)
});*/
chart.SetXAxis(new XAxis()
{
Categories = categories
});
chart.SetYAxis(new YAxis() { Title = new YAxisTitle() { Text = Resources.Resource.ValuesAsix } });
return PartialView(chart);
}
示例9: GrafickOf10TopClients
public Highcharts GrafickOf10TopClients()
{
Highcharts chart = new Highcharts("OrdersReport");
chart.SetTitle(new Title() { Text = Resources.Resource.OrderStatisticMax });
chart.SetSubtitle(new Subtitle() { Text = Resources.Resource.To10ClientsMax });
chart.SetYAxis(new YAxis() { Title = new YAxisTitle() { Text = Resources.Resource.OrderIncomeMax } });
chart.SetXAxis(new XAxis() { Title = new XAxisTitle() { Text = Resources.Resource.AmountOfOrdersMax } });
List<Series> series = new List<Series>();
List<object[]> data = new List<object[]>();
/*foreach (var client in orderManager.GetTop10())
{
Series serie = serie = new Series();
serie.Type = ChartTypes.Column;
serie.Name = client.Select(x => x.Person.FirstName).First(); ;
data.Clear();
data.Add(new object[] { client.Count(), client.Sum(x => x.TotalPrice) });
serie.Data = new Data(data.ToArray());
series.Add(serie);
}
chart.SetSeries(series.ToArray());
chart.SetLegend(new Legend()
{
Align = HorizontalAligns.Right,
Layout = Layouts.Vertical,
VerticalAlign = VerticalAligns.Top
});*/
return chart;
}
示例10: 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;
}