Well,
Changed the chart type to column and it corrected. Weird.
Visual Studio Professional 2019 C# project using .NET chart component
Greetings,
I have created a c# winform project. On the form I have a Chart. I create a List<t> to be the datasource of the chart. The Object of the list has a datetime property.
My chart object on my form is named chart2. I have the following code:
chart2.DataSource = comRetriesList;
chart2.Series[0].XValueMember = "eventDate";
chart2.Series[0].XValueType = ChartValueType.DateTime;
chart2.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy-MM-dd HH:mm:ss";
chart2.Series[0].YValueMembers = "retries";
chart2.Series[0].YValueType = ChartValueType.Int32;
chart2.DataBind()
eventDate and retries are properties of the Object in List<t>
when I run the form, the chart displays but the dates are on the Y axis and the ints are on the X axis.
I haven't changed anything else and am confused. I have the Series chartType setup as Bar if that matters.
Anybody know why this is happening ?
thanks in advance. BTW .NET Framework 4.5.2
Developer technologies | C#
1 answer
Sort by: Most helpful
-
Darryl Hoar 116 Reputation points
2021-05-06T20:27:00.807+00:00