Jump to content
Software FX Community

Axis step for time values


User (Legacy)

Recommended Posts

I would like to display a chart starting and ending between two time values,

with sensible time steps (0.5 hour, 1 hour etc) between the grid lines. I

have a Gantt chart displaying values between two time values:

chart1.AxisY.LabelsFormat.Format = AxisFormat.Time;

chart1.AxisY.AutoScale = false;

chart1.AxisY.Min = dtHourStart.ToOADate(); // 08:00:00

chart1.AxisY.Max = dtHourStart.AddHours(2).ToOADate(); // 10:00:00

chart1.AxisY.Gridlines = true;

double dStep = 1 / 24;

chart1.AxisY.Step = dStep;

The steps on the axis are as follows:

08:00:00, 08:17:08, 08:34:17, 08:51:25, 09:08:34, 09:25:42, 09:42:51,

10:00:00

How do I set the steps on the axis to be sensible sized units of time (1

hour, 0.5 hour etc)?

Can I set the step size, and let the chart use sensible values for maximum

and minimum?

Thanks.

Link to comment
Share on other sites

I've figured it out:

It need double type division, not integer division:

double dStep = 1.0 / 24.0;

"J Moulder" <q> wrote in message news:7C$VWtNVDHA.2896@WEBSERVER1...

> I would like to display a chart starting and ending between two time

values,

> with sensible time steps (0.5 hour, 1 hour etc) between the grid lines. I

> have a Gantt chart displaying values between two time values:

>

> chart1.AxisY.LabelsFormat.Format = AxisFormat.Time;

>

> chart1.AxisY.AutoScale = false;

>

> chart1.AxisY.Min = dtHourStart.ToOADate(); // 08:00:00

>

> chart1.AxisY.Max = dtHourStart.AddHours(2).ToOADate(); // 10:00:00

>

> chart1.AxisY.Gridlines = true;

>

> double dStep = 1 / 24;

>

> chart1.AxisY.Step = dStep;

>

>

>

> The steps on the axis are as follows:

>

> 08:00:00, 08:17:08, 08:34:17, 08:51:25, 09:08:34, 09:25:42, 09:42:51,

> 10:00:00

>

> How do I set the steps on the axis to be sensible sized units of time (1

> hour, 0.5 hour etc)?

>

> Can I set the step size, and let the chart use sensible values for maximum

> and minimum?

>

> Thanks.

>

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...