Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
UltraDataChart with CategoryDateTimeXAxis labels
posted

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;
        }