Multiple series in kendo line chart

4 posts, 0 answers
  1. Aparna
    Aparna avatar
    3 posts
    Member since:
    Feb 2014

    Posted 03 Mar 2014 Link to this post

    Hi,

    I have two series of type

    Series 1: {Date:1/1/2011,Hitcount:3,Date:1/12/13,Hitcount 4}

    Series 2:{Date :1/1/2011,Hitcount 5,Date:1/12/13:Hitcount 5}

    How do I generate Multiple series using dynamic binding

    my kendo chart currently looks liek this 

      @(Html.Kendo().Chart<kendoNet.Models.ChartSeries>() // The chart will be bound to the Model which is the InternetUsers lis
                          .Name("Chart3")
                          .Title("Test")


                    // The name of the chart is mandatory. It specifies the "id" attribute of the widget.
                           .DataSource(dataSource =>
                                    dataSource.Read(read => read.Action("Series", "Home", new  { plname=ViewBag.Pl,test="VCS"})) // Specify the action method and controller name
                                    )
                                    .Legend(legend => legend
                                        .Position(ChartLegendPosition.Bottom)
                                    ).ChartArea(chartArea => chartArea
                                        .Background("transparent")
                                    ).SeriesDefaults(seriesDefaults =>
                                        seriesDefaults.Line().Style(ChartLineStyle.Smooth)
                                    )
                                    .Series(series =>
                                    {
                                           //MODEL IS DICTIONARY CONTAINING THE TWO SERIES 1 AND SERIES 2 ,HOW DO WE DISPLAY MULTIPLE SERIES HERE
                                          series.Line(model => model.Values).Name("HitCount").Labels(labels => labels.Visible(true).Color("Red")).Color("Blue");                                                

                                    })

                                    .CategoryAxis(axis => axis
                                    //.Categories(model => model.Date)
                                    .Labels(labels => labels.Rotation(-65)

                                    )

                                    )
                           
                            .ValueAxis(axis => axis
                                .Numeric().Labels(labels => labels.Format("{0}"))
                                .Line(line => line.Visible(false))
                                .AxisCrossingValue(-10)
                            )
                            .Tooltip(tooltip => tooltip
                                .Visible(true)
                                .Format("{0}")
                            )
            )
  2. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 06 Mar 2014 Link to this post

    Hello,

    Binding to dynamic number of series can be achieved in this case by including a field in the model that indicates to which series that the object belong and grouping the data on that field. I attached a sample project that demonstrates this scenario.

    Regards,
    Daniel
    Telerik
     

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Aparna
    Aparna avatar
    3 posts
    Member since:
    Feb 2014

    Posted 06 Mar 2014 Link to this post

    Hi 

    I cant see the attached project in the response.
  5. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 10 Mar 2014 Link to this post

    Hello again,

    It seems that the file was not made visible. Please try to download it using this link.

    Regards,
    Daniel
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

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