Multiple Line Series with Sql Data Source

8 posts, 0 answers
  1. Константин
    Константин avatar
    8 posts
    Member since:
    Jul 2017

    Posted 13 Mar Link to this post

    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

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 15 Mar Link to this post

    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.
  3. Константин
    Константин avatar
    8 posts
    Member since:
    Jul 2017

    Posted 18 Mar in reply to Marin Bratanov Link to this post

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

    like dis

  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 18 Mar Link to this post

    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.
  5. Константин
    Константин avatar
    8 posts
    Member since:
    Jul 2017

    Posted 19 Mar in reply to Marin Bratanov Link to this post

    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

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 19 Mar Link to this post

    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.
  7. Константин
    Константин avatar
    8 posts
    Member since:
    Jul 2017

    Posted 04 Apr in reply to Marin Bratanov Link to this post

    hi , Mark Bratanov, thank you for answer

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

     

  8. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4931 posts

    Posted 09 Apr Link to this post

    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.
Back to Top