How to insert a chart as subreport in WPF Report Viewer

Asked

Viewed 195 times

1

I am developing a WPF application and need to insert some charts in a report. I have created two files. RDLC one called Infographic and the other Sub-Fographic. In my subreport I would like to add a chart containing some database information that is obtained through a Dataset.

private void ImpRelatorio(object sender, RoutedEventArgs e)
        {

            RVInfoGrafico.Reset();
            RVInfoGrafico.LocalReport.DataSources.Clear();
            RVInfoGrafico.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(MSubreportProcessingEventHandler);

            DataTable dt = GetData2();
            ReportDataSource rds = new ReportDataSource("DataSet1", dt);
            RVInfoGrafico.LocalReport.DataSources.Add(rds);
            RVInfoGrafico.LocalReport.ReportEmbeddedResource = "Projeto.InfoGrafico.rdlc";

            RVInfoGrafico.ProcessingMode = ProcessingMode.Local;
            RVInfoGrafico.RefreshReport();

        }
        void MSubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
        {
            DataTable dt9 = GetData4();
            e.DataSources.Add(new ReportDataSource("DataSet1",dt9));
        }

Well it turns out that when I insert a chart it always gives an error O Sub-relatório 'Subreport1' não pôde ser encontrado no local especificado Projeto.SubInfoGrafico.rdlc. Verifique se o sub-relatório foi publicado e se o nome está correto. When I insert a table or any other tool works perfectly with the datasets and such... I’m just having trouble with Graph.

  • the value of the source is not correct, right, you have already tried to put @"component-name" or @".. /directory/component/component-name ?

  • @Jcsaint That’s not it. But I already managed to solve the problem is that in my chart I had not configured a group value.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.