Hi
I'm having this issue where the information I have in my SQL database is not being reflected on the chart.
My SQL query returns this data below:
raisedBy counter createdon
Risha Wadhwani 13 2010.06.14
Risha Wadhwani 19 2010.06.15
Tufail Khan 4 2010.06.15
Risha Wadhwani 13 2010.06.16
Also see screenshot 'sql.png'
This is the code that I am using to generate the Chart :
And finally, attached is the screenshot to see the Chart that is being rendered.
The problem is that is 'Tufail Khan' column(on the chart) is being displayed under the date '2010.06.14', instead of '2010.06.15' where it should have been, if you look at the result from the SQL result..
Any help on this would be very much appreciated.
Cheers Telerik!
Navnit
I'm having this issue where the information I have in my SQL database is not being reflected on the chart.
My SQL query returns this data below:
raisedBy counter createdon
Risha Wadhwani 13 2010.06.14
Risha Wadhwani 19 2010.06.15
Tufail Khan 4 2010.06.15
Risha Wadhwani 13 2010.06.16
Also see screenshot 'sql.png'
This is the code that I am using to generate the Chart :
private void chart1_NeedDataSource(object sender, EventArgs e){ var dataset = new DataSet(); var adapter = new SqlDataAdapter(); var conn = new SqlConnection("Initial Catalog=****;Data Source=****;User Id=****;Password=****;"); var cmd = new SqlCommand { Connection = conn, CommandType = CommandType.Text, CommandText = @"SELECT raisedBy, COUNT(id) as counter, createdon FROM ( SELECT da.name as raisedBy, defects.id, convert(VARCHAR, defects.created_on, 102) AS createdon FROM defects LEFT JOIN [user] da ON (defects.raised_by = da.id) WHERE defects.id IN(488,490,491,492,493,494,495,496,497,498,499,500,501,502,504,505,506,508,509,511,512,513,514,515,516,517,518,519,520,521,523,524,526,528,529,530,535,536,537,538,539,540,541,542,543,544,545,546,547) ) table1 GROUP BY raisedBy, createdon ORDER BY createdon ASC" }; adapter.SelectCommand = cmd; adapter.Fill(dataset); DataView view = dataset.Tables[0].DefaultView; //var chart = sender as Chart; chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -320; chart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Color.BlueViolet; chart1.PlotArea.XAxis.DataLabelsColumn = "createdon"; chart1.DataGroupColumn = "raisedBy"; chart1.PlotArea.XAxis.IsZeroBased = false; chart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Reporting.Charting.Styles.ChartValueFormat.ShortDate; chart1.PlotArea.XAxis.Appearance.CustomFormat = "MM/dd/yyyy"; chart1.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Between; chart1.PlotArea.XAxis.LabelStep = 1; chart1.PlotArea.XAxis.MaxItemsCount = view.Count; foreach (DataRowView rowView in view) { var datedate = DateTime.Parse(rowView.Row.ItemArray[2].ToString()); rowView.Row.ItemArray[2] = datedate; } if (chart1 != null) chart1.DataSource = view;}And finally, attached is the screenshot to see the Chart that is being rendered.
The problem is that is 'Tufail Khan' column(on the chart) is being displayed under the date '2010.06.14', instead of '2010.06.15' where it should have been, if you look at the result from the SQL result..
Any help on this would be very much appreciated.
Cheers Telerik!
Navnit