Not All Xaxis Labels Showing On Chart Control From Bound Dataset

Riples picture Riples · Jan 26, 2014 · Viewed 9.8k times · Source

I have a problem with a couple of various chart controls that I am trying to bind to different datasets. Basically, when I run the following query, my chart control will only show every 2nd Label on the X Axis no matter what size I make the chart.

SELECT MID(MONTHNAME(created_at),1,3) as Month, COUNT(created_at) AS TotalCreatedCalls, COUNT(closed_at) AS TotalClosedCalls FROM call_detail WHERE DATE(created_at) BETWEEN DATE_SUB(CURDATE(), INTERVAL 12 MONTH) AND CURDATE() GROUP BY MONTH(created_at)

However, if I remove the MONTHNAME statement and just return the MONTH, all 12 months appear fine on the X Axis Label as numbers.

SELECT MONTH(created_at) as Month, COUNT(created_at) AS TotalCreatedCalls, COUNT(closed_at) AS TotalClosedCalls FROM call_detail WHERE DATE(created_at) BETWEEN DATE_SUB(CURDATE(), INTERVAL 12 MONTH) AND CURDATE() GROUP BY MONTH(created_at)

I have the same exact issue with another chart control where I am trying to show peoples names along the X Axis, but I only get every 5th name. However, I also have another chart control with pulls 7 days and shows the week name on the X Axis and that seems to work fine.

enter image description here

enter image description here

Answer

Manojbabu picture Manojbabu · Dec 20, 2017

Add this code it will help you

chart1.ChartAreas(0).AxisX.Interval = 1