Session 在Devexpress中报告图表数据源的会话数据

Session 在Devexpress中报告图表数据源的会话数据,session,devexpress,Session,Devexpress,我想对数据源报告图表使用会话[CountryList“] 我将图表添加到报告中,但没有代码 如何将会话[CountryList”]添加为数据源并在报表图表中显示 型号: public static IList<Country> GetCountries() { return new List<Country>(){ new Country("Russia", 50), new Country("Canada", 231), new Country("USA", 33),

我想对数据源报告图表使用会话[CountryList“]

我将图表添加到报告中,但没有代码

如何将会话[CountryList”]添加为数据源并在报表图表中显示

型号:

public static IList<Country> GetCountries()
{
return new List<Country>(){
new Country("Russia", 50),
new Country("Canada", 231),
new Country("USA", 33),
new Country("China", 111),
new Country("Brazil", 14),
new Country("Australia", 140),
new Country("India", 434),
new Country("Turkey", 3),
new Country("England", 21),
new Country("Greece", 116)
};
}
}
public class Country
{
string name;
double area;
public string Name { get { return name; } }
public double Area { get { return area; } }
public Country(string name, double area)
{
this.name = name;
this.area = area;
}
}

我用你的模型数据试过了

下面的代码也适用于您

public ActionResult ExportReportViewer()
{
XtraReport1 report = new CrmSoner.Reports.XtraReport1();
XRChart chart = report.FindControl("xrChart1", true) as XRChart;
List<Country> list = Session["CountriesDatas"] as List<Country>;
chart.DataSource = list;
chart.Series[0].ArgumentDataMember = "Name";
chart.Series[0].ValueDataMembers.Clear();
chart.Series[0].ValueDataMembers.AddRange(new string[] { "Area" });

return DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(report);
}
public ActionResult ExportReportViewer()
{
XtraReport1 report=新的CrmSoner.Reports.XtraReport1();
XRChart chart=report.FindControl(“xrChart1”,true)作为XRChart;
列表=会话[“CountriesDatas”]作为列表;
chart.DataSource=list;
chart.Series[0].ArgumentDataMember=“Name”;
chart.Series[0]。ValueDataMembers.Clear();
chart.Series[0].ValueDataMembers.AddRange(新字符串[]{“区域”});
返回DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(报告);
}
public ActionResult ExportReportViewer()
{
XtraReport1 report = new CrmSoner.Reports.XtraReport1();
XRChart chart = report.FindControl("xrChart1", true) as XRChart;
List<Country> list = Session["CountriesDatas"] as List<Country>;
chart.DataSource = list;
chart.Series[0].ArgumentDataMember = "Name";
chart.Series[0].ValueDataMembers.Clear();
chart.Series[0].ValueDataMembers.AddRange(new string[] { "Area" });

return DevExpress.Web.Mvc.ReportViewerExtension.ExportTo(report);
}