Formatos Axisx o y en MS Chart 4.0

How do I use ChartValueType.Time on the XAxis of a line chart?

Hi

I’m trying to draw a FastLine graph where the points are all really (TimeSpan timeSinceStart,  double value).

Because the graph won’t bind to TimeSpan I’ve used DateTime instead – with all x values relative to DateTime(1900,1,1)  – is this the correct thing to do?

However, when I plot the series it refuses to put “sensible” values in for the Minimum on the XAxis – how should this be setup? I’ve also tried using IsStartedFromZero – is this any use?

Some snippets of my code (if that helps)

            ChartArea area = new ChartArea(chartAreaName);
area.AxisX.IsLabelAutoFit = false;
//area.AxisX.IsStartedFromZero = true;
//area.AxisX.Minimum = 0.0;
//area.AxisX.Minimum = ChartPoint.BaseTime.;
area.AxisX.LabelStyle.Format = “hh:mm:ss”; //”N0″;
area.AxisX.IntervalType = DateTimeIntervalType.Hours;
area.AxisY.IsLabelAutoFit = false;
Chart1.ChartAreas.Add(area);

Series speedSeries = new Series(chartName);
speedSeries.Points.DataBind(items, xProperty, yProperty, string.Empty);
speedSeries.ChartType = SeriesChartType.FastLine;
speedSeries.ChartArea = chartAreaName;
speedSeries.XValueType = ChartValueType.Time;
Chart1.Series.Add(speedSeries);


Stuart

Fuente Original: https://social.msdn.microsoft.com

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s