/// <summary> /// Acquires an independent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireIndependentAxis() { IAxis independentAxis = SeriesHost.Axes .Where(a => (a.Orientation == AxisOrientation.X) && ((a is IRangeAxis) || (a is ICategoryAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue))) .FirstOrDefault(); if (null == independentAxis) { object probeValue = DataItems.Any() ? DataItems.First().ActualIndependentValue : null; double convertedDouble; DateTime convertedDateTime; if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDouble)) { independentAxis = new LinearAxis(); } else if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDateTime)) { independentAxis = new DateTimeAxis(); } else { independentAxis = new CategoryAxis(); } independentAxis.Orientation = AxisOrientation.X; } return(independentAxis); }
public MyCustomSingleData First(string criteria = null) { try { return(DataItems.First(GetExpression(criteria))); } catch (Exception ex) { throw ex; } }
/// <summary> /// Acquires a dependent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireDependentAxis() { IAxis dependentAxis = SeriesHost.Axes .Where(a => (a.Orientation == AxisOrientation.Y) && (a is IRangeAxis) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualDependentValue))) .FirstOrDefault(); if (null == dependentAxis) { LinearAxis linearAxis = new LinearAxis { Orientation = AxisOrientation.Y, ShowGridLines = true }; if (IsStacked100) { Style style = new Style(typeof(AxisLabel)); style.Setters.Add(new Setter(AxisLabel.StringFormatProperty, "{0}%")); linearAxis.AxisLabelStyle = style; } dependentAxis = linearAxis; } return(dependentAxis); }
/// <summary> /// Acquires an independent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireIndependentAxis() { IAxis independentAxis = SeriesHost.Axes .Where(a => (a.Orientation == IndependentAxisOrientation) && ((a is ICategoryAxis) || (a is IRangeAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue))) .FirstOrDefault(); if (null == independentAxis) { independentAxis = new CategoryAxis { Orientation = IndependentAxisOrientation }; } return(independentAxis); }
public MyCustomSingleData First() { return(DataItems.First()); }