Ejemplo n.º 1
0
 private void AddFiltered()
 {
     if (!FilteredData.Contains(_DataSource[1]))
     {
         FilteredData.Add(_DataSource[1]);
     }
 }
Ejemplo n.º 2
0
 public void ApplyFilter()
 {
     Filter          = new FilterData(this);
     Data            = new FilteredData(this);
     Поставщики      = ПолучитьСписокПоставщиков(this);
     СостоянияЗаказа = ПолучитьСписокСостоянийЗаказа(this);
 }
Ejemplo n.º 3
0
        private void CopyDataIntoBuffer(object sender, RoutedEventArgs e)
        {
            string[] values = FilteredData.Select(info => info.ToString(ExportSettings.ExportCountry, ExportSettings.ExportProxyType))
                              .ToArray();

            Clipboard.SetDataObject(string.Join(Environment.NewLine, values));
        }
Ejemplo n.º 4
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            _segments.Children.Clear();

            var angle = FilteredData.Map(0, 100, 0, 360);

            var radius       = (_segments.RenderSize.Smallest() * CircleScale) / 2;
            var segmentWidth = radius * SegmentWidthPercentage;
            var inactivePath = new ArcPath(359.999, 0, segmentWidth, CircleScale, radius, _segments.RenderSize, null)
            {
                DataContext = this
            };
            var activePath = new ArcPath(angle, AngleOffset, segmentWidth, CircleScale, radius, _segments.RenderSize, FilteredData)
            {
                DataContext = this
            };

            inactivePath.Fill = SegmentSpaceBackground.GetMaterial(FallbackMaterialSet);
            activePath.Fill   = RingForeground.GetMaterial(FallbackMaterialSet);
            //inactivePath.SetBinding(Shape.FillProperty, new Binding("SegmentSpaceBackground"));
            //activePath.SetBinding(Shape.FillProperty, new Binding("RingForeground"));

            _segments.Children.Add(inactivePath);
            _segments.Children.Add(activePath);

            base.OnRender(drawingContext);
        }
Ejemplo n.º 5
0
        private void AddToBlackList_Click(object sender, RoutedEventArgs e)
        {
            ProxyInfo proxy = (ProxyInfo)((Button)sender).Tag;

            foreach (IProxyClient client in Context.Get <IProxyClientSearcher>().SelectedClients.Where(item => item.Proxy == proxy))
            {
                client.Proxy = null;
            }

            Context.Get <IBlackListManager>().Add(proxy);
            PageData.Remove(proxy);

            if (Paging.Page < Paging.PageCount)
            {
                int index = Paging.Page.Value * Context.Get <AllSettings>().PageSize;
                PageData.Add(FilteredData[index]);
            }

            if (PageData.Count == 0 && Paging.Page > 1)
            {
                Paging.Page--;
            }

            Data.Remove(proxy);
            FilteredData.Remove(proxy);

            Context.Get <IRatingManager>().UpdateRatingDataAsync(proxy, 1);

            UpdateStatusString();
        }
Ejemplo n.º 6
0
 private void SortFilteredData(string sortMemberPath, ListSortDirection sortDirection)
 {
     FilteredData.Sort((proxyInfo1, proxyInfo2) =>
     {
         return(new ProxyInfoComparer(sortMemberPath, sortDirection).Compare(proxyInfo1, proxyInfo2));
     });
 }
Ejemplo n.º 7
0
        //public DataTable Поставщики;
        //public DataTable СостоянияЗаказа;

        public F0Model(RequestPackage rqp)
        {
            Rqp = rqp;
            //Filter = new FilterData(this);
            Data = new FilteredData(this);
            //Поставщики = ПолучитьСписокПоставщиков(this);
            //СостоянияЗаказа = ПолучитьСписокСостоянийЗаказа(this);
        }
Ejemplo n.º 8
0
 public void Clear()
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         Data.Clear();
         FilteredData.Clear();
         PageData.Clear();
     }));
 }
Ejemplo n.º 9
0
        public void UpdatePageData()
        {
            PageData.Clear();

            if (Paging.Page.HasValue)
            {
                PageData.AddRange(FilteredData.Skip((Paging.Page.Value - 1) * Context.Get <AllSettings>().PageSize).
                                  Take(Context.Get <AllSettings>().PageSize));
            }
        }
