Telerik Forums
Reporting Forum
2 answers
253 views
Hello,

I'm trying to produce a Line chart that will show me the evolution of the amount of issues for each category over time.
I'm not being able to acomplish it.

I'm looping through a List of categories and for each category I'm creating a ChartSeries where I'm adding ChartSeriesItems containing as YValue their count.

As a side note, for each category I'm fetching its associated Issues and then I'm groupping them by the month and year part of its creation date.

The final output is exactly what I need but...When I run the chart, the dates are showing up on the Y axis (hey what?!!) although I'm explicitly assigning the count of Issues to the YValue of each ChartSeriesItem!

Here's my code (the important part of it) :

I have an IEnumerable that creates my ChartSeries (each category will be a serie):

        private IEnumerable<ChartSeries> CategoryEvolutionSeries(Telerik.Reporting.Chart chart)  
        {  
 
             
            var cats = issues.GroupBy(x => x.CategoryName);  
            List<string> Categorias = new List<string>();  
 
            foreach (var cat in cats)  
            {  
                Categorias.Add(cat.Key);  
            }  
 
 
            foreach (string cat in Categorias)  
            {  
                var IssuesPerCat = issues.Where(x => x.CategoryName == cat);  
                var group = IssuesPerCat.GroupBy(x => x.DateCreated.ToString("yyyy/MM"));  
 
                ChartSeries series = new ChartSeries();  
                series.Appearance.PointMark.Dimensions.Width = 5;  
                series.Appearance.PointMark.Dimensions.Height = 5;  
                series.Appearance.PointMark.FillStyle.MainColor = Color.Black;  
                series.Appearance.PointMark.Visible = true;  
 
                group = group.OrderBy(x => x.Key);  
 
                series.Appearance.LabelAppearance.Visible = false;  
                series.Appearance.ShowLabels = true;  
                series.Name = cat;  
                series.Type = ChartSeriesType.Line;  
 
                foreach (var issue in group)  
                {  
                    ChartSeriesItem item = new ChartSeriesItem();  
                    item.YValue = issue.Count();  
                    series.Items.Add(item);  
                }  
 
                yield return series;  
 
 
            }  
 
        } 

Then, I assign the series to my chart on the NeedDataSource Event:

                defChart.Series.Clear();  
 
                foreach (ChartSeries item in evolseries)  
                {  
                    defChart.Series.Add(item);  
                } 

Since I can't send you the project files (they're part of a big big solution with lots of dependencies) I'm attaching a screenshot of the resulting Chart.

Please help, what am I doing wrong here??
Ves
Telerik team
 answered on 26 May 2010
1 answer
138 views
Hello,

I have tried every single example found to set my XAxis values but none of them seems to work for me.
I'm populating a Line chart manually with a List of objects and it works just fine. I am also setting the XAxis ValueFormat to ShortDate and whatever I do, this includes clearing the collection of ChartAxisItems and adding with my own, I only get dates in the range of 1899/01/01...1900/01/01 etc etc even when I'm explicitly adding items with dates like "2010-01-01...2010-06-01" in OADate format.
I tried to set the Min and Max values of my XAxis to 01/01/2010 to 01/07/2010 but it doesn't produce any effect.


Here's some code because I know you'll ask:

NeedDataSource Event:
 chart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Reporting.Charting.Styles.ChartValueFormat.ShortDate;  
              
            List<Issue> issues = new List<Issue>();  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-01-2010")});  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-01-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-01-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-02-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-02-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-03-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-04-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-04-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-04-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-04-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-04-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-05-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-05-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-05-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-06-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-06-2010") });  
            issues.Add(new Issue() { CategoryName = "Teste1"DueDate = DateTime.Parse("01-06-2010") });  
 
 
            var cats = issues.GroupBy(x => x.CategoryName);  
 
            List<string> Categorias = new List<string>();  
            chart1.Series.Clear();  
 
            chart1.PlotArea.XAxis.MinValue = DateTime.Parse("01-01-2010").ToOADate();  
            chart1.PlotArea.XAxis.MaxValue = DateTime.Parse("01-07-2010").ToOADate();  
            foreach (var cat in cats)  
            {  
                Categorias.Add(cat.Key);  
            }  
 
 
            foreach (string categoria in Categorias)  
            {  
                var issuesissuesPerCat = issues.Where(x => x.CategoryName == categoria);  
                var groupedIssues = issuesPerCat.GroupBy(x => x.DueDate.ToString("dd/MM/yyyy"));  
 
                ChartSeries series = new ChartSeries();  
                series.Type = ChartSeriesType.Line;  
 
 
                foreach (var issue in groupedIssues)  
                {  
                    ChartSeriesItem csitem = new ChartSeriesItem();  
                    csitem.YValue = issue.Count();  
                    series.Items.Add(csitem);  
                    chart1.PlotArea.XAxis.AddItem(issue.Key);  
                     
                }  
 
 
                chart1.Series.Add(series);  
            } 

