Using c# VS2010 WinForm

actually i using line chart in report viewer
in my database:

ID----amount----year
ID01----10.00----2008
ID02----20.00----2010
ID03----30.00----2012

i want the result is in this format

but the result is this format

Recommended Answers

All 3 Replies

You'll need to add a record for each missing year.

May I know how i add arecord for each missing year? Because i am new in this reportviewer!

I'm not sure this can be done but it's worth a try.

You can loop through the returned records and use the DateTime.Compare() method in the C# end to sequentially compare two dates and if the result is 2 years or more then for each year missing add a new record by adding 1 to the year property of the first date (the earliest date).

An alternative to using the datetime.Compare() method would be to get the year value of the sequential dates and check how big the gab is between them and then add that many records.

Hope this helps point you in the right direction...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.