I was having an issue with this in a larger project, so I created a empty one just to isolate the problem. I have an empty windows form on which I dropped a single chart. I made no property changes to the chart (via the properties window). In the form load event, I have the following code:
private void Form1_Load(object sender, EventArgs e) { chart1.Gallery = Gallery.Bar; chart1.AllSeries.Stacked = Stacked.Normal; chart1.AxisX.LabelsFormat.Format = AxisFormat.Time; DataTable t = new DataTable(); t.Columns.Add("time", typeof(DateTime)); t.Columns.Add("yvalue1", typeof(long)); t.Columns.Add("yvalue2", typeof(long)); DataRow r1 = t.NewRow(); DataRow r2 = t.NewRow(); r1["time"] = DateTime.Now; r1["yvalue1"] = 10; r1["yvalue2"] = 25; r2["time"] = DateTime.Now.AddMinutes(-100); r2["yvalue1"] = 50; r2["yvalue2"] = 75; t.Rows.Add(r1); t.Rows.Add(r2); chart1.DataSourceSettings.Fields.Add(new FieldMap("time", FieldUsage.XValue)); chart1.DataSourceSettings.Fields.Add(new FieldMap("yvalue1", FieldUsage.Value)); chart1.DataSourceSettings.Fields.Add(new FieldMap("yvalue2", FieldUsage.Value)); chart1.DataSource = t; }
When I run the app, I get the following screen:
Notice there are NO datetime labels for the bar charts!!!!!
For reference, here is the generated designer code:
private void InitializeComponent() { this.chart1 = new ChartFX.WinForms.Chart(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // this.chart1.Location = new System.Drawing.Point(12, 12); this.chart1.Name = "chart1"; this.chart1.Size = new System.Drawing.Size(898, 618); this.chart1.TabIndex = 0; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(922, 642); this.Controls.Add(this.chart1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
Any ideas? ??????????? I am literally pulling my hair out over this. I've tried lots of different things, but to no avail (including just setting things in the properties dialog, etc, and setting various other properties programmatically).