Page 1 of 1

Show values on X-axis in datetime without any series

Posted: Sat Oct 22, 2005 2:27 pm
by 9788742
Hi,

In our application, when TChart comes up, we don't have any series in it.
But bottom axis and left axis are shown with some axis range (max & min).
The requirment is to show the values visible on the bottom axis in date/time format without any series in the chart.

How do I achieve it, right now I have written the following code:

DateTime x= DateTime.Now;
DateTime y = x.AddYears(50);
tChart1.Axes.Bottom.Minimum = x.ToOADate();
tChart1.Axes.Bottom.Maximum = y.ToOADate();
tChart1.Axes.Bottom.Title.Text = "DATE";
tChart1.Axes.Bottom.Labels.DateTimeFormat = "M/d/yyyy";

Thanks,
Lakshmi

Posted: Mon Oct 24, 2005 8:16 am
by narcis
Hi Lakshmi,

To achieve that you'd better populate the series so that axes are automatically drawn and then make the series transparent:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			line1.FillSampleValues();
			line1.XValues.DateTime=true;
			line1.Transparency=100;
			line1.LinePen.Visible=false;
		}

Posted: Mon Oct 24, 2005 9:37 am
by 9788742
Hi Narcis,

Is their any other way out to achieve the same without having any series, may be by some custom drawing of labels or something?

-Lakshmi

Posted: Mon Oct 24, 2005 2:12 pm
by narcis
Hi Lakshmi,

Yes, you can draw custom labels as you can see at "All Features\Welcome !\Axes\Labels\Custom labels" example at TeeChart's features demo which you can find at TeeChart's program group.