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

Urgent: New version breaks binding to Generic Lists, please help

6 Answers 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sharbel Lutfallah
Top achievements
Rank 1
Sharbel Lutfallah asked on 11 Mar 2010, 06:29 AM
This example does not work in the new version released today : http://www.telerik.com/help/reporting/buildingdatatbindlistcomplex.html

Unfortunately, I have a project going live in a week that has all the reports developed in this way which are now all broken.  The chart always shows up as 'no or empty series'

Can someone help?

6 Answers, 1 is accepted

Sort by
0
fruzicka
Top achievements
Rank 1
answered on 11 Mar 2010, 08:50 AM
I have this problem too. It seems that the old approach with NeedDataSource event doesn't work anymore. I'm rolling back to 2009 Q3 for now.
0
Svetoslav
Telerik team
answered on 11 Mar 2010, 01:51 PM
Hi guys,

With the release of the new version of Telerik Reporting - 2010 Q1 - we have made some changes to the chart item to start using the new data source components and data engine (see release notes), thus the chart item is now working in the same way as all other bindable report items.

Using the new data engine things looks much easier and we warmly suggest to try the new approach. Below is an example from the documentation you've pointed to, using the new way:

public partial class Report1 : Telerik.Reporting.Report
{
    public Report1()
    {
        /// <summary>
        /// Required for telerik Reporting designer support
        /// </summary>
        InitializeComponent();
         
        // Create a list to bind the chart1 to
        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));
        products.Add(new Product("Wool Cap", 45));
        products.Add(new Product("Mittens", 67));
 
        // Initialize the chart item definition:
        //  - add and setup a new Pie series;
        //  - set the chart data source
        // NOTE: you can do this throuh the chart item designer as well
        this.chart1.IntelligentLabelsEnabled = false;
        ChartSeries serie = new ChartSeries();
        serie.Type = ChartSeriesType.Pie;
        serie.Clear();
        serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        serie.DataYColumn = "QuantityInStock";
        serie.DataLabelsColumn = "Name";
        this.chart1.Series.Add(serie);
         
        // set the chart data source
        this.chart1.DataSource = products;
    }
}
 
public class Product
{
    string name;
    int quantityInStock;
 
    public string Name
    {
        get { return this.name; }
        set { this.name = value; }
    }
 
    public int QuantityInStock
    {
        get { return this.quantityInStock; }
        set { this.quantityInStock = value; }
    }
 
    public Product(string name, int quantityInStock)
    {
        this.name = name;
        this.quantityInStock = quantityInStock;
    }
}

You may find the Report1 class attached to this post.

As you can see the new approach for binding Char report item to data is quite simple and straightforward. As you can setup the item through the report designer, the new approach requires little to no coding.

Alternatively you may still use the NeedDataSource event to attach a data source to the chart but it is completely unnecessaryly to add items to the chart series manually.

Best wishes,
Svetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
fruzicka
Top achievements
Rank 1
answered on 11 Mar 2010, 02:24 PM
Hi Svetoslav,

I spend now 4 hours to play with the new approach and yes, the binding is nice.

But I have now in my project about 20 reports, partialy with many subreports which are bound to (hierarchical) entityspaces objects. It's not impossible to update my reports, but it will cost significant amount of time to do this.

PS: The documentation is empty about binding to custom businessobjects.
0
Sharbel Lutfallah
Top achievements
Rank 1
answered on 11 Mar 2010, 02:29 PM
Grrr me too.. i have to rework an entire project now.  Yes, the change is nice but it would have been great if it didn't break the previous method.

I have another problem.. with this new method I need to change the colour of each bar in my bar chart to a different colour.  So, I am using ItemBound event to iterate through each series item to assign the colours (see code below)... this doesn't work.  The colours just stay all the same, does anyone know how to fix this?

 private void chart1_ItemDataBound_1(object sender, EventArgs e) 
        { 
            Color[] barColors = new Color[8]{ 
       Color.Purple, 
       Color.SteelBlue, 
       Color.Aqua, 
       Color.Yellow, 
       Color.Navy, 
       Color.Green, 
       Color.Blue, 
       Color.Red 
   }; 
            int i = 0; 
            foreach (ChartSeriesItem item in chart1.Series[0].Items) 
            { 
                item.Appearance.FillStyle.MainColor = barColors[i++]; 
            } 
        } 
 
         
    } 

0
Svetoslav
Telerik team
answered on 15 Mar 2010, 09:58 AM
Hi guys,

Please note that the described change applies to the Chart item only. The rest of the data items - the Report, Table, Crosstab and List - work as before and no additional modifications are required.

As we do understand that breaking an existing functionality is quite annoying, we made required modifications to enable the old functionality - please check out the latest internal build that resolves this issue.

Anyway we strongly suggest using the new approach and I can assure you that we will continue working on the Chart item to take full advantage of the Telerik Reporting data engine and all extras like expressions, group hierarchies, aggregation, etc.

Greetings,
Svetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Richard Hyde
Top achievements
Rank 1
answered on 15 Mar 2010, 07:26 PM
In regards to Sharbel Lutfallah problem with changing the colors of the individual bars, I've experienced the same. The only solution i've come up with is to create the series items programatically and set the bar color at that time. Far from ideal. Would appreciate a simpler solution if one exists.
Tags
General Discussions
Asked by
Sharbel Lutfallah
Top achievements
Rank 1
Answers by
fruzicka
Top achievements
Rank 1
Svetoslav
Telerik team
Sharbel Lutfallah
Top achievements
Rank 1
Richard Hyde
Top achievements
Rank 1
Share this question
or