or
// Get the chart from the subreport
var individualContributionsReportChart = (Telerik.Reporting.Chart)individualContributionsReport.ReportSource.Report.Items[
"labelsGroupHeader"
].Items[
"chart1"
];
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(IsPostBack)
{
TotalContributionsOverviewReport report =
new
TotalContributionsOverviewReport();
var individualContributionsReport = ((Telerik.Reporting.SubReport)(report.Items[
"reportFooter"
].Items[
"IndividualContributionsSubReport"
]));
GetIndividualContributionsChart(individualContributionsReport, startDate, endDate, categoryNameFilter, categoryIdFilter);
ReportViewer1.Report = report;
}
}
private
void
GetIndividualContributionsChart(Telerik.Reporting.SubReport individualContributionsReport,
DateTime startDate, DateTime endDate,
string
categoryNameFilter,
string
categoryIdFilter)
{
// Get the chart from the subreport
var individualContributionsReportChart = (Telerik.Reporting.Chart)individualContributionsReport.ReportSource.Report.Items[
"labelsGroupHeader"
].Items[
"chart1"
];
// Get the chart data
var records = PersistenceFactory.GetRecords();
var categoryGroups = records.GroupBy(r => r.CategoryName);
foreach
(var g
in
categoryGroups)
{
// Create a ChartSeries and assign its name and chart type
ChartSeries chartSeries =
new
ChartSeries();
chartSeries.Name = g.Key;
chartSeries.Type = ChartSeriesType.Line;
// add new items to the series,
// passing a value and a label string
foreach
(var c
in
g)
{
ChartSeriesItem item =
new
ChartSeriesItem()
{
XValue = c.ContributionDate.ToOADate(),
YValue = Convert.ToDouble(c.Amount)
};
chartSeries.Items.Insert(chartSeries.Items.Count, item);
}
// add the series to the Chart Series collection
individualContributionsReportChart.Series.Add(chartSeries);
// format the chart axis
FormatChartAxis(individualContributionsReportChart, startDate, endDate, step);
}
}
defChart.PlotArea.XAxis.DataLabelsColumn =
"DoubleDateTime"
;
defChart.PlotArea.XAxis.IsZeroBased =
false
;
defChart.PlotArea.XAxis.AutoScale =
true
;
defChart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.LongDate;
defChart.PlotArea.XAxis.Appearance.CustomFormat =
"dd HH:mm"
;
defChart.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Inside;
Date Value
2012-07-11 09:40 22
2012-07-11 09:41 15
2012-07-11 09:43 16
2012-07-11 09:43 17
2012-07-11 09:44 16
I followed the wizzard and made no changes to the report layout besides what the wizzard did and when I export to Excel there are two extra blank rows between every row of data. What is causing this?
The report has a labels group header and detail...
How to avoid blank rows? Its urgent.
Thank you
Jayanthi
void chart1_NeedDataSource(object sender, EventArgs e)
{
List<
Product
> products = new List<
Product
>();
products.Add(new Product("Parka L", 120));
products.Add(new Product("Parka M", 100));
products.Add(new Product("Parka S", 132));
Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
defChart.IntelligentLabelsEnabled = false;
ChartSeries serie = new ChartSeries();
serie.Type = ChartSeriesType.Pie;
serie.Clear();
serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
foreach (Product lst in products)
{
ChartSeriesItem item = new ChartSeriesItem();
item.YValue = (double)lst.QuantityInStock;
item.Name = (string)lst.Name;
item.Appearance.Exploded = true;
item.Label.TextBlock.Text = (string)lst.Name + " - #%";
serie.Items.Add(item);
}
defChart.Series.Add(serie);
}