Simple Bar chart

4 posts, 1 answers
  1. Corey
    Corey avatar
    13 posts
    Member since:
    Sep 2015

    Posted 13 Oct 2015 Link to this post

    I am having some trouble with a simple bar chart.

    Here is my model

    public class PrivateReportCardCumulativeInvestments
    {
        public int FUND_INT { get; set; }
        public int YearCategory { get; set; }
        public decimal Commitments { get; set; }
        public decimal Distributions { get; set; }
        public decimal Draw_Down { get; set; }
        public decimal Fees { get; set; }
     
        public PrivateReportCardCumulativeInvestments()
        {
        }
    }

     

    And here is my Chart.

        @(Html.Kendo().Chart<BetaSMTRApp.Business.PrivateReportCardCumulativeInvestments>()
                                    .Name("ChartInvestmentCumulations_" + item.FUND_INT.ToString())
                                    .Title("Cumulative Investments")
                                    .DataSource(dataSource => dataSource
                                                    .Read(read => read.Action("GetCumulativeInvestments", "PrivateReportCard", new { fundInt = item.FUND_INT }))
                                                  )
     
                                    .Series(series =>
                                    {
                                        series.Column(model => model.Commitments).Name("Commitments");
                                        series.Column(model => model.Distributions).Name("Distributions");
                                        series.Column(model => model.Draw_Down).Name("DrawDowns");
                                        series.Column(model => model.Fees).Name("Fees");
                                    })
                                    .Legend(legend => legend
                                        .Position(ChartLegendPosition.Bottom)
                                    )
                                    .ValueAxis(axis => axis.Numeric()
                                        .Labels(labels => labels
                                            .Format("${0}")
                                            .Skip(2)
                                            .Step(2)
                                        )
                                    )
                                    .CategoryAxis(axis => axis
                                        .Categories(model => model.YearCategory)
                                        .Labels(labels => labels.Format("yyyy"))
                                    )
    )

    Looking for the following result

     

    Vertical Axis (value of the following)... model.Commitments, model.Distributions, model.DrawDown, Model.Fees (values are between 0 and 3 as a decimal with 1 precision.

    Horizontal Axis (model.YearCategory)

    Bars -- Commitment, Distribution, DrawDown and Fees.

    Example of data

    YearCategory    Commitments Distributions   Draw_Down   Fees
    2004    71.5    36.5    0   0.5
    2005    35.8    50.6    6.4 2
    2006    0   90.9    28  4
    2007    0   111.7   43.2    5.7
    2008    0   110.4   50.5    8.1
    2009    0   113 59.3    9.8
    2010    0   113.7   81.2    11.2
    2011    0   111 88.3    12.7
    2012    0   74.6    146.4   14
    2013    0   76.5    153.6   15.1
    2014    0   41.9    252 16.3

    Any ideas of what i am missing?

    Thanks

    Corey

  2. Corey
    Corey avatar
    13 posts
    Member since:
    Sep 2015

    Posted 13 Oct 2015 in reply to Corey Link to this post

    And here is what is being displayed:

     

  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Answer
    Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 15 Oct 2015 Link to this post

    Hello Corey,

    The code looks correct. Could you provide the code for the action method and check:
    • if there are any JavaScript errors.
    • in the network traffic what is the response from the GetCumulativeInvestments method.


    Regards,
    Daniel
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  5. Corey
    Corey avatar
    13 posts
    Member since:
    Sep 2015

    Posted 15 Oct 2015 in reply to Daniel Link to this post

    Daniel,

    Thank you for your response.  Turns out the issue was indeed in the Action method.

    I had to change the return result from a DataSourceResult to a simple List converted to JSON.

    All is well.

    Now on to my next issue.. drill through on the same chart using a Kendo Window.... for which i will post a new thread for.

Back to Top
UI for ASP.NET MVC is VS 2017 Ready