Ejemplo n.º 10
0
        public void ApplyFilter(RequestPackage rqp)
        {
            rqp.Command = "[Pharm-Sib].[dbo].[спецификации_зачёт_get]";
            ResponsePackage rsp = rqp.GetResponse("http://127.0.0.1:11012");

            if (rsp != null && rsp.Data != null && rsp.Data.Tables != null && rsp.Data.Tables.Count > 0)
            {
                Data = new FilteredData(rsp.Data.Tables[0]);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Get filtered data newer than since time
        /// </summary>
        public IBFSample[] GetFilteredData(DateTimeOffset since)
        {
            if (FilteredData.Count > 0)
            {
                var filtered = FilteredData.Where(x => x.ObservationTime > since);
                return(filtered.ToArray());
            }

            return(null);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Get some number of seconds of the filtered data
        /// </summary>
        public IBFSample[] GetFilteredData(double seconds)
        {
            if (FilteredData.Count > 0)
            {
                var last     = FilteredData.Last().TimeStamp;
                var filtered = FilteredData.Where(x => (last - x.TimeStamp) < seconds);
                return(filtered.ToArray());
            }

            return(null);
        }
Ejemplo n.º 13
0
        //  Public Methods
        #region PublicMethods

        /// <summary>
        /// Start async task to run data processing
        /// </summary>
        public async Task StartRealTimeProcessingAsync()
        {
            await StopRealTimeProcessingAsyncAsync();

            FilteredData.RemoveAll();

            // fire off the run tasks
            CancelTokenSource = new CancellationTokenSource();
            MonitorRunTask    = RunSignalFilteringAsync(CancelTokenSource.Token);

            Log?.Invoke(this, new LogEventArgs(Name, this, "StartMonitorAsync", $"Started signal filtering for {Name}.", LogLevel.INFO));
        }
Ejemplo n.º 14
0
        protected void HandleTextChanged(string text)
        {
            CurrentSearch = text ?? string.Empty;
            dirtyFilter   = true;

            if (text?.Length >= MinLength && FilteredData.Any())
            {
                dropdownRef.Open();
            }
            else
            {
                dropdownRef.Close();
            }
        }
Ejemplo n.º 15
0
        private void focusLargestDataPoint()
        {
            if (FilteredData.Count < 1)
            {
                return;
            }
            CategoricalDouble[] maxrsp = { FilteredData[0] };
            foreach (var d in FilteredData.Where(d =>
                                                 d.RenderedVisual.RequireType <ArcPath>().ArcAngle > maxrsp[0].RenderedVisual.RequireType <ArcPath>().ArcAngle))
            {
                maxrsp[0] = d;
            }

            FocusedSegment = maxrsp[0].RenderedVisual.RequireType <ArcPath>();
        }
Ejemplo n.º 16
0
 public void UpdateLastStockData(StockTickerData stockData)
 {
     if (Data.Any() && FilteredData.Any())
     {
         var lastStockData = this.Data.Last();
         if (lastStockData.Date.DayOfYear == stockData.Date.DayOfYear)
         {
             this.Data[this.Data.Count - 1] = stockData;
             this.FilteredData[this.FilteredData.Count - 1] = stockData;
         }
         else
         {
             this.Data.Add(stockData);
             this.FilteredData.Add(stockData);
         }
     }
 }
Ejemplo n.º 17
0
        private void UpdateFilteredData()
        {
            Dispatcher.Invoke(() =>
            {
                FilteredData.Clear();
                FilteredData.AddRange(Data.Where(proxy => !IsProxyFiltered(proxy)));

                using (PreventChangeSortingDirection preventor = new PreventChangeSortingDirection(DataGridControl))
                {
                    if (preventor.HasSorting)
                    {
                        SortFilteredData(preventor.SortMemberPath, preventor.SortDirection);
                    }
                }

                UpdateStatusString();
            });
        }
Ejemplo n.º 18
0
        protected async Task HandleTextChanged(string text)
        {
            CurrentSearch = text ?? string.Empty;
            SelectedText  = CurrentSearch;
            dirtyFilter   = true;

            if (text?.Length >= MinLength && FilteredData.Any())
            {
                dropdownRef.Open();
            }
            else
            {
                dropdownRef.Close();
            }

            //If input field is empty, clear current SelectedValue.
            if (string.IsNullOrEmpty(text))
            {
                await Clear();
            }
        }
Ejemplo n.º 19
0
        public void Add(ProxyInfo proxy)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                using (PreventChangeSortingDirection preventor = new PreventChangeSortingDirection(DataGridControl))
                {
                    Data.Add(proxy);

                    if (!IsProxyFiltered(proxy))
                    {
                        int index = GetInsertIndex(FilteredData, proxy, preventor);

                        FilteredData.Insert(index, proxy);

                        if (FilteredData.Count > 1) //If count is equal to one then PageData was updated already (on page changed event)
                        {
                            int page = (int)Math.Ceiling((double)(index + 1) / Context.Get <AllSettings>().PageSize);

                            if (page <= Paging.Page && PageData.Count == Context.Get <AllSettings>().PageSize)
                            {
                                PageData.Remove(PageData.Last());
                            }

                            if (page < Paging.Page)
                            {
                                PageData.Insert(0, FilteredData[(Paging.Page.Value - 1) * Context.Get <AllSettings>().PageSize]);
                            }
                            else if (page == Paging.Page)
                            {
                                PageData.Insert(index - (page - 1) * Context.Get <AllSettings>().PageSize, proxy);
                            }
                        }
                    }

                    UpdateStatusString();
                }
            }));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Handles the search field onchange or oninput event.
        /// </summary>
        /// <param name="text">Serach value.</param>
        /// <returns>Returns awaitable task</returns>
        protected async Task OnTextChangedHandler(string text)
        {
            CurrentSearch = text ?? string.Empty;
            SelectedText  = CurrentSearch;
            dirtyFilter   = true;

            if (text?.Length >= MinLength && FilteredData.Any())
            {
                dropdownRef.Show();
            }
            else
            {
                dropdownRef.Hide();
            }

            //If input field is empty, clear current SelectedValue.
            if (string.IsNullOrEmpty(text))
            {
                await Clear();
            }

            await SearchChanged.InvokeAsync(CurrentSearch);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Handles the search field onfocusin event.
        /// </summary>
        /// <param name="eventArgs">Event arguments.</param>
        /// <returns>Returns awaitable task</returns>
        protected async Task OnTextKeyDownHandler(KeyboardEventArgs eventArgs)
        {
            if (!DropdownVisible)
            {
                return;
            }

            // make sure everything is filtered
            if (dirtyFilter)
            {
                FilterData();
            }

            var activeItemIndex = ActiveItemIndex;

            if (eventArgs.Code == "Enter" || eventArgs.Code == "NumpadEnter" || eventArgs.Code == "Tab")
            {
                var item = FilteredData.ElementAtOrDefault(activeItemIndex);

                if (item != null && ValueField != null)
                {
                    await OnDropdownItemClicked(ValueField.Invoke(item));
                }
            }
            else if (eventArgs.Code == "Escape")
            {
                await Clear();
            }
            else if (eventArgs.Code == "ArrowUp")
            {
                UpdateActiveFilterIndex(--activeItemIndex);
            }
            else if (eventArgs.Code == "ArrowDown")
            {
                UpdateActiveFilterIndex(++activeItemIndex);
            }
        }
Ejemplo n.º 22
0
        public FilteredData <User> ReadAll(FilterVehiclesPriceList filter)
        {
            //Create a Filtered List
            var FilteredData = new FilteredData <User>();

            //If there is a Filter then filter the list and set Count
            //if (filter != null && filter.ItemsPrPage > 0 && filter.CurrentPage > 0)
            //{
            //    FilteredData.Items = _ctx.Users
            //        .Select(u => new User { Id = u.Id, Email = u.Email})
            //        .Skip((filter.CurrentPage - 1) * filter.ItemsPrPage)
            //        .Take(filter.ItemsPrPage);
            //    //FilteredData.Count = _ctx.Users.Count();
            //    return FilteredData;
            //}

            //Else just return the full list and get the count from the list (to save a SQL call)
            FilteredData.Items = _ctx.Users
                                 .Select(u => new User {
                Id = u.Id, Email = u.Email
            });
            //FilteredData.Count = FilteredData.Items.Count();
            return(FilteredData);
        }
Ejemplo n.º 23
0
        public async Task <FilteredData <dynamic> > GetFilteredDataAsync(string tableName,
                                                                         ICriteria baseCriteria,
                                                                         IDictionary <string, SortDirection> orderByExpression = null,
                                                                         ICriteria filterCriteria = null,
                                                                         int pageSize             = -1,
                                                                         int pageNumber           = 0)
        {
            IDictionary <string, SortDirection> orderBy = CheckOrderByExpressionOrDefault(orderByExpression);

            ColumnInfo[] columns = await GetTableInfoAsync(tableName);

            using DbConnection connection = new SqlConnection(ConnectionString);
            await connection.OpenAsync();

            DbCommand command = connection.CreateCommand();

            command.Transaction = await connection.BeginTransactionAsync(IsolationLevel.ReadUncommitted);

            int paramNumber = 0;
            FormatedCriteria baseFormatedCriteria = baseCriteria.Format(0);

            paramNumber         = baseFormatedCriteria.Params.Length;
            command.CommandText = $@"
select count(*)
  from {TableSchema}.{tableName}
 where {baseFormatedCriteria.Query}";
            command.Parameters.AddRange(baseFormatedCriteria.Params);
            FilteredData <dynamic> data = new FilteredData <dynamic>
            {
                TotalCount = int.Parse(command.ExecuteScalar().ToString())
            };
            List <dynamic>   records = new List <dynamic>();
            FormatedCriteria filterFormatedCriteria = (filterCriteria ?? ICriteria.Empty).Format(paramNumber);

            command.CommandText = $@"
select {columns.Select(c => c.ColumnName).Aggregate((cur, next) => cur + ", " + next)}
  from {TableSchema}.{tableName}
 where {baseFormatedCriteria.Query} and {filterFormatedCriteria.Query}
 order by {orderBy.Select(ex => $"{ex.Key} {ex.Value}").Aggregate((cur, next) => cur + ", " + next)}";
            if (pageSize > 0)
            {
                command.CommandText += $@"
offset @offset ROWS
 fetch next @fetch rows only";
                command.Parameters.AddRange(new[]
                {
                    new SqlParameter("offset", SqlDbType.Int)
                    {
                        Value = pageSize * pageNumber
                    },
                    new SqlParameter("fetch", SqlDbType.Int)
                    {
                        Value = pageSize
                    }
                });
            }
            command.Parameters.AddRange(filterFormatedCriteria.Params);
            using (DbDataReader dr = command.ExecuteReader())
            {
                while (dr.Read())
                {
                    Dictionary <string, object> record = new Dictionary <string, object>();
                    for (int i = 0; i < columns.Length; i++)
                    {
                        ColumnInfo column = columns[i];
                        record.Add(column.PropertyName, column.CanNullable && dr.IsDBNull(i) ? null : GetTypedValue(dr, 0, column.Type));
                    }
                    records.Add(new RepositoryDynamicObject(record));
                }
            }
            data.Data          = records;
            data.FilteredCount = records.Count;
            command.Transaction.Commit();
            command.Dispose();
            connection.Close();
            return(data);
        }
Ejemplo n.º 24
0
        public ActionResult Search(EnteredDataExt u)
        {
            int    year     = u.year;
            string variable = u.variable;
            int    elId     = u.idMeasurementType;

            EnteredDataExt searchedInfo = u;

            Session.Add("SearchedInfo", searchedInfo);
            if (u.idStation != 0)
            {
                if (u.idDataType == 1)            //Búsqueda para tipos de datos Observation
                {
                    if (u.idMeasurementType == 1) //Búsqueda cuando la información es de meteorología
                    {
                        List <meteorologicalData> searchedData = (from doc in db.enteredDatas
                                                                  join data in db.meteorologicalDatas on doc.idEnteredData equals data.idEnteredData
                                                                  where doc.idStation == u.idStation && (SqlFunctions.DatePart("year", doc.startDate) == year || SqlFunctions.DatePart("year", doc.endDate) == year) && SqlFunctions.DatePart("year", data.dateData) == year //&& Convert.ToDouble(data.Get<meteorologicalData>(variable).ToString()) != -6999
                                                                  select data).ToList();

                        if (searchedData.Any())
                        {
                            List <FilteredData> summary = new List <FilteredData>();
                            foreach (var item in searchedData)
                            {
                                if (Double.Parse(item.Get <double>(variable).ToString()) != -6999)
                                {
                                    FilteredData aux = new FilteredData()
                                    {
                                        key1 = item.dateData,
                                        Key2 = Double.Parse(item.Get <double>(variable).ToString())
                                    };
                                    summary.Add(aux);
                                }
                            }
                            IEnumerable <FilteredData> result;
                            if (variable == "precipitationAmount") //Para precipitaciones se suma (valor acumulado)
                            {
                                result = from f in summary
                                         group f by f.key1.Date into g
                                         select new FilteredData {
                                    key1 = g.Key, Key2 = g.Sum(x => Convert.ToDouble(x.Key2.ToString()))
                                };
                                //generateGraphics(result, variable);
                            }
                            else //Para el resto de variables se promedia
                            {
                                result = from f in summary
                                         group f by f.key1.Date into g
                                         select new FilteredData {
                                    key1 = g.Key, Key2 = g.Average(x => Convert.ToDouble(x.Key2.ToString()))
                                };
                                //generateGraphics(result, variable);
                            }
                            Session.Add("stationInfo", db.stations.Single(i => i.idStation == u.idStation));
                            Session.Add("resultInfo", result);
                            Session.Add("variableInfo", variable);

                            generateGraphics(result, variable, u);

                            aux = u;
                            Session.Add("results", result);
                            return(View("ShowResults", result));
                        }
                        else
                        {
                            Session.Add("notification", "No data found with the selected search criteria");
                            Session["message"] = null;
                            Session["error"]   = null;
                            return(RedirectToAction("Search", u));
                        }
                    }

                    else if (u.idMeasurementType == 2) //Búsqueda cuando la información es de glaciología
                    {
                        List <glaciologicalData> searchedData = (from doc in db.enteredDatas
                                                                 join data in db.glaciologicalDatas on doc.idEnteredData equals data.idEnteredData
                                                                 where doc.idEnteredData == u.idEnteredData && data.altitudinalBar == u.altitudinalBar
                                                                 select data).ToList();
                        if (searchedData.Any())
                        {
                            List <FilteredData> summary = new List <FilteredData>();
                            foreach (var item in searchedData)
                            {
                                var cnkjdvbhdfbvdf = item.Get <double>(variable).ToString();
                                if (Double.Parse(item.Get <double>(variable).ToString()) != -6999)
                                {
                                    if (item.startDay != -6999)
                                    {
                                        FilteredData aux = new FilteredData()
                                        {
                                            key1 = (DateTime.Parse(item.startDay.ToString() + "/" + item.startMonth.ToString() + "/" + item.startYear.ToString())),
                                            //key3 = item.startMonth,
                                            Key2 = Double.Parse(item.Get <double>(variable).ToString())
                                        };
                                        summary.Add(aux);
                                    }
                                    else
                                    {
                                        FilteredData aux = new FilteredData()
                                        {
                                            key1 = (DateTime.Parse("01" + "/" + item.startMonth.ToString() + "/" + item.startYear.ToString())),
                                            //key3 = item.startMonth,
                                            Key2 = Double.Parse(item.Get <double>(variable).ToString())
                                        };
                                        summary.Add(aux);
                                    }
                                }
                            }
                            IEnumerable <FilteredData> result;
                            result = (IEnumerable <FilteredData>)(summary);

                            Session.Add("stationInfo", db.stations.Single(i => i.idStation == u.idStation));
                            Session.Add("resultInfo", result);
                            Session.Add("variableInfo", variable);
                            Session.Add("altitudinalBar", u.altitudinalBar);

                            generateGraphics(result, variable, u);

                            aux = u;
                            Session.Add("results", result);
                            return(View("ShowResults", result));
                        }
                        else
                        {
                            Session.Add("notification", "No data found with the selected search criteria");
                            Session["message"] = null;
                            Session["error"]   = null;
                            return(RedirectToAction("Search", u));
                        }
                    }

                    else             //Búsqueda cuando la información es de hidrología
                    {
                        List <hydrologicalData> searchedData = (from doc in db.enteredDatas
                                                                join data in db.hydrologicalDatas on doc.idEnteredData equals data.idEnteredData
                                                                where doc.idStation == u.idStation && (SqlFunctions.DatePart("year", doc.startDate) == year || SqlFunctions.DatePart("year", doc.endDate) == year) && SqlFunctions.DatePart("year", data.dateData) == year //&& Convert.ToDouble(data.Get<meteorologicalData>(variable).ToString()) != -6999
                                                                select data).ToList();

                        if (searchedData.Any())
                        {
                            List <FilteredData> summary = new List <FilteredData>();
                            foreach (var item in searchedData)
                            {
                                var cnkjdvbhdfbvdf = item.Get <double>(variable).ToString();
                                if (Double.Parse(item.Get <double>(variable).ToString()) != -6999)
                                {
                                    FilteredData aux = new FilteredData()
                                    {
                                        key1 = item.dateData,
                                        Key2 = Double.Parse(item.Get <double>(variable).ToString())
                                    };
                                    summary.Add(aux);
                                }
                            }
                            IEnumerable <FilteredData> result;

                            result = from f in summary
                                     group f by f.key1.Date into g
                                     select new FilteredData {
                                key1 = g.Key, Key2 = g.Average(x => Convert.ToDouble(x.Key2.ToString()))
                            };

                            //generateGraphics(result, variable);
                            Session.Add("stationInfo", db.stations.Single(i => i.idStation == u.idStation));
                            Session.Add("resultInfo", result);
                            Session.Add("variableInfo", variable);

                            generateGraphics(result, variable, u);

                            aux = u;
                            Session.Add("results", result);
                            return(View("ShowResults", result));
                        }
                        else
                        {
                            Session.Add("notification", "No data found with the selected search criteria");
                            Session["message"] = null;
                            Session["error"]   = null;
                            return(RedirectToAction("Search", u));
                        }
                    }
                }
                else
                {
                    Session.Add("notification", "Simulations are not available at this moment. We are sorry!");
                    Session["message"] = null;
                    Session["error"]   = null;
                    return(RedirectToAction("Search", u));
                }
            }
            else
            {
                Session.Add("notification", null);
                Session["message"] = null;
                Session["error"]   = "Select all fields";
                return(RedirectToAction("Search"));
            }
        }
Ejemplo n.º 25
0
        public void Get(Guid sessionId, RequestPackage rqp0)
        {
            if (rqp0 != null)
            {
                sessionId  = rqp0.SessionId;
                Filter.все = rqp0["все"] as String;
                Filter.спецификация_min = (rqp0["спецификация_min"] == null) ? "": rqp0["спецификация_min"].ToString();
                Filter.спецификация_max = (rqp0["спецификация_max"] == null) ? "" : rqp0["спецификация_max"].ToString();
            }
            RequestPackage rqp = new RequestPackage()
            {
                SessionId  = sessionId,
                Command    = "[Pharm-Sib].[dbo].[спецификации_зачёт_get]",
                Parameters = new RequestParameter[] {
                    new RequestParameter()
                    {
                        Name = "все", Value = Filter.все
                    },
                    new RequestParameter()
                    {
                        Name = "разрешено", Value = Filter.разрешено
                    },
                    new RequestParameter()
                    {
                        Name = "не_разрешено", Value = Filter.не_разрешено
                    }
                }
            };

            if (!String.IsNullOrWhiteSpace(Filter.дата_min))
            {
                rqp["дата_min"] = Filter.дата_min;
            }
            if (!String.IsNullOrWhiteSpace(Filter.дата_max))
            {
                rqp["дата_max"] = Filter.дата_max;
            }
            if (!String.IsNullOrWhiteSpace(Filter.менеджер))
            {
                rqp["менеджер"] = Filter.менеджер;
            }
            if (!String.IsNullOrWhiteSpace(Filter.аукцион))
            {
                rqp["аукцион"] = Filter.аукцион;
            }
            if (!String.IsNullOrWhiteSpace(Filter.спецификация_min))
            {
                rqp["спецификация_min"] = Filter.спецификация_min;
            }
            if (!String.IsNullOrWhiteSpace(Filter.спецификация_max))
            {
                rqp["спецификация_max"] = Filter.спецификация_max;
            }
            rqp.AddSessionIdToParameters();
            ResponsePackage rsp = rqp.GetResponse("http://127.0.0.1:11012");

            if (rsp != null && rsp.Data != null && rsp.Data.Tables != null && rsp.Data.Tables.Count > 0)
            {
                Data = new FilteredData(rsp.Data.Tables[0]);
            }
        }
Ejemplo n.º 26
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            //TODO potential rendering loop.
            if (FilteredData.Count < 1)
            {
                FilteredData = DataFilter.Filter(DataSorter.Sort(Data));
                base.OnRender(drawingContext);
                return;
            }
            visualContext = new ParetoChartVisualContext();

            PART_bars.Children.Clear();
            PART_barlabels.Children.Clear();
            PART_line.Children.Clear();
            PART_xaxis.Children.Clear();
            //_highlightGrid.Children.Clear();

            var max = FilteredData.MaxValue();

            var context           = new ProviderContext(FilteredData.Count);
            var barAvailableWidth = (PART_bars.RenderSize.Width) / FilteredData.Count;
            var barActiveWidth    = barAvailableWidth * SegmentWidthPercentage;
            var barLeftSpacing    = (barAvailableWidth - barActiveWidth) / 2;
            var barLabelSize      = RenderingExtensions.EstimateLabelRenderSize(BarTotalFontFamily, BarTotalFontSize);

            MaterialProvider.Reset(context);

            #region X-Axis Label Generation

            var xtrace = 0;
            foreach (var d in FilteredData)
            {
                var material = MaterialProvider.ProvideNext(context);
                var categoryVisualContext = new ParetoChartCategoryVisualContext();
                var axisLabel             = new Label
                {
                    Content                    = d.CategoryName,
                    IsHitTestVisible           = false,
                    HorizontalContentAlignment = HorizontalAlignment.Center,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalAlignment          = VerticalAlignment.Bottom,
                    Width       = barAvailableWidth,
                    Margin      = new Thickness(barAvailableWidth * xtrace, 0, 0, 0),
                    DataContext = this,
                    Foreground  = XAxisForeground.GetMaterial(material)
                };
                axisLabel.BindTextualPrimitive <XAxisPrimitive>(this);
                categoryVisualContext.AxisLabel = axisLabel;
                PART_xaxis.Children.Add(axisLabel);
                visualContext.CategoryVisuals.Add(categoryVisualContext);
                xtrace++;
            }

            #endregion

            MaterialProvider.Reset(context);
            var horizontalTrace = 0d;
            var xAxisHeight     = barLabelSize.Height;         //_xAxisGrid.ActualHeight;
            var backHeight      = PART_bars.RenderSize.Height - xAxisHeight;
            var trace           = 0;
            foreach (var d in FilteredData)
            {
                var currentCategoryVisualContext = visualContext.CategoryVisuals[trace];
                currentCategoryVisualContext.CategoryDataPoint = d;
                //if (barActiveWidth <= 0 || backHeight <= 0) return; //TODO fix
                var material = MaterialProvider.ProvideNext(context);
                currentCategoryVisualContext.CategoryMaterialSet = material;

                var backRectangle = new Rectangle
                {
                    Width               = barActiveWidth,
                    Height              = Math.Abs(backHeight),
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Fill   = SegmentSpaceBackground.GetMaterial(material),
                    Margin = new Thickness(horizontalTrace + barLeftSpacing, 0, 0, xAxisHeight)
                };


                currentCategoryVisualContext.InactiveBarVisual = backRectangle;
                PART_bars.Children.Add(backRectangle);

                var height    = d.Value.Map(0, max, 0, PART_bars.RenderSize.Height - xAxisHeight - barLabelSize.Height);
                var rectangle = new Rectangle
                {
                    Width                 = barActiveWidth,
                    Height                = Math.Abs(height),
                    Fill                  = SegmentForeground.GetMaterial(material),
                    VerticalAlignment     = VerticalAlignment.Bottom,
                    HorizontalAlignment   = HorizontalAlignment.Left,
                    Margin                = new Thickness(horizontalTrace + barLeftSpacing, 0, 0, xAxisHeight),
                    RenderTransform       = new ScaleTransform(1, 0, .5, 1),
                    RenderTransformOrigin = new Point(.5, 1)
                };


                currentCategoryVisualContext.ActiveBarRenderTransformScaleYAnimationAspect =
                    new AnimationAspect <double, Transform, DoubleAnimation>(rectangle.RenderTransform,
                                                                             ScaleTransform.ScaleYProperty, 0, 1, animationState)
                {
                    AccelerationRatio = AnimationParameters.AccelerationRatio,
                    DecelerationRatio = AnimationParameters.DecelerationRatio,
                    Duration          = TimeSpan.FromMilliseconds(800)
                };

                //TODO replace .RenderedVisual pairing method completely
                d.RenderedVisual = rectangle;
                PART_bars.Children.Add(rectangle);

                #region Bar Value Label Generation

                var beginBarLabelMargin  = new Thickness(horizontalTrace, 0, 0, xAxisHeight);
                var actualBarLabelMargin = new Thickness(horizontalTrace, 0, 0, xAxisHeight + height);

                var barLabel = new Label
                {
                    Content                    = d.Value,
                    IsHitTestVisible           = false,
                    HorizontalContentAlignment = HorizontalAlignment.Center,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalAlignment          = VerticalAlignment.Bottom,
                    Width      = barAvailableWidth,
                    Foreground = BarTotalForeground.GetMaterial(material)
                };
                barLabel.BindTextualPrimitive <BarTotalPrimitive>(this);

                currentCategoryVisualContext.BarLabelMarginAnimationAspect = new AnimationAspect
                                                                             <Thickness, Label, ThicknessAnimation>(
                    barLabel, MarginProperty, beginBarLabelMargin, actualBarLabelMargin, animationState)
                {
                    AccelerationRatio = AnimationParameters.AccelerationRatio,
                    DecelerationRatio = AnimationParameters.DecelerationRatio,
                    Duration          = TimeSpan.FromMilliseconds(800)
                };

                #endregion

                PART_barlabels.Children.Add(barLabel);
                horizontalTrace += barAvailableWidth;
                trace++;
            }
            var total = FilteredData.SumValue();
            var availableLineGraphSize = new Size(PART_bars.ActualWidth - (DotRadius * 2),
                                                  PART_bars.ActualHeight - (DotRadius * 2) - xAxisHeight);
            var startX = (barAvailableWidth / 2) - DotRadius;

            var verticalpttrace = 0d;
            var pttrace         = 0;

            var pathSegments = new PathSegmentCollection();
            var pathFigure   = new PathFigure
            {
                Segments = pathSegments
            };
            MaterialProvider.Reset(context);

            var isFirstPoint = true;
            foreach (var d in FilteredData)
            {
                var material = MaterialProvider.ProvideNext(context);
                var currentCategoryVisualContext = visualContext.CategoryVisuals[pttrace];
                var nextPoint          = new Point(startX + (barAvailableWidth * pttrace), verticalpttrace + xAxisHeight);
                var baseAnimationPoint = new Point(nextPoint.X, 0).LocalizeInCartesianSpace(PART_line);
                var actualNextPoint    = nextPoint.LocalizeInCartesianSpace(PART_line);

                // TODO get rid of this
                var plottedPoint = IsLoaded ? actualNextPoint : baseAnimationPoint;

                if (isFirstPoint)
                {
                    visualContext.PolyLineStartPointAnimationAspect = new AnimationAspect <Point, PathFigure, PointAnimation>(
                        pathFigure, PathFigure.StartPointProperty, baseAnimationPoint, actualNextPoint, animationState)
                    {
                        AccelerationRatio = AnimationParameters.AccelerationRatio,
                        DecelerationRatio = AnimationParameters.DecelerationRatio,
                        Duration          = TimeSpan.FromMilliseconds(800),
                    };
                    isFirstPoint = false;
                }
                else
                {
                    var lineSegment = new LineSegment(plottedPoint, true)
                    {
                        IsSmoothJoin = true
                    };
                    pathSegments.Add(lineSegment);

                    visualContext.LineSegmentVisuals.Add(new ParetoChartLineSegmentVisualContext
                    {
                        PointAnimationAspect =
                            new AnimationAspect <Point, LineSegment, PointAnimation>(lineSegment, LineSegment.PointProperty,
                                                                                     baseAnimationPoint, actualNextPoint, animationState)
                        {
                            AccelerationRatio = AnimationParameters.AccelerationRatio,
                            DecelerationRatio = AnimationParameters.DecelerationRatio,
                            Duration          = TimeSpan.FromMilliseconds(800)
                        }
                    });
                }

                var beginDotMargin  = new Thickness(nextPoint.X, 0, 0, xAxisHeight);
                var actualDotMargin = new Thickness(nextPoint.X, 0, 0, nextPoint.Y);

                var dot = new Ellipse
                {
                    Width               = (DotRadius * 2),
                    Height              = (DotRadius * 2),
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Fill   = DotFill.GetMaterial(material),
                    Stroke = DotStroke.GetMaterial(material),
                };
                BindingOperations.SetBinding(dot, Shape.StrokeThicknessProperty, new Binding("DotStrokeThickness")
                {
                    Source = this
                });

                currentCategoryVisualContext.DotMarginAnimationAspect =
                    new AnimationAspect <Thickness, Ellipse, ThicknessAnimation>(dot, MarginProperty,
                                                                                 beginDotMargin, actualDotMargin, animationState)
                {
                    AccelerationRatio = AnimationParameters.AccelerationRatio,
                    DecelerationRatio = AnimationParameters.DecelerationRatio,
                    Duration          = TimeSpan.FromMilliseconds(800)
                };

                PART_line.Children.Add(dot);
                Panel.SetZIndex(dot, 50);
                verticalpttrace += d.Value.Map(0, total, 0, availableLineGraphSize.Height);
                pttrace++;
            }

            var path = new Path
            {
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Left,
                Data = new PathGeometry
                {
                    Figures = new PathFigureCollection
                    {
                        pathFigure
                    }
                },
                Margin = new Thickness(DotRadius, 0, 0, xAxisHeight + DotRadius),
                Stroke = LineStroke.GetMaterial(FallbackMaterialSet),
            };
            BindingOperations.SetBinding(path, Shape.StrokeThicknessProperty, new Binding("LineStrokeThickness")
            {
                Source = this
            });

            PART_line.Children.Add(path);
            base.OnRender(drawingContext);
        }