and in the attached file is the result of this code...

P.S.: For the record, I'm using the latest version of Q1 2010 (Version=4.0.10.423)

 

Antonio Simoes
Top achievements
Rank 1
 answered on 26 May 2010
1 answer
206 views
Hello,

I'm new here and testing the report tool.

I am trying to create a template (report) for our orders to suppliers.
I like to pass my Order object as datasource what works fine. So i can put info in the report about my supplier (name,address,...)
about my company (name, phone,....). Those two are subobjects of Order (Supplier and Company). So i can access fields from those subobjects of Order.

Now the problem starts with my OrderLines when Order is my datasource i can't use my object orderline that is in the collection OrderLines (this OrderLinesCollection is an object of Order). The expression would look like this =Fields.OrderSupplierLineCollection.Item.Product.Family. Seems i can't reach item in a collection?
Error i get after using the tablewizard : 
An error has occured while processing TextBox 'textBox19':
Common Language Runtime detected an invalid program.
I tryed to do this with a tablewizard and a subreport. (did not find an example that covers this)

So we want a total dynamic orderreport. Company,supplier,lines is all dynamic.
In the header we put the contactinfo of our company and the supplier. In the detail of the report we would like to see our orderlines.
This all with just one Order object that contains all the info.

Is this possible? Where am i going wrong?
Kind Regards,

Koen L
Top achievements
Rank 1
 answered on 26 May 2010
3 answers
201 views
Hi,

How can i have multiple series in chart? How can i create it programmatically? See attached images of my requirement. I don't find any sample on the web. Pls help me on how to proceed for this.

Thanks in advance.
Steve
Telerik team
 answered on 26 May 2010
5 answers
83 views

I have several reports that are built dynamically that stopped working after we upgraded to the Q3 2009 release, using version 3.2.9.1211. I tried setting the ReportViewer's EnableViewState property to false and that had no impact on the problem. When the report is generated a 1-page blank report appears.

 

I took one of the Telerik sample provided on this forum and put it in a small, much simpler project. I receive the exact sample behavior. Here is the code that I am using:

 

using

 

System;

 

 

 

using

 

System.Web;

 

 

 

using

 

System.Web.UI;

 

 

 

using

 

System.Web.UI.WebControls;

 

 

 

using

 

System.Data;

 

 

 

using

 

System.Configuration;

 

 

 

using

 

System.Web.Security;

 

 

 

using

 

System.Web.UI.WebControls.WebParts;

 

 

 

using

 

System.Web.UI.HtmlControls;

 

 

 

using

 

Telerik.Web.UI;

 

 

 

using

 

Telerik.Reporting;

 

 

 

using

 

Telerik.Reporting.Drawing;

 

 

 

public

 

partial class Default : System.Web.UI.Page

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

{

Telerik.Reporting.

Report rpt = new Telerik.Reporting.Report();

 

 

DataSet ds = new DataSet();

 

ds.Tables.Add();

 

DataTable table = ds.Tables[0];

 

 

int columnCount = 3;

 

 

int rowCount = 1000;

 

 

//Add columns

 

 

 

 

 

for (int column = 0; column <= columnCount - 1; column++)

 

{

table.Columns.Add(

"Column" + (column + 1).ToString(), typeof(string));

 

}

 

//Add rows

 

 

 

 

 

for (int row = 0; row <= (rowCount - 1); row++)

 

{

 

string[] rowVals = (string[])Array.CreateInstance(typeof(string), columnCount);

 

 

DataRowCollection rowCollection = table.Rows;

 

 

for (int column = 0; column <= columnCount - 1; column++)

 

{

rowVals[column] =

"value_" + (column + 1).ToString() + "_" + (row + 1).ToString();

 

}

table.Rows.Add(rowVals);

}

rptViewer.Report = GenerateReportDefinition(

ref ds);

 

rptViewer.RefreshReport();

}

 

