Hi,
I am trying to specify that my X-Axis have a data type of Time. I also want to set the Min/Max ranges of the line series that are added to the chart. However, it appear that even though I specify the AxisDataType for the X-Axis, that the expected Min/Max range data type is double:
AxisItem axisX = new AxisItem();
axisX.OrientationType = AxisNumber.X_Axis;
axisX.DataType = AxisDataType.Time;
axisX.Labels.SeriesLabels.Visible = true;
axisX.Labels.SeriesLabels.Orientation = TextOrientation.Horizontal;
axisX.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.None;
axisX.TickmarkStyle = AxisTickStyle.Smart;
axisX.RangeMin = minXRange;
axisX.RangeMax = maxXRange;
axisX.RangeType = AxisRangeType.Custom;
Returns the ERROR: "Cannot implicity convert type 'System.DateTime' to 'double'
Any help is greatly appreciated. Ruben.
DateTime can be treated as a number if you convert it to Ticks, as inaxisX.RangeMin = minXRange.Ticks
how do you convert back.
i need to get the RangeMin and RangeMax values into a Date object.
Works perfectly!
Thanks.
DateTime object has a constructor that accepts ticks.DateTime myDateTime = new DateTime(ticks);