This is a migrated thread and some comments may be shown as answers.

Problem in embedding char in report

0 Answers 13 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
FISCAL
Top achievements
Rank 1
FISCAL asked on 08 Oct 2010, 03:02 PM
Hi,

I have a very simple report. Chart control is placed in detail section of the report. Chart is populated using generic list objects. The problem is that when the report is viewed in the browser, chart contains extra x-axis columns. It looks to me the x-axis items are repeated again and again.

Please see the attachment for detail.

Following method is called only once from the page where reportViewer is embedded.
like 

MyReport rpt = new MyReport();
rpt.PlotChart(2,null,null);
rptViewer.Report = rpt;


public void PlotChart(int processID, DateTime? fromInvoiceDate, DateTime? toInvoiceDate)
        {
            try
            {
                myChart.Series.RemoveSeries();
                myChart.ChartTitle.TextBlock.Text = "Days to Payment";
                myChart.DefaultType = ChartSeriesType.Pie;
                IDashboardRepository dashRep = new DashboardRepository();
                List<MockUpChart> chartData = dashRep.GetMockUpChartData(processID, fromInvoiceDate, toInvoiceDate);

                ChartSeries chartSeries = new ChartSeries();
                chartSeries.Name = "Days to Payment";
                chartSeries.Type = ChartSeriesType.Bar;

                foreach (MockUpChart cDatum in chartData)
                {
                    chartSeries.AddItem(cDatum.TotalNoInvoices, cDatum.DaysToPayment.ToString());
                }

                myChart.PlotArea.XAxis.AxisLabel.Visible = false;
                myChart.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Days to Payment";
                //myChart.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red;

                myChart.PlotArea.YAxis.AxisLabel.Visible = false;
                myChart.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Number of Invoices";
                //myChart.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red;
                
                myChart.Series.Add(chartSeries);
                for (int i = 0; i < myChart.Series.Count; i++)
                {
                    myChart.Series[i].Appearance.LabelAppearance.Visible = false;
                }
            }
            catch (Exception ex)
            {
            }
        }

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
FISCAL
Top achievements
Rank 1
Share this question
or