Jump to content
Software FX Community

Weekends skipped - date labels vanish


Anonymole
 Share

Recommended Posts

I have daily data (date, value) stored in a DataTable.

I assign the DataTable as the DataSource to a ChartFX Chart.

As the data is weekly only, I want to skip the showing of weekend gaps, so I found and used the following:

chart.ExtraStyle |= ChartFX.WinForms.ChartStyles.ForceDataDriven;

This worked great in removing the weekend gaps, however, now my XAxis no longer shows any date labels.

I've tried dozens of combinations of this and that to no avail.

How to get the Dates to show up in the AxisX ?

Code:

ChartFX.WinForms.Chart chart = new ChartFX.WinForms.Chart();

chart.Width = 400;

chart.Height = 300;

chart.Titles.Add(new ChartFX.WinForms.TitleDockable());

chart.Titles[0].Text = title;

chart.Titles[0].TextColor = Color.Black;

chart.Titles[0].Font = new Font("Arial", 11, FontStyle.Bold);

chart.Titles[0].Separation = 5;

chart.Titles[0].Alignment = StringAlignment.Center;

chart.Series[0].Stacked = true;

chart.Series[0].Gallery = ChartFX.WinForms.Gallery.Bar;

chart.Series[0].Color = Color.Green;

chart.Series[0].AxisY = chart.AxisY2;

chart.Series[1].Stacked = true;

chart.Series[1].Gallery = ChartFX.WinForms.Gallery.Bar;

chart.Series[1].Color = Color.Gray;

chart.Series[1].AxisY = chart.AxisY2;

chart.Series[2].MarkerShape = ChartFX.WinForms.MarkerShape.Marble;

chart.Series[2].MarkerSize = 2;

chart.Series[2].Color = Color.Red;

chart.Series[2].Gallery = ChartFX.WinForms.Gallery.Lines;

chart.Series[2].AxisY = chart.AxisY;

chart.DataSource = dt;

chart.LegendBox.Visible = true;

chart.AxisY.LabelsFormat.Format = ChartFX.WinForms.AxisFormat.Number;

chart.AxisX.LabelsFormat.Format = ChartFX.WinForms.AxisFormat.Date;

chart.AxisX.LabelsFormat.CustomFormat = "MM/dd";

chart.ExtraStyle |= ChartFX.WinForms.ChartStyles.ForceDataDriven;

Data looks like this:

"6/17/2011 12:00:00",1,-2,44.4

"6/20/2011 12:00:00",2,-2,34.4

"6/21/2011 12:00:00",5,-3,24.4

"6/22/2011 12:00:00",6,-4,42.4

"6/23/2011 12:00:00",3,-4,46.4

"6/24/2011 12:00:00",2,-4,43.4

Thanks for any help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...