Hi everyone hope you are ok i need help for creating asp.net control charts. I need to create two charts.
Chart 1 - Stacked column chart
I have 3 attributes status, date and saleAmount i need to create the chart to display the values like this x axis( months), y axis saleAmount and point to display the status and count it.
Chart 2 Stacked column chart
I have 2 attributes date and sum saleAmount i need to create the chart to display the values like this x axis( months), y axis saleAmount and point to display the different years for each month.
I tried to look everywhere but didnt find nothing in internet
the code what i created now is not right Please help
What I have tried:
private void bind10()
{
string query = "SELECT status, DATEPART(Month, Date) as [Year], COUNT(weightedValue) as [Total]";
query += " FROM SalesActivity INNER JOIN STATUS ON SalesActivity.Status_ID = STATUS.Status_ID WHERE status IN ('Request for info', 'Quotation', 'Negotiating','Order Placed', 'Lost' )";
query += " GROUP BY status, DATEPART(Month, Date)";
DataTable dt = GetData(query);
List<string> statuses = (from p in dt.AsEnumerable()
select p.Field<string>("status")).Distinct().ToList();
foreach (string status in statuses)
{
int[] x = (from p in dt.AsEnumerable()
where p.Field<string>("status") == status
orderby p.Field<int>("Year") ascending
select p.Field<int>("Year")).ToArray();
int[] y = (from p in dt.AsEnumerable()
where p.Field<string>("status") == status
orderby p.Field<int>("Year") ascending
select p.Field<int>("Total")).ToArray();
Chart10.Series.Add(new Series(status));
Chart10.Series[status].IsValueShownAsLabel = true;
Chart10.Series[status].ChartType = SeriesChartType.StackedColumn;
Chart10.Series[status].Points.DataBindXY(x, y);
Chart10.Legends[0].Enabled = true;
}
}