Binding to multiple series

2 posts, 0 answers
  1. Espen Moen Kvelland
    Espen Moen Kvelland avatar
    11 posts
    Member since:
    Jun 2009

    Posted 15 Aug 2014 Link to this post

    I havet his Json 

    [{"NumberOfDays":"41","Month":"1","year":"2013"},{"NumberOfDays":"8","Month":"2","year":"2013"},{"NumberOfDays":"14","Month":"3","year":"2013"},{"NumberOfDays":"6","Month":"4","year":"2013"},{"NumberOfDays":"-10","Month":"5","year":"2013"},{"NumberOfDays":"15","Month":"6","year":"2013"},{"NumberOfDays":"6","Month":"7","year":"2013"},{"NumberOfDays":"9","Month":"8","year":"2013"},{"NumberOfDays":"17","Month":"9","year":"2013"},{"NumberOfDays":"19","Month":"10","year":"2013"},{"NumberOfDays":"6","Month":"11","year":"2013"},{"NumberOfDays":"16","Month":"12","year":"2013"},{"NumberOfDays":"0","Month":"3","year":"2014"},{"NumberOfDays":"6","Month":"4","year":"2014"},{"NumberOfDays":"10","Month":"5","year":"2014"},{"NumberOfDays":"9","Month":"6","year":"2014"},{"NumberOfDays":"0","Month":"7","year":"2014"},{"NumberOfDays":"0","Month":"1","year":"2014"},{"NumberOfDays":"0","Month":"2","year":"2014"},{"NumberOfDays":"0","Month":"8","year":"2014"},{"NumberOfDays":"0","Month":"9","year":"2014"},{"NumberOfDays":"0","Month":"10","year":"2014"},{"NumberOfDays":"0","Month":"11","year":"2014"},{"NumberOfDays":"0","Month":"12","year":"2014"}]

    Then I create this chart

     @(Html.Kendo().Chart<AceoHR.Models.simpleClass.simpleChartClass>()
        .Name("chart")
        .Title("Egenmeldingsdager")
        .DataSource(ds => ds.Read(read =>
            read.Action("GetStatsSickDaysByMonth", "SickDays"))
            .Group(g => g.Add(v => v.year))
            )
                .Series(series =>
                {                                                           
                    series.Line(value => value.NumberOfDays, category => category.Month).Name("#:group.month#").Labels(labels => labels.Visible(false).Color("Red")).Color("Blue");
                    //series.Area(model => model.NumberOfDays, ).CategoryField("Month");                
                })
                   .CategoryAxis(axis => axis
                    .Categories(model => model.NumberOfDays)
                    .Labels(labels => labels.Rotation(-90))
                    .Justify()
                    .Crosshair(c => c.Visible(true))
                )
                .ValueAxis(axis => axis.Numeric()
                    .Labels(labels => labels.Format("{0:N0}"))
                )
                .Tooltip(tooltip => tooltip
                    .Visible(true)
                    .Shared(true)
                    .Format("{0:N0}")
                )
                    )


    The problem is that I'm not able to make this look as it should, check out the attach screenshot. The x axis should show the 12 months, the values on the graphs should show the NumberOfDays

    Any advice
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 15 Aug 2014 Link to this post

    Hello Espen Moen Kvelland,

    I am not sure that I can understand you. Could you please give me more information about your current scenario?

    Regards,
    Hristo Germanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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