Multiple Series from Single DataSource

Thread is closed for posting
4 posts, 0 answers
  1. Artem
    Artem avatar
    4 posts
    Member since:
    Aug 2012

    Posted 20 Sep 2012 Link to this post

    I am considering recommending to avoid using Telerik controls in our web development. They have been a cause for frustration and productivity loss for me, instead of being the opposite, first with the RadGrid control now with the charts. It starts great - with a few clicks you can have a skinned control running. But if you want something specific to your user needs, even if it's quite simple - forget about it! You want multi-row edit and update in RadGrid? Sure - but unless you customize, you'll be updating ALL rows, even the ones that have not changed. You don't want child items to be automatically expanded when you expand parent groups? - Get ready to figure out exactly how grouping is implemented under the hood and bugs it might have and then hack around it. Want to use Rad Ajax Manager? Sure, but just for the fun of it will change the order in which your controls get data-bound.
    Here's a simple task for a prototype we are trying to put together:
    A stacked bar chart coming from a simple data table. Forget stacked chart, let's have a regular bar chart that will have the multiple series displayed on it. Drag and drop, right? Right, but it doesn't work.

    Here's what I have, resulting (messed up) chart is attached. How do I get my FUND_GROUP_NAME series to be displayed within the corresponding PROG_NAMEs?

    <telerik:RadChart ID="RadChart1" runat="server"
            DataGroupColumn="FUND_GROUP_NAME" DataSourceID="ProgramsDataSource"
            Height="303px" Width="968px" SeriesOrientation="Horizontal">
    <telerik:ChartSeries Name="Capital Projects                                  "
    <telerik:ChartSeries Name="Fish and Game Fund                                "
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="General Fund                                      ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Grant Funds                                       ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Library Fund                                      ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Library Special Tax Zone                          ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Measure A                                         ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Property Development Funds                        ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Redevelopment                                     ">
                <telerik:ChartSeries DataYColumn="TOT_END_BUDGET"
                    Name="Road Fund                                         ">
    <PlotArea><XAxis DataLabelsColumn="PROG_NAME">
            <Appearance RotationAngle="270">
    <telerik:ChartAxisItem Value="1">
    <TextBlock Text="Capital Projects"></TextBlock>
    <telerik:ChartAxisItem Value="2">
    <TextBlock Text="General Government"></TextBlock>
    <telerik:ChartAxisItem Value="3">
    <TextBlock Text="Public Protection"></TextBlock>
    <telerik:ChartAxisItem Value="4">
    <TextBlock Text="Contingency & Reserves"></TextBlock>
    <telerik:ChartAxisItem Value="5">
    <TextBlock Text="Health Care Services"></TextBlock>
    <telerik:ChartAxisItem Value="6">
    <TextBlock Text="Non Program Activities"></TextBlock>
    <telerik:ChartAxisItem Value="7">
    <TextBlock Text="Public Assistance"></TextBlock>
    <telerik:ChartAxisItem Value="8">
    <TextBlock Text="Cultural, Recreation & Education"></TextBlock>
    <ActiveRegion Tooltip="Cultural, Recreation & Education"></ActiveRegion>
                <Appearance RotationAngle="0">
                <Appearance RotationAngle="0">
     <asp:SqlDataSource ID="ProgramsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:db2dConnectionString %>"
            ProviderName="<%$ ConnectionStrings:db2dConnectionString.ProviderName %>" SelectCommand="SELECT F.FUND_GROUP_NAME, P.PROG_NAME, SUM(DB.END_BUDGET) AS TOT_END_BUDGET 
        FROM BUAOWN.BU_ACCOUNT       A,  
             BUAOWN.BU_DEV_BUDGET    DB,  
             BUAOWN.BU_FUND          F,
             BUAOWN.CAO_PROGRAM      P,  
             BUAOWN.CAO_DEPARTMENT   D,  
             ( DB.SCENARIO_CODE     = DFO.SCENARIO_CODE   ) and 
             ( DB.ORG_CODE          = DFO.ORG_CODE        ) and 
             ( DB.FUND_CODE         = DFO.FUND_CODE       ) and 
             ( DB.SCENARIO_CODE     = DFP.SCENARIO_CODE   ) and 
             ( DB.ORG_CODE          = DFP.ORG_CODE        ) and 
             ( DB.FUND_CODE         = DFP.FUND_CODE       ) and 
             ( DB.PROGRAM_CODE      = DFP.PROGRAM_CODE    ) and 
             ( DFO.PROG_CODE        = P.PROG_CODE         ) and
             ( DFP.DEPT_CODE        = D.DEPT_CODE         ) and
             ( F.FUND_CODE          = DB.FUND_CODE        ) and 
             ( DB.ACCOUNTING_YEAR   = A.ACCOUNTING_YEAR   ) and 
             ( A.ACCOUNTING_YEAR    = MG.ACCOUNTING_YEAR  ) and 
             ( A.MAJOR_GRP_CODE     = MG.MAJOR_GRP_CODE   ) and 
             ( DB.ACCOUNT_CODE      = A.ACCOUNT_CODE      ) and 
             ( DB.ACCOUNT_CODE      = AC.ACCOUNT_CODE     ) and
             ( DB.END_BUDGET       <> 0                   )
    here's the resulting data table from my data source:
    Capital Projects Capital Projects 120264742.00
    Capital Projects General Government 8684000.00
    Fish and Game Fund Public Protection 7310.00
    General Fund Capital Projects 9454429.00
    General Fund Contingency & Reserves 49961067.00
    General Fund General Government 163825697.00
    General Fund Health Care Services 498250248.00
    General Fund Non Program Activities 59448630.00
    General Fund Public Assistance 653448182.00
    General Fund Public Protection 518568622.00
    Grant Funds General Government 39827409.00
    Grant Funds Health Care Services 46075483.00
    Grant Funds Public Assistance 30394240.00
    Grant Funds Public Protection 21064091.00
    Library Fund Cultural, Recreation & Education 28195269.00
    Library Special Tax Zone Cultural, Recreation & Education 1030899.00
    Measure A Health Care Services 22008349.00
    Property Development Funds Capital Projects 61296804.00
    Redevelopment General Government 53880662.00
    Road Fund Public Ways & Facilities 68539768.00

  2. Peshito
    Peshito avatar
    524 posts

    Posted 24 Sep 2012 Link to this post

    Hello Artem,

    We are sorry to hear that you had bad experience with some of our controls. Please accept our apologies for any inconvenience caused.

    Onto your question regarding RadChart, you are using chart's grouping functionality along with manual setting your series. You don't need to manually create your series when data grouping is being used. All series will be created automatically for you as long as you point what DataColumns should be used. In such scenarios you need to use chart's DataManager to organize your grouping.
    For example like this:
    RadChart1.DataGroupColumn = "FUND_GROUP_NAME";
    RadChart1.DataManager.ValuesYColumns = new string[] { "TOT_END_BUDGET" };
    RadChart1.DataManager.ValuesXColumn = "Nbr";
    The ChartSeriesItems do not have their XValue property set, so all the series start from the very first position. You can force the position of an item by specifying its XValue. In this case, you can do this by introducing a fake column with incremental numeric values as shown in the attached example, which will serve as XValue. For that purpose I have used RadChart.DataManager.ValuesXColumn property with its name.

    I have also noticed that you are manually scaling your axis. In order to do so, you need to set the axis AutoScale property to false first and then specify the MinValue, MaxValue and Step values.

    Please find attached a sample project where you can see the mentioned above in details.

    Hope this helps.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Nicolaï
    Nicolaï avatar
    160 posts
    Member since:
    Apr 2008

    Posted 25 Sep 2013 Link to this post

    Have to agree with first post; but the charts are really theworst of all Telerik controls: near useless.
    You'll spend 30 seconds preparing the SQL, and 3 weeks trying to style a label.
    In almost every scenario where I tested the radchart, I end up scrapping it, and making colored divs, x browser, no problems, even though not as stylish; but it's simply not worth the effort anymore to work with Radcharts.
    As a prep for a "Your upcoming Telerik project check-in call" call, I was going to set up a childishly simple chart to remind me of what to point out specifically... It was supposed to be a 10 minute thing to set up that chart... Hours later, I'm here, searching forums for answers...

    So I suppose the RadHTMLChart doesn't support "DataGroupColumn" ?
    Guess I'll scrap the RadHTMLchart and try with the "basic" RadChart first...

    Redundant properties, some that never kick in, some that have 0 effect, some that won't work unless you also specify another property, etc etc... I seriously miss my old dotnetcharting component: it was much MUCH better, even if you go back 5 years and compare with todays RadChart (and even taking into account all I've learned in 5 years: even back then I could set up beautiful charts in no time with dotnetcharting).
    Legends and Axis labels nightmares, text overlapping, etc. There is no end to the problems in RadChart, in my opinion, when you try to set up a purposeful, dynamic, business chart.
  4. Marin Bratanov
    Marin Bratanov avatar
    3907 posts

    Posted 30 Sep 2013 Link to this post

    Hello Nicolaï,

     Indeed, RadHtmlChart does not support grouping OOB (but the idea is logged here), so you would either need to loop through your data to create series and their items, or provide such a datasource that will be ordered in columns instead of rows (i.e. one group per row, many series can be created from its columns).

    On your issues with the RadChart component - if you share your concrete concerns and examples of non-working properties we will be glad to investigate the case. If you have any suggestions on how things should be done we will also be happy to discuss them with you.

    On a side note - I would like to point out that the RadControls for ASP.NET AJAX suite consists of 70+ controls and we are not fully dedicated to charting. We offer components that are extremely rich in terms of functionality that comes OOB like the Grid, Scheduler, Editor and many others.

    Marin Bratanov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top