Ejemplo n.º 27
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            PART_bars.Children.Clear();
            PART_xAxis.Children.Clear();
            PART_highlight.Children.Clear();

            if (FilteredData.Count < 1)
            {
                base.OnRender(drawingContext);
                return;
            }
            var total = FilteredData.MaxValue();

            var context           = new ProviderContext(FilteredData.Count);
            var barAvailableWidth = PART_bars.RenderSize.Width / FilteredData.Count;
            var barActiveWidth    = barAvailableWidth * SegmentWidthPercentage;
            var barLeftSpacing    = (barAvailableWidth - barActiveWidth) / 2;
            var barLabelSize      = RenderingExtensions.EstimateLabelRenderSize(BarTotalFontFamily, BarTotalFontSize);

            MaterialProvider.Reset(context);
            var xtrace = 0;

            foreach (var d in FilteredData)
            {
                var materialSet = MaterialProvider.ProvideNext(context);
                var axisLabel   = new Label
                {
                    Content                    = d.CategoryName,
                    IsHitTestVisible           = false,
                    HorizontalContentAlignment = HorizontalAlignment.Center,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalAlignment          = VerticalAlignment.Bottom,
                    Width       = barAvailableWidth,
                    Margin      = new Thickness(barAvailableWidth * xtrace, 0, 0, 0),
                    Foreground  = BarTotalForeground.GetMaterial(materialSet),
                    DataContext = this
                };
                axisLabel.BindTextualPrimitive <XAxisPrimitive>(this);

                PART_xAxis.Children.Add(axisLabel);
                xtrace++;
            }
            var horizontalTrace = 0d;
            var xAxisHeight     = PART_xAxis.ActualHeight;
            var backHeight      = PART_bars.RenderSize.Height - xAxisHeight;

            MaterialProvider.Reset(context);
            foreach (var d in FilteredData)
            {
                var materialSet   = MaterialProvider.ProvideNext(context);
                var backRectangle = new Rectangle
                {
                    Width               = barActiveWidth,
                    Height              = backHeight,
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin              = new Thickness(horizontalTrace + barLeftSpacing, 0, 0, xAxisHeight),
                    Fill = SegmentSpaceBackground.GetMaterial(materialSet)
                };
                //backRectangle.MouseEnter += (s, e) => barMouseEnter(d);
                //BindingOperations.SetBinding(backRectangle, Shape.FillProperty, new Binding("SegmentSpaceBackground") { Source = this });

                PART_bars.Children.Add(backRectangle);


                var verticalTrace = 0d;
                var pathBuffer    = new List <Shape>();


                var height    = d.Value.Map(0, total, 0, PART_bars.RenderSize.Height - xAxisHeight - barLabelSize.Height);
                var rectangle = new Rectangle
                {
                    Width               = barActiveWidth,
                    Height              = height + verticalTrace,
                    Fill                = SegmentForeground.GetMaterial(materialSet),
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin              = new Thickness(horizontalTrace + barLeftSpacing, 0, 0, xAxisHeight)
                };
                //rectangle.MouseEnter += (s, e) => barMouseEnter(d);
                //rectangle.MouseLeave += (s, e) => barMouseLeave(s, e, d, sd);
                rectangle.RenderTransform       = new ScaleTransform(1, (IsLoaded ? 1 : 0), .5, 1);           //TODO get rid of all isloaded conditional sets
                rectangle.RenderTransformOrigin = new Point(.5, 1);

                d.RenderedVisual = rectangle;
                pathBuffer.Add(rectangle);
                verticalTrace += height;

                for (var x = pathBuffer.Count - 1; x >= 0; x--)
                {
                    var path = pathBuffer[x];
                    PART_bars.Children.Add(path);
                }
                var barLabel = new Label
                {
                    Content                    = d.Value,
                    IsHitTestVisible           = false,
                    HorizontalContentAlignment = HorizontalAlignment.Center,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalAlignment          = VerticalAlignment.Bottom,
                    Width      = barAvailableWidth,
                    Foreground = BarTotalForeground.GetMaterial(materialSet),
                    Margin     = new Thickness(horizontalTrace, 0, 0, xAxisHeight + verticalTrace),
                };
                barLabel.BindTextualPrimitive <BarTotalPrimitive>(this);
                d.RenderedVisual = pathBuffer;
                PART_bars.Children.Add(barLabel);
                horizontalTrace += barAvailableWidth;
            }
            base.OnRender(drawingContext);
        }
