I am trying to create a chart using an ASP.Net Chart control that has specific numeric values ββon the X axis and their frequency on the Y axis. Here is an example of what I want from the chart frame I am replacing:

In the above example, the X-axis labels line up with columns. But using the ASP.Net Chart control instead of labeling the columns that represent these specific values ββ(e.g. 1492, 2984), the control is marked at rounded intervals and does not align with the columns (e.g. 2000, 4000), as you can see below:

I found other similar publications that recommended setting ChartArea.AxisX.Interval to 1. I tried this, but then for some reason the X axis label disappears, as you can see below:

Here is the code I use to create and populate the chart (minus setting various color attributes):
DataTable newDt = GetChartDataTable(); chart.DataSource = newDt; chart.Series.Add("Series1"); chart.Series["Series1"].YValueMembers = "Frequency"; chart.Series["Series1"].XValueMember = "RoundedValue"; chart.ChartAreas["ChartArea1"].AxisX.Title = "kbps"; chart.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("Sans Serif", 10, FontStyle.Bold); chart.ChartAreas["ChartArea1"].AxisY.Title = "Frequency"; chart.ChartAreas["ChartArea1"].AxisY.TitleFont = new Font("Sans Serif", 10, FontStyle.Bold); chart.Titles["Title1"].Text = chartTitle; chart.Titles["Title1"].Font = new Font("Sans Serif", 10, FontStyle.Bold); chart.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column; chart.Series["Series1"]["ShowMarkerLines"] = "True"; chart.DataBind();
source share