How to access index when using Mappers.Xy <double> with vertical series?

I am trying to understand the Mappers.XY class using a vertical series based on doubles. To test it, I want all the even indices of the Y axis to be filled in red, but .Fill seems to only use X values. Here is the code I have and the results:

var RedBrush = new SolidColorBrush(Color.FromRgb(238, 83, 80));

Mapper = Mappers.Xy<double>()
    .X((value, index) => value)
    .Y((value, index) => index)
    .Fill(index => index % 2 == 0 ? RedBrush : null)
    .Stroke(index => index % 2 == 0 ? RedBrush : null);

I finish red stripes only when the value of X is as shown here: of Red X-values I even changed .Fill value based on the value, but no change.

EDIT: I think I narrowed down the problem using the default method for .Fill, which:

public CartesianMapper<T> Fill(Func<T, object> predicate);

, , -. .Fill, , , int... :

 public CartesianMapper<T> Fill(Func<T, int, object> predicate);

, , . , :

.Fill(index => index % 2 == 0 ? RedBrush : null)

? .

*** , ...

: https://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration :

Series, , ​​ , Series null:

  var mapper = Mappers.Xy<MyClass>().X(v => v.XProp).Y(v => v.YProp);
  var seriesCollection = new SeriesCollection(mapper);
  myChart.SeriesCollection = seriesCollection;

, mapper , > global SeriesCollection:

var mapper = Mappers.Xy<MyClass>().X(v => v.XProp).Y(v => v.YProp);
var pieSeries = new PieSeries(mapper);

, ObservablePoints , , .

- , , ? ?

+4
1

.Fill :

    var Mapper = Mappers.Xy<double>()
            .X((value, index) => value)
            .Y((value, index) => index)
            .Fill((value, index) => index % 2 == 0 ? RedBrush : null);

- , - % 2 % 2.

mapper: Row row table

0

Source: https://habr.com/ru/post/1689372/


All Articles