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

"Specified cas is not valid" Error when assigning Date variables to RangeSeriesItems

2 Answers 77 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 06 Apr 2015, 07:35 PM

I have a RangeBarChart where the X Axis represents the time of the day from 6am to 10pm.  The Y Axis represents a number of events.  Each event consists of a StartTime variable and an EndTime variable (both are DateTime datatypes).  I am adding the Series programmatically in ASP.NET VB.  

The data is pulled from an SQL Database.  When I assign the variables, I get a "Specified cast is not valid".  Presumably, the RangeSeriesItem is looking for a different datatype than DateTime.

While UserReader.Read()
                Dim AdjudicatorSeriesItem As New RangeSeriesItem(UserReader("fldNotesDateStart"), UserReader("fldNotesDateEnd"))
                AdjudicatorSeries.SeriesItems.Add(AdjudicatorSeriesItem)
 
End While

 

Any ideas?

 

2 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 07 Apr 2015, 01:08 AM
Apparently the XAxis has to be cast in date format somehow.  I found a one line reference to it, but no details.

Is there anybody out there or is this blog thing wasting my time?
0
Danail Vasilev
Telerik team
answered on 07 Apr 2015, 08:17 AM
Hi Jerry,

I have already replied to your question in the support ticket that was opened by your so I paste my answer below for the community:

RadHtmlChart support only date x-axis. That being said you cannot display date time spans on the y-axis. What I can suggest is that you try the following:
    - Convert the .NET datetime values to its JavaScript equivalent in decimal format from the code behind.
    - Format the labels/tooltips to date time on the client side.

Such an example with scatter chart is illustrated here - http://www.telerik.com/help/aspnet-ajax/htmlchart-application-programmatic-creation-of-seriesitems-with-datetime.html but you can also try to apply this approach for the range bar charts.


As for the response time - we guarantee . 24-hour maximum lead time for licenses Mon-Fri, excluding public holidays and 72-hour lead time for trial licenses. More information is available here - http://www.telerik.com/purchase/support-plans/devtools Although the response time for forum threads is not guaranteed we try our best to answer them as well when available.

Regards,
Danail Vasilev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Chart (HTML5)
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or