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

Multiple Line Series with Sql Data Source

7 Answers 149 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Константин
Top achievements
Rank 1
Константин asked on 13 Mar 2019, 08:52 AM

hi all again, i asked you about muptiple line series  in radchart in this post: https://www.telerik.com/forums/multiple-line-series-radhtmlchart

I created RadHtmlChart with the same parameters as previous post and using SqlDataSource. And this is my ASPX code:

    <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" DataSourceID="dsJournal"><br>        <PlotArea><br>            <YAxis MaxValue="100" MinValue="-100"><br>            </YAxis><br>            <Series><br>                <telerik:LineSeries DataFieldY="param_d" Name="LineSeries1"><br>                </telerik:LineSeries><br>                <br>            </Series><br>            <XAxis DataLabelsField="sensor_type"><br>                <LabelsAppearance RotationAngle="-90" Visible="false"></LabelsAppearance><br>            </XAxis><br>            <CommonTooltipsAppearance Visible="true" Shared="true" /><br>            <YAxis Step="10000"></YAxis><br>        </PlotArea><br>        <br>    </telerik:RadHtmlChart>

 

This is my C# code with setting RadHtmlChart:

        protected void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)<br>        {<br>            e.SeriesItem.Name = (string) DataBinder.Eval(e.DataItem, "sensor_type");<br>        }

Bellow i will attach two picture: 

1. what i have right now in RadHtmlChart with one LineSeries

2. the same structure table from database, where i need only a column "sensor_type" for multiple LineSeries in RadHtmlChart.

 

Thank you for your attention, i hope you will help me, and sorry for two similar post

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 15 Mar 2019, 02:50 PM
Hi Константин,

I advise that you review the information I provided in the other thread to see how to data bind a RadHtmlChart. It is important to add that it does not have server-side events: https://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/troubleshooting/known-issues/known-limitations. If you will be creating series dynamically, you must set their properties when you create them, you cannot do this in a DataBoud-type server event.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Константин
Top achievements
Rank 1
answered on 18 Mar 2019, 10:25 AM

how do i achieve multi series of lines in the the html chart currently it binds to only one series

like dis

0
Marin Bratanov
Telerik team
answered on 18 Mar 2019, 11:26 AM
Hi,

The following sample shows one way you can group the data source so it gets split into the separate fields the chart needs: https://www.telerik.com/support/code-library/group-radhtmlchart-data-source.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Константин
Top achievements
Rank 1
answered on 19 Mar 2019, 07:15 AM

thank u, Marin Bratanov, for answer.

so i understand correctly that this is impossible make with help SqlDataSource or other DataBound? Just like manually?

than You for answer

0
Marin Bratanov
Telerik team
answered on 19 Mar 2019, 08:01 AM
Hello Konstantin,

It is possible, and you can data bind multiple series to a chart through an SqlDataSource. 

What is important is that you provide data in the proper shape to the chart, as described in the following documentation article: https://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/data-binding/overview.

If you cannot provide such shape from the database, you need to write some additional code in order to create the needed shape programmatically, as shown in the following post: https://www.telerik.com/support/code-library/group-radhtmlchart-data-source

This will allow you to data bind multiple series.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Константин
Top achievements
Rank 1
answered on 04 Apr 2019, 06:36 AM

hi , Mark Bratanov, thank you for answer

can i do this (group radhtmlchart data source multi line series) via JavaScript?

 

0
Marin Bratanov
Telerik team
answered on 09 Apr 2019, 07:14 AM
Hello Konstantin,

You can see how to use JavaScript objects to bind the chart in the following resources:

You need to declare the series and their fields from the server, so it is likely that you will have to perform the grouping on the server so you can know the field names. If you can predict the field names, you can use JavaScript to group your data and then pass it to the chart.

 


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart (HTML5)
Asked by
Константин
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Константин
Top achievements
Rank 1
Share this question
or