Ejemplo n.º 28
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            //TODO potential rendering loop.
            if (FilteredData.Count < 1)
            {
                FilteredData = DataFilter.Filter(DataSorter.Sort(Data));
                base.OnRender(drawingContext);
                return;
            }
            visualContext = new NestedArcChartVisualContext();

            PART_segments.Children.Clear();
            PART_inactivesegments.Children.Clear();
            PART_categorylabels.Children.Clear();

            var context = new ProviderContext(FilteredData.Count);

            MaterialProvider.Reset(context);

            var fullArcDiameter      = PART_main.RenderSize.Height - TopRingPadding;
            var fullArcWidth         = fullArcDiameter - BottomRingPadding;
            var subArcAvailableWidth = fullArcWidth / FilteredData.Count;
            var subArcActualWidth    = subArcAvailableWidth * SegmentWidthPercentage;
            var subRingOffset        = (subArcAvailableWidth - subArcActualWidth) / 2;

            var fullRadius  = PART_main.RenderSize.Width / 2;
            var centerPoint = new Point(0, fullRadius);

            if (FilteredData.Count < 1)
            {
                base.OnRender(drawingContext);
                return;
            }

            var max   = FilteredData.MaxValue();
            var trace = 0;

            foreach (var d in FilteredData)
            {
                var categoryVisualContext = new NestedArcCategoryVisualContext();
                var materialSet           = MaterialProvider.ProvideNext(context);

                categoryVisualContext.CategoryDataPoint = d;
                var arcDiameter = BottomRingPadding + (subArcAvailableWidth * trace) + subRingOffset;

                var inactiveArcPath = CalculatePath(centerPoint, arcDiameter, subArcActualWidth);
                inactiveArcPath.Fill = SegmentSpaceBackground.GetMaterial(materialSet);
                //BindingOperations.SetBinding(inactiveArcPath, Shape.FillProperty, new Binding("SegmentSpaceBackground") { Source = this });

                categoryVisualContext.InactiveArcVisual = inactiveArcPath;
                PART_inactivesegments.Children.Add(inactiveArcPath);

                var activeArcAngle = d.Value.Map(0, max, 0, MaxArcAngle);

                var activeArcPath = CalculateActiveArcPath(centerPoint, arcDiameter, subArcActualWidth, activeArcAngle);


                categoryVisualContext.CategoryMaterialSet = materialSet;

                activeArcPath.Fill                  = SegmentForeground.GetMaterial(materialSet);
                activeArcPath.MouseOverFill         = materialSet.GetMaterial(Luminosity.P700);
                activeArcPath.RenderTransformOrigin = new Point(.5, 1);
                activeArcPath.RenderTransform       = new RotateTransform((IsLoaded ? 0 : 180), .5, .5);
                d.RenderedVisual = activeArcPath;

                categoryVisualContext.ActiveArcVisual = activeArcPath;
                PART_segments.Children.Add(activeArcPath);

                visualContext.CategoryVisuals.Add(categoryVisualContext);
                trace++;
            }
            var ltrace = 0;

            for (var x = FilteredData.Count - 1; x >= 0; x--)
            {
                var d = FilteredData[x];
                var currentCategoryVisualContext = visualContext.CategoryVisuals[x];
                var shape              = (Shape)d.RenderedVisual;     //.ShouldBeCastable<Shape>();
                var renderedFill       = (SolidColorBrush)shape.Fill; //.ShouldBeType<SolidColorBrush>();
                var arcLabelMarginLeft = fullRadius + LeftArcLabelSpacing;
                var categoryLabel      = new Label
                {
                    Width                      = ValueLabelHorizontalSpacing,
                    VerticalAlignment          = VerticalAlignment.Top,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalContentAlignment = HorizontalAlignment.Left,
                    Margin                     = new Thickness(arcLabelMarginLeft, (ltrace * subArcAvailableWidth) + subRingOffset + 6, 0, 0),
                    //Foreground = renderedFill.Lighten(.2),
                    Foreground  = ValueForeground.GetMaterial(currentCategoryVisualContext.CategoryMaterialSet),
                    Content     = d.CategoryName.ToUpper(),
                    Height      = subArcAvailableWidth,
                    Padding     = new Thickness(0),
                    Opacity     = IsLoaded ? 1 : 0,                 // TODO isloaded
                    DataContext = this
                };
                currentCategoryVisualContext.CategoryLabel = categoryLabel;
                //BindingOperations.SetBinding(categoryLabel, FontFamilyProperty, new Binding("ValueFontFamily") { Source = this });
                //BindingOperations.SetBinding(categoryLabel, FontStyleProperty, new Binding("ValueFontStyle") { Source = this });
                //BindingOperations.SetBinding(categoryLabel, FontWeightProperty, new Binding("ValueFontWeight") { Source = this });
                //BindingOperations.SetBinding(categoryLabel, FontSizeProperty, new Binding("ValueFontSize") { Source = this });
                categoryLabel.BindTextualPrimitive <ValuePrimitive>(this);
                var valuePercentLabel = new Label
                {
                    Width                      = ValueLabelHorizontalSpacing,
                    VerticalAlignment          = VerticalAlignment.Top,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalContentAlignment = HorizontalAlignment.Right,
                    Margin                     = new Thickness(arcLabelMarginLeft, (ltrace * subArcAvailableWidth) + subRingOffset + 6, 0, 0),
                    //Foreground = renderedFill.Lighten(.2),
                    Foreground  = ValueForeground.GetMaterial(currentCategoryVisualContext.CategoryMaterialSet),
                    Content     = d.Value + " Minutes",
                    Height      = subArcAvailableWidth,
                    Padding     = new Thickness(0),
                    Opacity     = IsLoaded ? 1 : 0,
                    DataContext = this
                };
                currentCategoryVisualContext.ValuePercentLabel = valuePercentLabel;
                valuePercentLabel.BindTextualPrimitive <ValuePrimitive>(this);
                var valueLabelLeftSpace = arcLabelMarginLeft + ValueLabelHorizontalSpacing;
                var valueLabelWidth     = PART_main.RenderSize.Width - valueLabelLeftSpace;
                if (valueLabelWidth < 0)
                {
                    valueLabelWidth = 0;
                }
                var valueLabel = new Label()
                {
                    Width                      = valueLabelWidth,
                    VerticalAlignment          = VerticalAlignment.Top,
                    HorizontalAlignment        = HorizontalAlignment.Left,
                    VerticalContentAlignment   = VerticalAlignment.Center,
                    HorizontalContentAlignment = HorizontalAlignment.Left,
                    Foreground                 = SecondaryValueForeground.GetMaterial(currentCategoryVisualContext.CategoryMaterialSet),
                    Margin                     = new Thickness(arcLabelMarginLeft + ValueLabelHorizontalSpacing, (ltrace * subArcAvailableWidth) + subRingOffset + 6, 0, 0),
                    Content                    = $" = {Math.Round(d.Value / 60, 2)} Hours", //{Math.Round(d.Value * 48):n0}
                    Height                     = subArcAvailableWidth,
                    Opacity                    = IsLoaded ? 1 : 0,                          // TODO isloaded
                    Padding                    = new Thickness(0),
                };
                currentCategoryVisualContext.ValueLabel = valueLabel;
                valueLabel.BindTextualPrimitive <SecondaryValuePrimitive>(this);

                PART_categorylabels.Children.Add(categoryLabel);
                PART_categorylabels.Children.Add(valuePercentLabel);
                PART_categorylabels.Children.Add(valueLabel);

                ltrace++;
            }
            base.OnRender(drawingContext);
        }
