Cannot for the life of me get the labels for the X axis to show. Please help!
Have this code in a WPF window, but tried from a Form as well:
public class Something { public DateTime d { get; set; } public decimal s { get; set; } } public partial class InfraWinformChart : Window { private UltraDataChart chart = new UltraDataChart(); public InfraWinformChart() { InitializeComponent(); List list = new List() { new Something() { s = 1, d = DateTime.Now }, new Something() { s = 2, d = DateTime.Now + TimeSpan.FromDays(2) } }; CategoryDateTimeXAxis xAxis = new CategoryDateTimeXAxis() { DataSource = list, DateTimeMemberPath = "d", Label = "d" }; NumericYAxis yAxis = new NumericYAxis() { }; LineSeries series = new LineSeries() { XAxis = xAxis, YAxis = yAxis, ValueMemberPath = "s", DataSource = list, }; chart.Axes.Add(xAxis); chart.Axes.Add(yAxis); chart.Series.Add(series); winformHost.Child = chart; }
Hello,
Thank you for contacting Infragistics. Which version are you currently experiencing this behavior?
In 16.2 you will see this behavior because originally it was required to handle the xAxis FormatLabel event to show both the labels and apply any format to them.
In Windows Forms 17.1 the labels now show up by default, mirroring how the WPF XamDataChart works, without needing to do anything additional. This was considered an improvement and I tested the latest service release 17.1 version 2032 to confirm this working.
In addition, if you wish to format the labels in 17.1 you still need to handle the FormatLabel event. Unlike WPF, the Label property will not set the formatting.
I attached a sample using your code to demonstrate how to show the labels with formatting in 16.2. If you upgrade to 17.1 the code in the event will still apply but only if a format is needed.
eg.
chart.Axes[0].FormatLabel += Form1_FormatLabel; private string Form1_FormatLabel(AxisLabelInfo info){ var date = ((DateTime)info.DateValue).Date; return string.Format("{0:MM/dd }", date); }
private string Form1_FormatLabel(AxisLabelInfo info){ var date = ((DateTime)info.DateValue).Date; return string.Format("{0:MM/dd }", date);
}
Let me know if you have any questions.
You may submit a new product idea to refactor the Label property to show the formatting as is handled in WPF.
Submitting your idea will send it directly to our product management team so that it can be imported into our new ideas community once live: http://ideas.infragistics.com
Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. You can also link back to this thread for additional details.Thank you in advance to submitting your product idea.
Thank you for contacting Infragistics.
Hey that did it. Thanks! One other thing, I'm attempting to plot 36K points, but I'm not seeing all of the markers. I know the WPF version had an option to increase the max visible markers, does the WinForm control have something similar? I tried the UseHighMarkerFidelity property with no luck. Seems the documentation for this stuff is all over the place...
May have missed the follow-up question in the previous post:
I'm attempting to plot 36K points, but I'm not seeing all of the markers. I know the WPF version had an option to increase the max visible markers, does the WinForm control have something similar?
Thank you for following up. The Windows Forms DataChart uses the built-in collision detection and only the WPF XamDataChart has a MarkerCollisionAvoidance property on the series to turn it off. You may submit another new product idea for Windows Forms.
eg. Line Series collision detection property
One possible workaround is to incorporate a second "Bubble" series to represent the markers. The BubbleSeries class exposes the MarkerType property in case you want to change the shape of the series.