我想做一個這樣的高圖http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-labels/我有一個存儲過程,它爲每個月保留的房間類型計數(1月:double 2,triple 4 ..) 我需要傳輸I參數給我Roomtypereservations.RoomTypeByDate(i)中的存儲過程;當我是1我得到月份數據,我是2月2日的數據......高屋建not無法正常工作
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);
}
但我做錯了什麼,因爲我得到這樣的:我的所有的數據都顯示,一月份。我究竟做錯了什麼?
這個問題的狀態是什麼?下面的答案是否適合你?你能在哪裏弄清楚如何正確收集數據? – Linger
是的,它現在爲我工作 – jonny
如果我的回答是什麼幫助你,你能把它標記爲覈准答案嗎?如果你找到了其他解決方案,你可以在問題中加入自己的答案,並將其標記爲已接受?謝謝 – Linger