private Telerik.Reporting.TextBox CreateTxtHeader(string FieldName, int i)

 

{

Telerik.Reporting.

TextBox txtHead = new Telerik.Reporting.TextBox();

 

txtHead.Value = FieldName;

 

return txtHead;

 

}

 

private Telerik.Reporting.TextBox CreateTxtDetail(string FieldName, int i)

 

{

Telerik.Reporting.

TextBox txtHead = new Telerik.Reporting.TextBox();

 

txtHead.Value =

"=[" + FieldName + "]";

 

 

return txtHead;

 

}

Telerik.Reporting.

Report GenerateReportDefinition(ref System.Data.DataSet dataSource)

 

{

Telerik.Reporting.

Report report1 = new Telerik.Reporting.Report();

 

report1.DataSource = dataSource;

 

int count = dataSource.Tables[0].Columns.Count - 1;

 

Telerik.Reporting.Drawing.

Unit x = Telerik.Reporting.Drawing.Unit.Inch(0);

 

Telerik.Reporting.Drawing.

Unit y = Telerik.Reporting.Drawing.Unit.Inch(0);

 

 

SizeU size = new SizeU(Telerik.Reporting.Drawing.Unit.Cm(2), Telerik.Reporting.Drawing.Unit.Inch(0.3));

 

Telerik.Reporting.

ReportItemBase[] headColumnList = new Telerik.Reporting.ReportItem[count];

 

Telerik.Reporting.

ReportItemBase[] detailColumnList = new Telerik.Reporting.ReportItem[count];

 

 

for (int column = 0; column < count; column++)

 

{

 

string columnName = dataSource.Tables[0].Columns[column].ColumnName;

 

Telerik.Reporting.

TextBox header = this.CreateTxtHeader(columnName, column);

 

header.Location =

new Telerik.Reporting.Drawing.PointU(x, y);

 

header.Size = size;

headColumnList[column] = header;

Telerik.Reporting.

TextBox textBox = this.CreateTxtDetail(columnName, column);

 

textBox.Location =

new Telerik.Reporting.Drawing.PointU(x, y);

 

textBox.Size = size;

detailColumnList[column] = textBox;

x += Telerik.Reporting.Drawing.

Unit.Inch(1);

 

}

Telerik.Reporting.

ReportHeaderSection reportHeaderSection1 = new Telerik.Reporting.ReportHeaderSection();

 

reportHeaderSection1.Height =

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch);

 

 

//reportHeaderSection1.Style.BackgroundColor = Color.LightGray;

 

 

 

 

reportHeaderSection1.Items.AddRange(headColumnList);

Telerik.Reporting.

DetailSection detailSection1 = new Telerik.Reporting.DetailSection();

 

detailSection1.Height =

new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch);

 

detailSection1.Items.AddRange(detailColumnList);

report1.Items.Add(reportHeaderSection1);

report1.Items.Add(detailSection1);

 

return report1;

 

}

}

Valerie
Top achievements
Rank 1
 answered on 26 May 2010
2 answers
240 views
I have a project with Silverlight Reporting that works fine in dev. environment.
But in production i have this error on ReportViewer: 'An exception ocurred during the operation, making the result invalid. Check InnerException for exception details'.
My server is a virtual server.
I try to access the ReportService.svc, but have the  following error:
The type 'Telerik.Reporting.Service.ReportService, Telerik.Reporting.Service, Version=4.0.10.423, Culture=neutral, PublicKeyToken=a9d7983dfcc261be', provided as the Service attribute value in the ServiceHost directive could not be found
I´m not sure if is correct this response from ReportService.svc, in dev. enviroment the service is found fine.

I´m using Telerik Reporting Q1 2010, VS 2010 RTM,

I need to change something in configuration of server?

Thanks in advance.
Onaji Fernanda
Top achievements
Rank 1
 answered on 25 May 2010
1 answer
2.2K+ views
Hi there,

