如何在报表查看器中显示图表中的日期?

时间:2017-01-27 08:58:22

标签: c# charts reportviewer

我问了一个问题

How to show dates in a chart in Excel?

我在Excel中解决了这个问题,但我在报表查看器中遇到了同样的问题。它将数据(与上一年相关)转移到图表的右侧。 我的日期数据是字符串格式。

List<Report> tempList = new List<Report>();

foreach (DataRow row in DT.Rows)
{
    Report temp = new Report();//class
    temp.Row = Convert.ToInt16(row["Row"].ToString());
    temp.Date = row["Date"].ToString();
    temp.Value= Convert.ToDouble(row["Value"].ToString());
    tempList.Add(temp);
}

Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new           Microsoft.Reporting.WinForms.ReportDataSource();
string reportEmbeddedResource = "ETc.Report1.rdlc"; 

reportDataSource1.Name = "DataSet1";
reportDataSource1.Value = this.ReportBindingSource;
this.reportViewer.LocalReport.DataSources.Add(reportDataSource1);
this.reportViewer.LocalReport.ReportEmbeddedResource = reportEmbeddedResource;

this.ReportBindingSource.DataSource = tempList;

this.reportViewer.RefreshReport();

1 个答案:

答案 0 :(得分:0)

行。 在'类别组属性...' - &gt;在“排序”部分中,更改排序类型(如果每行有一个uniqe值)或删除它。