コード例 #1
0
        protected override async Task OnParametersSetAsync()
        {
            series.Name           = Name;
            series.ShowDataLabels = ShowDataLabels;
            series.Stroke         = Stroke;
            var xCompiled = XValue.Compile();
            IEnumerable <DataPoint <TItem> > datalist;

            if (YAggregate == null)
            {
                var yCompiled = YValue.Compile();
                datalist = Items.Select(e => new DataPoint <TItem> {
                    X = xCompiled.Invoke(e), Y = yCompiled.Invoke(e), Items = new List <TItem> {
                        e
                    }
                });
            }
            else
            {
                var yAggCompiled = YAggregate.Compile();
                datalist = Items.GroupBy(e => xCompiled.Invoke(e)).Select(d => new DataPoint <TItem> {
                    X = d.Key, Y = yAggCompiled.Invoke(d), Items = d.ToList()
                });
            }

            if (OrderBy != null)
            {
                datalist = datalist.OrderBy(o => OrderBy.Compile().Invoke(o));
            }
            else if (OrderByDescending != null)
            {
                datalist = datalist.OrderByDescending(o => OrderByDescending.Compile().Invoke(o));
            }

            datalist    = datalist.ToList();
            series.Data = datalist;

            if (!Chart.ManualRender && Chart.ForceRender == false && currentDatalist != null && !currentDatalist.SequenceEqual(datalist, new DataPointComparer <TItem>()))
            {
                Chart.ForceRender = true;
            }

            currentDatalist = datalist;
        }