Binding ScatterLineSeries Directly to SQLDataSource

4 posts, 0 answers
  1. Tyler
    Tyler avatar
    3 posts
    Member since:
    Aug 2016

    Posted 09 Aug 2016 Link to this post

    Hey everyone,

    Thanks for reading. I have a RadHtmlChart and a SqlDataSource. The SqlDataSource is attached to a Stored Procedure that returns 2 columns: a date, and an amount.

    I simply want to plot the dates along the X and the amount along the Y, however I'm having some difficulty achieving this. Please see the code below:

       
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1">
        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" DataSourceID="sdsDeclineReport" Width="600px" Height="400px">
            <PlotArea>
                <Series>
                    <telerik:ScatterLineSeries DataFieldX="date" DataFieldY="amount">
                        <TooltipsAppearance Color="White" DataFormatString="{0:MM/dd}"></TooltipsAppearance>
                        <LabelsAppearance Visible="false">
                        </LabelsAppearance>
                    </telerik:ScatterLineSeries>
                </Series>
            </PlotArea>
            <Legend>
                <Appearance Visible="false"></Appearance>
            </Legend>
            <ChartTitle Text="Declines"></ChartTitle>
        </telerik:RadHtmlChart>
    </telerik:RadAjaxPanel>

     

    The result looks like this:

     http://i.imgur.com/TGtKTNxl.png


    The "Amount" column ranges from 0-20, and the dates go from 2016-01-01 to 2017-01-01. Can someone point me in the right direction here in regards to the lack of any data, as well as where I went wrong with the axes?

    Thanks

     

  2. Stamo Gochev
    Admin
    Stamo Gochev avatar
    185 posts

    Posted 12 Aug 2016 Link to this post

    Hi Tyler,

    Can you recheck if the Y value property is actually spelled "amount" and if the result from the SqlDataSource is actually returning any data for it? Otherwise, the chart will be populated with series items.

    Regarding your second question - you can have a look at the following article about configuring a date axis:

    http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/functionality/axes/date-axis


    Regards,
    Stamo Gochev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Tyler
    Tyler avatar
    3 posts
    Member since:
    Aug 2016

    Posted 12 Aug 2016 in reply to Stamo Gochev Link to this post

    Thank you Stamo.

    I was able to solve my problem by using a Line Series and setting the X-Axis to be of type "Date". One additional question: Does RadHTMLChart support date-based plotbands? I'd like to highlight certain dates on the chart and would prefer not to do the conversion from date to data index.
  4. Stamo Gochev
    Admin
    Stamo Gochev avatar
    185 posts

    Posted 17 Aug 2016 Link to this post

    Hi Tyler,

    Yes, you can use dates for the start and the end of a plot band as shown in this example:

    http://docs.telerik.com/kendo-ui/controls/charts/how-to/dynamic-plot-bands

    Please note that this can be achieved only with custom client-side code and requires manual configuration.

    Regards,
    Stamo Gochev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top