我有2个表:ItemsSold (itemid, cityid, storeid, soldDate)
和SupplyDates (cityid, storeid, supplyDate)
我想创建一个图表,其中Y轴是售出商品的数量,X轴是售出商品的日期。这是代码:
var itemsSold = from i in dc.ItemsSold
where i.cityid == cityid && i.storeid == storeid
group i by i.soldDate.Date into g
select new
{
Day = g.Key.Day + "/" +
g.Key.Month + "/" +
g.Key.Year,
Items = g.Count()
};
但是我想将SupplyDates
附加到X轴上作为标记(没有任何Y值)。
var SupplyDates = from sd in dc.SupplyDates
where sd.storeid == storeid && sd.cityid == cityid
select new { Day = sd.supplyDate, Items = 0 };
答案 0 :(得分:0)
如果对于itemSold和SupplyDates,Day和Items属性的类型和顺序相同,则可以将它们组合成一个新变量:
var combinedData = itemsSold.Concat(SupplyDates);