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

Multiple series in kendo line chart

3 Answers 692 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Aparna
Top achievements
Rank 1
Aparna asked on 04 Mar 2014, 02:01 AM
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}")
                        )
        )

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 06 Mar 2014, 08:35 AM
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!

 
0
Aparna
Top achievements
Rank 1
answered on 06 Mar 2014, 05:46 PM
Hi 

I cant see the attached project in the response.
0
Daniel
Telerik team
answered on 10 Mar 2014, 11:50 AM
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.

Salah
Top achievements
Rank 1
commented on 01 Sep 2022, 09:23 AM | edited

this doesn't work with the latest version.? 
Yanislav
Telerik team
commented on 05 Sep 2022, 07:50 AM

Hello Salah,

I've upgraded the version of the Telerik UI in the attached project and the project seems to behave the same way and everything seems to be working correctly. With that said, may I ask you to clarify what exactly is not working on your side, and guide us on how to replicate the problem?

I attached the application with the newest version of the Telerik UI for ASP.NET MVC so you can review it.

Tags
Chart
Asked by
Aparna
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Aparna
Top achievements
Rank 1
Share this question
or