question

DarrylHoar-5879 avatar image
0 Votes"
DarrylHoar-5879 asked DarrylHoar-5879 answered

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

dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DarrylHoar-5879 avatar image
1 Vote"
DarrylHoar-5879 answered

Well,
Changed the chart type to column and it corrected. Weird.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.