我想制作这样的高图http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-labels/我有一个存储过程,计算每个月保留的所有房间类型(一月:双 2,三倍 4 ..)我需要将 I 参数传输到 Roomtypereservations.RoomTypeByDate(i) 中的存储过程;当 i 为 1 时,我得到 1 月的数据,i 为 2 月的数据......
public ActionResult Gresit()
{
DBContext.Current.Open();
List<Series> allSeries = new List<Series>();
List<Roomtypereservations> rezervari = new List<Roomtypereservations>();
for (int i =1; i < 13; i++)
{
rezervari = Roomtypereservations.RoomTypeByDate(i);
var results = new object[4];
foreach (var a in rezervari)
{
results = (new object[] { a.NumRezervari });
allSeries.Add(new Series
{
Name = a.Room_Type,
//Data = new Data(myData)
Data = new Data(results.ToArray())
});
}
};
Highcharts charts = new Highcharts("chart")
.InitChart(new Chart { DefaultSeriesType = ChartTypes.Spline, })
.SetTitle(new Title { Text = "Gradul De Ocupare pe luni" })
.SetXAxis(new XAxis { Categories = Reservation.Categories })
.SetYAxis(new YAxis
{
Title = new YAxisTitle { Text = "Numarul de Camere" },
Labels = new YAxisLabels { Step = 5, Formatter = "function() { return this.value}" }
})
.SetTooltip(new Tooltip
{
Crosshairs = new Crosshairs(true),
Shared = true
})
.SetPlotOptions(new PlotOptions
{
Spline = new PlotOptionsSpline
{
Marker = new PlotOptionsSeriesMarker
{
Radius = 4,
LineColor = ColorTranslator.FromHtml("#666666"),
LineWidth = 1
}
}
})
.SetSeries(allSeries.Select(s => new Series { Name = s.Name, Data = s.Data }).ToArray());
return View(charts);
}
但我做错了,因为我明白了:我的所有数据都显示为 1 月。我究竟做错了什么?