private void PrepareWeight() { if (!ActualSeries.Any(x => x is IBubbleSeriesView || x is IHeatSeries)) { return; } var vs = ActualSeries.Select(x => x.ActualValues.Limit3).ToArray(); Value3CoreLimit = new CoreLimit(vs.Select(x => x.Min).DefaultIfEmpty(0).Min(), vs.Select(x => x.Max).DefaultIfEmpty(0).Max()); }
private void PrepareVerticalStackedAreas() { if (!ActualSeries.Any(x => x is IVerticalStackedAreaSeriesViewView)) { return; } var isPercentage = ActualSeries.Any(x => x is IStackModelableSeriesView && x is IVerticalStackedAreaSeriesViewView && ((IStackModelableSeriesView)x).StackMode == StackMode.Percentage); foreach (var group in ActualSeries.OfType <IVerticalStackedAreaSeriesViewView>().GroupBy(x => x.ScalesXAt)) { StackPoints(group, AxisTags.X, group.Key, isPercentage ? StackMode.Percentage : StackMode.Values); } }
private void PrepareStackedColumns() { if (!ActualSeries.Any(x => x is IStackedColumnSeriesView)) { return; } var isPercentage = ActualSeries.Any(x => x is IStackModelableSeriesView && x is IStackedColumnSeriesView && ((IStackModelableSeriesView)x).StackMode == StackMode.Percentage); foreach (var group in ActualSeries.OfType <IStackedColumnSeriesView>().GroupBy(x => x.ScalesYAt)) { StackPoints(group, AxisOrientation.Y, group.Key, isPercentage ? StackMode.Percentage : StackMode.Values); } }
public override void PrepareAxes() { PivotZoomingAxis = AxisTags.X; base.PrepareAxes(); if (ActualSeries.Any(x => !(x.Model is ICartesianSeries))) { throw new LiveChartsException( "There is a invalid series in the series collection, " + "verify that all the series implement ICartesianSeries."); } var cartesianSeries = ActualSeries.Select(x => x.Model).Cast <ICartesianSeries>().ToArray(); for (var index = 0; index < AxisX.Count; index++) { var xi = AxisX[index]; xi.CalculateSeparator(this, AxisTags.X); xi.MinLimit = xi.MinValue ?? cartesianSeries.Where(x => x.View.ScalesXAt == index) .Select(x => x.GetMinX(xi)) .DefaultIfEmpty(0).Min(); xi.MaxLimit = xi.MaxValue ?? cartesianSeries.Where(x => x.View.ScalesXAt == index) .Select(x => x.GetMaxX(xi)) .DefaultIfEmpty(0).Max(); if (Math.Abs(xi.MinLimit - xi.MaxLimit) < xi.S * .01) { xi.MinLimit -= xi.S; xi.MaxLimit += xi.S; } } for (var index = 0; index < AxisY.Count; index++) { var yi = AxisY[index]; yi.CalculateSeparator(this, AxisTags.Y); yi.MinLimit = yi.MinValue ?? cartesianSeries.Where(x => x.View.ScalesYAt == index) .Select(x => x.GetMinY(yi)) .DefaultIfEmpty(0).Min(); yi.MaxLimit = yi.MaxValue ?? cartesianSeries.Where(x => x.View.ScalesYAt == index) .Select(x => x.GetMaxY(yi)) .DefaultIfEmpty(0).Max(); if (Math.Abs(yi.MinLimit - yi.MaxLimit) < yi.S * .01) { yi.MinLimit -= yi.S; yi.MaxLimit += yi.S; } } PrepareSeries(); CalculateComponentsAndMargin(); for (var index = 0; index < AxisX.Count; index++) { var xi = AxisX[index]; foreach (var section in xi.Sections) { section.View.DrawOrMove(AxisTags.X, index); } } for (var index = 0; index < AxisY.Count; index++) { var yi = AxisY[index]; foreach (var section in yi.Sections) { section.View.DrawOrMove(AxisTags.Y, index); } } }