Ejemplo n.º 29
0
 private void RemoveFiltered()
 {
     FilteredData.Remove(_DataSource[1]);
 }
Ejemplo n.º 30
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            if (FilteredData.Count < 1)
            {
                base.OnRender(drawingContext);
                return;
            }
            visualContext = new LineGraphVisualContext();

            _bars.Children.Clear();
            _barLabels.Children.Clear();
            _lineVisual.Children.Clear();
            _xAxisGrid.Children.Clear();
            //_highlightGrid.Children.Clear();

            var max = FilteredData.MaxValue();

            var context           = new ProviderContext(FilteredData.Count);
            var barAvailableWidth = (_bars.RenderSize.Width) / FilteredData.Count;

            MaterialProvider.Reset(context);

            MaterialProvider.Reset(context);
            var total = FilteredData.SumValue();
            var availableLineGraphSize = new Size(_bars.ActualWidth - (DotRadius * 2),
                                                  _bars.ActualHeight - (DotRadius * 2));
            var startX = (barAvailableWidth / 2) - DotRadius;

            var verticalpttrace = 0d;
            var pttrace         = 0;

            var pathSegments = new PathSegmentCollection();
            var pathFigure   = new PathFigure
            {
                Segments = pathSegments
            };

            MaterialProvider.Reset(context);

            var isFirstPoint = true;

            foreach (var d in FilteredData)
            {
                var material           = MaterialProvider.ProvideNext(context);
                var nextPoint          = new Point(startX + (barAvailableWidth * pttrace), verticalpttrace + 0);
                var baseAnimationPoint = new Point(nextPoint.X, 0).LocalizeInCartesianSpace(_lineVisual);
                var actualNextPoint    = nextPoint.LocalizeInCartesianSpace(_lineVisual);

                // TODO get rid of this
                var plottedPoint = IsLoaded ? actualNextPoint : baseAnimationPoint;

                if (isFirstPoint)
                {
                    visualContext.PolyLineStartPointAnimationAspect = new AnimationAspect <Point, PathFigure, PointAnimation>(
                        pathFigure, PathFigure.StartPointProperty, baseAnimationPoint, actualNextPoint, animationState)
                    {
                        AccelerationRatio = AnimationParameters.AccelerationRatio,
                        DecelerationRatio = AnimationParameters.DecelerationRatio,
                        Duration          = TimeSpan.FromMilliseconds(800),
                    };
                    isFirstPoint = false;
                }
                else
                {
                    var lineSegment = new LineSegment(plottedPoint, true)
                    {
                        IsSmoothJoin = true
                    };
                    pathSegments.Add(lineSegment);

                    visualContext.LineSegmentVisuals.Add(new LineGraphLineSegmentVisualContext
                    {
                        PointAnimationAspect =
                            new AnimationAspect <Point, LineSegment, PointAnimation>(lineSegment, LineSegment.PointProperty,
                                                                                     baseAnimationPoint, actualNextPoint, animationState)
                        {
                            AccelerationRatio = AnimationParameters.AccelerationRatio,
                            DecelerationRatio = AnimationParameters.DecelerationRatio,
                            Duration          = TimeSpan.FromMilliseconds(800)
                        }
                    });
                }

                var beginDotMargin  = new Thickness(nextPoint.X, 0, 0, 0);
                var actualDotMargin = new Thickness(nextPoint.X, 0, 0, nextPoint.Y);

                var dot = new Ellipse
                {
                    Width               = (DotRadius * 2),
                    Height              = (DotRadius * 2),
                    VerticalAlignment   = VerticalAlignment.Bottom,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Fill   = DotFill.GetMaterial(material),
                    Stroke = DotStroke.GetMaterial(material),
                };
                BindingOperations.SetBinding(dot, Shape.StrokeThicknessProperty, new Binding("DotStrokeThickness")
                {
                    Source = this
                });

                //currentCategoryVisualContext.DotMarginAnimationAspect =
                //	new AnimationAspect<Thickness, Ellipse, ThicknessAnimation>(dot, MarginProperty,
                //		beginDotMargin, actualDotMargin, animationState)
                //	{
                //		AccelerationRatio = AnimationParameters.AccelerationRatio,
                //		DecelerationRatio = AnimationParameters.DecelerationRatio,
                //		Duration = TimeSpan.FromMilliseconds(800)
                //	};

                _lineVisual.Children.Add(dot);
                Panel.SetZIndex(dot, 50);
                verticalpttrace += d.Value.Map(0, total, 0, availableLineGraphSize.Height);
                pttrace++;
            }

            var path = new Path
            {
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Left,
                Data = new PathGeometry
                {
                    Figures = new PathFigureCollection
                    {
                        pathFigure
                    }
                },
                Margin = new Thickness(DotRadius, 0, 0, 0 + DotRadius),
                Stroke = LineStroke.GetMaterial(FallbackMaterialSet),
            };

            BindingOperations.SetBinding(path, Shape.StrokeThicknessProperty, new Binding("LineStrokeThickness")
            {
                Source = this
            });

            _lineVisual.Children.Add(path);
            base.OnRender(drawingContext);
        }