/// <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 == DependentAxisOrientation) && (a is IRangeAxis) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualDependentValue))) .FirstOrDefault(); if (null == dependentAxis) { LinearAxis linearAxis = new LinearAxis { Orientation = DependentAxisOrientation, ShowGridLines = true }; if (IsStacked100) { Windows.UI.Xaml.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 == 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; }