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

Binding ScatterLineSeries Directly to SQLDataSource

3 Answers 81 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Tyler
Top achievements
Rank 1
Tyler asked on 09 Aug 2016, 06:25 PM
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

 

3 Answers, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 12 Aug 2016, 05:22 AM
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.
0
Tyler
Top achievements
Rank 1
answered on 12 Aug 2016, 03:00 PM
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.
0
Stamo Gochev
Telerik team
answered on 17 Aug 2016, 06:33 AM
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.
Tags
Chart (HTML5)
Asked by
Tyler
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Tyler
Top achievements
Rank 1
Share this question
or