0

I will be developing some charts for a project .. at this moment, I am just creating specification document for stored procedures and some bits seem mystery to me ...

I will be using ASP.net Chart Control. The chart will be a Line chart and show Sales Figures for a product for a year. The sale figures may present in quarter of a year up to 3 figures a year but may be just one or two quarters for some products or some years. The database job would be done by database developer I will need to request stored procedure interface to him. So, I will be passing in ProductID and Year I want to find sale figures.

What would be the easiest to develop in .net side (including developing Chart Control) if I request stored procedure to return the sale figures from the database either - -

Can I request to return a dataset that contain tables which represent sale figures for quarters? One table in the dataset represent one sale figure for a quarter. I wouldn't know how many tables there will be in dataset.

Or can i request to return a big datatable that contain all sale figures for a year for a product. And do the filtering myself in code behind and populate the chart? If I have to filter myself then what would be the best way to do?

The chart needs to be flexible enough to show 1, 2 or 3 series of line charts based on the data returned either of the above.

Thanks,

L

Laurence
  • 7,633
  • 21
  • 78
  • 129

1 Answers1

0

As per my understanding, you need to add a chart with Date Range (weeks, months or quarters) as x-axis and SaleData in the y-axis. Best way is to get the data in a single table which is grouped by Sale Date.

Based on the Minimun Sale Date and Maximum Sale Date available in your table, you can set the x-AxisInterval Type

int dateDifference = EndDate.Value.Subtract(StartDate.Value).Days;

            if (dateDifference <= 15)
            {
                chart.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;

            }
            else if (dateDifference > 15 && dateDifference <= 60)
            {
                chart.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Weeks;

            }
            else if (dateDifference > 60)
            {
                chart.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Months;

            }
ajay swamy
  • 271
  • 1
  • 5