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

Displaying a line graph?

4 Answers 162 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
hin
Top achievements
Rank 1
hin asked on 06 Apr 2012, 01:36 AM
This should be very simple but I can't figure out how to do it.  I have spent hours looking for a solution and trying different options.

I have a sql datasource with data as:

Period     |  Avg_Total
1/1/2011  |  $1000
2/1/2011  |  $1500
3/1/2011 |  $2000
...
...
12/1/2011 | $ 1200

I set my Chart's properties as:
- PlotArea.XAxis.AxisLabel.DataLabelsColumn = Period
- Series collection with DataYColumn = Avg_Total

I keep getting the error message.  Unable to cast object of type 'System.DataTime' to type 'System.String'.  All I want is a line chart with X-Axis with date value and Y-Axis for the avg_total.  I even upgraded to the latest version, Telerik Q1 2012, and is still getting the same issue. 

Help??

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 06 Apr 2012, 07:15 AM
Hi,

Check the following forum thread that elaborates on using DateTime in the chart's XAxis.

All the best,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
hin
Top achievements
Rank 1
answered on 06 Apr 2012, 07:48 PM
That posting didn't help.  I actually found this posting http://www.telerik.com/community/forums/reporting/telerik-reporting/date-on-xaxis-causes-error.aspx

Instead of continue wasting my time with this problem, I have spent 2+ hours on this issue, I took the easy solution and convert my Date field into VARCHAR.

0
hin
Top achievements
Rank 1
answered on 06 Apr 2012, 08:47 PM
Another question.  How can I put a linear line in my line graph from the same data?  I am looking at creating a series of financial reports using your product, but have been running into bumps along the way.  Any help would be appreciated.  Thanks!
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 09 Apr 2012, 01:59 PM
If you are creating the chart using the designer, then simply in the Series collection create another series with the same data columns but different type (Line). If you are building the chart programmatically it's pretty much the same, just add another series that will have the same values but will be Type = Line.
Tags
General Discussions
Asked by
hin
Top achievements
Rank 1
Answers by
Steve
Telerik team
hin
Top achievements
Rank 1
Hadib Ahmabi
Top achievements
Rank 1
Share this question
or