I am trying Telerik Reports, I need to include multiple detail sections in my reports, I have searched for this in forum and documentation, but i was unable to find this. I just wanted to know Is this feature available in telerik, If yes, can you suggest me how to do this?


Thanx.
Peter
Telerik team
 answered on 25 May 2010
4 answers
110 views
Hi
 I need to build a report comprising several diferent pages but all based on the same underlying data. For example the first page would be a summary of all data, the next few pages would be detailed information thqt was used to create the summary, then some text pages displaying written text ect.

I was going down the route of creating a separate report for each and using the ReportBook to bring them all together.

I'm thinking I could also do this with sub reports for each of the sections, which would be the prefered approach.

Andy
Peter
Telerik team
 answered on 25 May 2010
3 answers
207 views
what is the best way to troubleshoot when your datasource isn't working?

The Fields in the datasource just don't show up when trying to access them.   I need to pull data from an Entity Framework data source.
In the code below, I put everything into a simple class, like your Cars example.

I have created an ObjectDataSource which uses the call to Submissions.GetSubmissions().   I have assigned this datasource to the Report and an embedded list   Everything compiles without errors, but when I try to set a textbox to a field value, I don't see any fields, I just see, "No datasource".

I am using the newly released 2010 version of Telerik Reporting in Visual Studio 2008.

Suggestions?
Is there a walk through that I should be using?

Thanks,
   - Daniel

using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.Configuration;  
using System.Linq;  
using System.Text;  
using DatabaseLayer;  
using log4net;  
 
namespace PCIIReports  
{  
    public class RSubmission  
    {  
        private Guid _submissionID;  
        private string _cikrName;  
        private string _cikrCountry;  
        private string _cikrState;  
 
        public RSubmission() { }  
 
        public RSubmission(Guid submissionId, String cikrName, string cikrCountry, string cikrState)  
        {  
            _submissionID = submissionId;  
            _cikrName = cikrName;  
            _cikrCountry = cikrCountry;  
            _cikrState = cikrState;  
        }  
 
        public Guid SubmissionId  
        {  
            get { return _submissionID; }  
            set { _submissionID = value; }  
        }  
 
        public String CIKRName  
        {  
            get { return _cikrName; }  
            set { _cikrName = value; }  
        }  
 
        public String CIKRCountry  
        {  
            get { return _cikrCountry; }  
            set { _cikrCountry = value; }  
        }  
 
        public String CIKRState  
        {  
            get { return _cikrState; }  
            set { _cikrState = value; }  
        }  
    }  
 
    public class Submissions  
    {  
        private static readonly ILog Log =  
            LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);  
 
        static string GetConnectionStringByName(string name)  
        {  
            // Assume failure.  
            string returnValue = null;  
 
            // Look for the name in the connectionStrings section.  
            ConnectionStringSettings settings =  
                ConfigurationManager.ConnectionStrings[name];  
 
            // If found, return the connection string.  
            if (settings != null)  
                returnValue = settings.ConnectionString;  
 
            return returnValue;  
        }  
 
        public Submissions()  
        {  
        }  
 
        public List<RSubmission> GetSubmissions()  
        {  
            var connectionString = GetConnectionStringByName("pciidbContext");  
 
            var context = new pciidbContext(connectionString);  
 
            var query =  
                from submission in 
                    context.Submissions.Include("Submitter").Include("OnBehalfOf").Include("Documents").ToList()  
                select new RSubmission  
                           {  
                               SubmissionId = submission.SubmissionId,  
                               CIKRName = submission.CriticalInfrastructureKey == null ? "Unknown" : submission.CriticalInfrastructureKey.Name,  
                               CIKRCountry = submission.CIKRCountry,  
                               CIKRState = submission.CIKRStateAbbr  
                           };  
            return query.ToList();  
        }  
    }  
}  
 
Adrian Segovia
Top achievements
Rank 1
 answered on 24 May 2010
1 answer
109 views

I have a report with 2 parameters.

I am using a RepotViewer object on my page.

I set the DataSource in the NeedDataSource Event, when I refresh the report in IE8 or Opera 10.53 the report does not refresh properly.

I have to click two time to see the data in the page.

best wishes

Steve
Telerik team
 answered on 24 May 2010
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?