Reputation: 125
So I'm pretty new to vb.net and I'm working on creating a report generator that will display a chart. The purpose of it is to display what defect codes have been reported in the last month and how many times each has been reported. These codes are just integers, there's no perceivable increment to them and there can theoretically be infinitely many defect codes reported in any given month.
My issue is the X-axis (the axis which the codes populate) doesn't show just the defect codes that have been reported that month like I want. Rather, it increments up in even amounts and just sticks the bars that show the # of occurrences wherever they fit within the increments.
To get to the core of my question, is it possible for me to display just these erratic codes? For example, to have the first value on the axis be "2," the second "18," and the third "41"? Or can axes only be created in even intervals?
Any help would be greatly appreciated.
Upvotes: 1
Views: 417
Reputation:
You can have your interval set at whatever value you wish. It depends on what you want to show on your x-axis.
for eg:
chart.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Days
chart.ChartAreas(0).AxisX.Interval = 1
This link provides an excellent explanation about chart intervals:
http://support2.dundas.com/Default.aspx?article=705
There are other features as well, but to get your chart up and working, I would recommend setting your interval to 1 and the interval type as days.
You can also index your data for your x-axis values, so that gaps in data can be handled. If you look at this link it shows the difference in chart styles and you can then decide if you want your graph to show gaps or not. Exactly how you'd like it to be formatted
http://support2.dundas.com/onlinedocumentation/winchart2005/Data_IndexedXValues.html
This question covers this topic in more details:
Chart: Show more value descriptions on X-Axis
If you still have questions after looking through these, please feel free to ask.
Or, alternatively, you can draft some code and check for errors, and post this for trouble shooting. This is easier to answer more specifically.
Upvotes: 2