private async void LoadData() { var cv = new C1DataCollection <Customer>(Customer.GetCustomerList(100)); await cv.SortAsync(new SortDescription("FirstName", SortDirection.Ascending), new SortDescription("LastName", SortDirection.Descending)); grid.ItemsSource = cv; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. sunburst = new C1Sunburst(); sunburst.Binding = "Value"; sunburst.BindingName = "Year,Quarter,Month"; sunburst.ToolTipContent = "{}{name}\n{y}"; sunburst.DataLabel.Position = PieLabelPosition.Center; sunburst.DataLabel.Content = "{}{name}"; this.Add(sunburst); cv = new SunburstViewModel().View; cv.GroupChanged += View_GroupChanged; cv.SortChanged += Cv_SortChanged; //Sort cannot work synchronize with group in current DataCollection SortDescription yearSortDescription = new SortDescription("Year", SortDirection.Ascending); SortDescription quarterSortDescription = new SortDescription("Quarter", SortDirection.Ascending); SortDescription monthSortDescription = new SortDescription("MonthValue", SortDirection.Ascending); SortDescription[] sortDescriptions = new SortDescription[] { yearSortDescription, quarterSortDescription, monthSortDescription }; cv.SortAsync(sortDescriptions); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. picker.Model = new ChartTypesModel(this); this.flexPie.ToolTip = null; // prepare data source List <MyData> list = new List <MyData>(); list.Add(new MyData { Label = "Safari", Value = safari[0] }); list.Add(new MyData { Label = "Chrome", Value = chrome[0] }); list.Add(new MyData { Label = "Android", Value = android_browser[0] }); list.Add(new MyData { Label = "Opera", Value = opera_mini[0] }); list.Add(new MyData { Label = "IE", Value = internet_explorer[0] }); list.Add(new MyData { Label = "Other", Value = other[0] }); data = new C1DataCollection <MyData>(list); // set flexPie properties this.flexPie.ItemsSource = data; flexPie.BindingName = "Label"; flexPie.Binding = "Value"; this.flexPie.Header = TITLE + " 2015"; this.flexPie.Palette = Palette.Cyborg; this.flexPie.SliceBorderWidth = 1; this.flexPie.SelectedItemOffset = .1; C1Animation loadAnimation = new C1Animation(); loadAnimation.Duration = new TimeSpan(1000 * 10000); loadAnimation.Easing = C1Easing.Linear; flexPie.LoadAnimation = loadAnimation; flexPie.AnimationMode = AnimationMode.Point; C1Animation updateAnimation = new C1Animation(); updateAnimation.Duration = new TimeSpan(1000 * 10000); updateAnimation.Easing = C1Easing.Linear; this.flexPie.UpdateAnimation = updateAnimation; flexPie.SelectedItemPosition = ChartPositionType.Auto; flexPie.SelectedItemPosition = ChartPositionType.Top; flexPie.LegendPosition = ChartPositionType.Left; this.flexPie.SelectionStyle.StrokeDashArray = new double[] { 7.5, 2.5 }; flexPie.SelectionMode = ChartSelectionModeType.Point; }
private void UpdateData() { var detailItems = from DataItem data in ItemList group data by data.Month into groupItems orderby groupItems.Key select new DetailDataItem { Month = groupItems.Key, SumRevenue = groupItems.Sum(i => i.Revenue), SumUnits = groupItems.Sum(i => i.Units), }; DetailItemList = new C1DataCollection <DetailDataItem>(detailItems); double unitStartValue = 0; double revenueStartValue = 0; double maxUnitValue = MathHelper.Instance.GetMaxValue(); double maxRevenueValue = MathHelper.Instance.GetMaxValue(false); double deltaUnit = FlexChartHelper.Instance.CalculateTrendLine(out unitStartValue); double deltaRevenue = FlexChartHelper.Instance.CalculateTrendLine(out revenueStartValue, false); int index = 0; foreach (DetailDataItem item in DetailItemList) { item.MaxUnits = maxUnitValue; item.MaxRevenue = maxRevenueValue; item.TrendUnitValue = unitStartValue + deltaUnit * index; item.TrendRevenueValue = revenueStartValue + deltaRevenue * index; index++; } CurrentUnitSales = ItemList.Sum(i => ((DataItem)i).Units) / DetailItemList.Count; CurrentRevenue = ItemList.Sum(i => ((DataItem)i).Revenue) / DetailItemList.Count; }
private void SetupData() { // Generate customer collection and wrap it into a data collection _dataCollection = new C1DataCollection <Customer>(Customer.GetCustomerList(100)); // Use the C1DataCollectionBindingList class from C1.Win.DataCollection assembly // for binding with WinForms controls. c1FlexGrid1.DataSource = new C1DataCollectionBindingList(_dataCollection); _dataCollection.SortChanged += OnSortChanged; UpdateSortButton(); }
private async Task UpdateVideos() { var data = Customer.GetCustomerList(100); _dataCollection = new C1DataCollection <Customer>(data); await _dataCollection.GroupAsync(c => c.Country); grid.ItemsSource = _dataCollection; grid.MinColumnWidth = 85; }
private async void LoadData() { var dataCollection = new C1DataCollection <Customer>(Customer.GetCustomerList(100)); await dataCollection.SortAsync(new SortDescription("FirstName", SortDirection.Ascending), new SortDescription("LastName", SortDirection.Descending)); Grid.ItemsSource = dataCollection; Grid.SortAscendingIconTemplate = new C1IconTemplate(() => new C1BitmapIcon() { Source = UIImage.FromBundle("arrow_up") }); }
private async void LoadData() { var cv = new C1DataCollection <Customer>(Customer.GetCustomerList(100)); await cv.SortAsync(new SortDescription("FirstName", SortDirection.Ascending), new SortDescription("LastName", SortDirection.Descending)); grid.ItemsSource = cv; grid.SortAscendingIconTemplate = new C1IconTemplate(() => new C1BitmapIcon(this.ApplicationContext) { Source = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.arrow_up) }); }
public FilterEditorSample() { InitializeComponent(); Tag = AppResources.FilterEditorTag; C1DataCollection <Car> data = new C1DataCollection <Car>(DataProvider.GetCars()); filterEditor.ItemsSource = data; flexGrid.ItemsSource = data; InitExpressionAndApply(); filterEditor.FilterChanged += filterEditor_FilterChanged; }
public Group() { InitializeComponent(); Title = AppResources.GroupTitle; SunburstViewModel model = new SunburstViewModel(); dataCollection = model.View; dataCollection.GroupChanged += View_GroupChanged; dataCollection.SortChanged += Cv_SortChanged; }
public FilterSummarySample() { InitializeComponent(); Tag = AppResources.FilterSummaryTag; _data = new C1DataCollection <Car>(DataProvider.GetCars()); flexGrid.ItemsSource = _data; c1DataFilter1.ItemsSource = _data; foreach (ChecklistFilter filter in c1DataFilter1.Filters.Where(f => f is ChecklistFilter)) { filter.SelectAll(); } }
public CarsListControl() { InitializeComponent(); Tag = AppResources.CarListTag; //Get Cars list _carsTable = DataProvider.GetCarTable(); var data = new C1DataCollection <Car>(DataProvider.GetCarDataCollection(_carsTable)); c1DataFilter.ItemsSource = data; flexGrid.ItemsSource = data; c1DataFilter.SaveFilterExpression(_fileName); c1DataFilter.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; }
public DataFilterSample() { InitializeComponent(); var data = new C1DataCollection <Employee>(_dataProvider.GetEmployees()); c1DataFilter1.ItemsSource = data; flexGrid.ItemsSource = data; foreach (ChecklistFilter filter in c1DataFilter1.Filters.Where(f => f is ChecklistFilter)) { filter.SelectAll(); } }
public static C1DataCollection <Item> CreateGroupCVData() { var data = new List <Item>(); var quarters = new string[] { "Q1", "Q2", "Q3", "Q4" }; var months = new[] { new { Name = "Jan", Value = 1 }, new { Name = "Feb", Value = 2 }, new { Name = "Mar", Value = 3 }, new { Name = "Apr", Value = 4 }, new { Name = "May", Value = 5 }, new { Name = "June", Value = 6 }, new { Name = "Jul", Value = 7 }, new { Name = "Aug", Value = 8 }, new { Name = "Sep", Value = 9 }, new { Name = "Oct", Value = 10 }, new { Name = "Nov", Value = 11 }, new { Name = "Dec", Value = 12 } }; var year = DateTime.Now.Year; int yearLen, i, len = 100; var years = new List <int>(); yearLen = 3; for (i = yearLen; i > 0; i--) { years.Add(year - i); } int y, q, m; for (i = 0; i < len; i++) { y = (int)Math.Floor(Instance.rnd.NextDouble() * yearLen); q = (int)Math.Floor(Instance.rnd.NextDouble() * 4); m = (int)Math.Floor(Instance.rnd.NextDouble() * 3); data.Add(new Item() { Year = years[y], Quarter = quarters[q], MonthName = months[q].Name, MonthValue = months[q].Value, Value = Math.Round(Instance.rnd.NextDouble() * 100) }); } var cv = new C1DataCollection <Item>(data); return(cv); }
public CarsListControl() { InitializeComponent(); //Get Cars list _carsTable = _dataProvider.GetCarTable(); var data = new C1DataCollection <Car>(_dataProvider.GetCarDataCollection(_carsTable)); c1DataFilter.ItemsSource = data; flexGrid.ItemsSource = data; c1DataFilter.SaveFilterExpression(_fileName); cmbTheme.ItemsSource = typeof(C1AvailableThemes).GetEnumValues <C1AvailableThemes>(); cmbTheme.SelectedItem = C1AvailableThemes.Office2016White; }
public DataFilterSample() { InitializeComponent(); var data = new C1DataCollection <Employee>(_dataProvider.GetEmployees()); c1DataFilter1.ItemsSource = data; flexGrid.ItemsSource = data; foreach (ChecklistFilter filter in c1DataFilter1.Filters.Where(f => f is ChecklistFilter)) { filter.SelectAll(); } cmbTheme.ItemsSource = typeof(C1AvailableThemes).GetEnumValues <C1AvailableThemes>(); cmbTheme.SelectedItem = C1AvailableThemes.Office2016White; }
private void RefreshDataSize() { var products = new ObservableCollection <Product>(); for (int i = 0; i < SelectedSize.Size; i++) { var countryID = _rnd.Next(0, Countries.Count - 1); products.Add(new Product(i) { Country = Countries[countryID], CountryId = countryID }); } Products = new C1DataCollection <Product>(products); OnPropertyChanged("Products"); }
private bool InstallItems() { //var stream = _assembly.GetManifestResourceStream("MyBI.Data.Data.csv"); System.IO.Stream stream; try { HttpClient httpClient = new HttpClient(); stream = httpClient.GetStreamAsync("https://docs.google.com/spreadsheets/d/e/2PACX-1vQoBs04ToMJRVzHo0FLy5wWS4fQJcBFH-4Ojt5bK3IAbDxKv55-bTQDloEH4U2MNQ6XvMZP_zThG9Mn/pub?gid=345838079&single=true&output=csv").Result; } catch { stream = _assembly.GetManifestResourceStream("MyBI.Data.Data.csv"); } if (stream == null) { return(false); } List <DataItem> itemsList = new List <DataItem>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { DataItem item = new DataItem(); item.iD = id; item.Month = DateTime.Parse(row[1]); int regionID = int.Parse(row[2]); item.Region = (Region)RegionList[regionID]; int productID = int.Parse(row[4]); item.Product = (Product)ProductList[productID]; item.Units = double.Parse(row[6]); item.Revenue = double.Parse(row[7]); itemsList.Add(item); } } } ItemList = new C1DataCollection <DataItem>(itemsList); UpdateData(); return(true); }
private bool InstallItems() { //var stream = _assembly.GetManifestResourceStream("MyBI.Data.Data.csv"); System.IO.Stream stream; try { stream = _assembly.GetManifestResourceStream("MyBI.Data.Data.csv"); } catch { stream = null; } if (stream == null) { return(false); } List <DataItem> itemsList = new List <DataItem>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { DataItem item = new DataItem(); item.iD = id; item.Month = DateTime.Parse(row[1]); int regionID = int.Parse(row[2]); item.Region = (Region)RegionList[regionID]; int productID = int.Parse(row[4]); item.Product = (Product)ProductList[productID]; item.Units = double.Parse(row[6]); item.Revenue = double.Parse(row[7]); itemsList.Add(item); } } } ItemList = new C1DataCollection <DataItem>(itemsList); UpdateData(); return(true); }
// prepare data at first load private void DataManagement_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } var item = e.AddedItems[0] as C1TabItem; #region Filter Editor if (item.Header.Equals("Filter Editor") && filterEditor.ItemsSource == null) { // initialize filter editor cars = new C1DataCollection <Car>(_dataProvider.GetCars()); filterEditor.ItemsSource = cars; filterEditorFlexGrid.ItemsSource = cars; InitExpressionAndApply(); filterEditor.FilterChanged += filterEditor_FilterChanged; } #endregion #region Olap if (item.Header.Equals("OLAP") && olapPage.DataSource == null) { var persons = Person.Generate(80); olapPage.DataSource = persons; olapPage.Loaded += olapPage_Loaded; } #endregion #region DataFilter if (item.Header.Equals("Data Filter") && c1DataFilter1.ItemsSource == null) { var data = new C1DataCollection <Employee>(_dataProvider.GetEmployees()); c1DataFilter1.ItemsSource = data; dataFilterFlexGrid.ItemsSource = data; foreach (ChecklistFilter filter in c1DataFilter1.Filters.Where(f => f is ChecklistFilter)) { filter.SelectAll(); filter.DisplayedItems = 2; } } #endregion }
private async Task UpdateVideos() { try { emptyListLabel.Visibility = System.Windows.Visibility.Collapsed; activityIndicator.Visibility = System.Windows.Visibility.Visible; var _videos = new ObservableCollection <YouTubeVideo>((await YouTubeCollectionView.LoadVideosAsync("WPF", "relevance", null, 50)).Item2); _dataCollection = new C1DataCollection <YouTubeVideo>(_videos); grid.ItemsSource = _dataCollection; } catch { emptyListLabel.Text = AppResources.InternetConnectionError; emptyListLabel.Visibility = System.Windows.Visibility.Visible; } finally { activityIndicator.Visibility = System.Windows.Visibility.Collapsed; } }
private async Task UpdateVideos() { try { progressBar1.Visible = true; youTubeListView1.Visible = false; var _videos = new ObservableCollection <YouTubeVideo>((await YouTubeDataCollection.LoadVideosAsync("WinForms", "relevance", null, 50)).Item2); _dataCollection = new C1DataCollection <YouTubeVideo>(_videos); youTubeListView1.SetItemsSource(_dataCollection, "Title"); youTubeListView1.Visible = true; } catch { MessageBox.Show(AppResources.InternetConnectionError, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { progressBar1.Visible = false; } }
private bool InstallProducts() { System.IO.Stream stream; try { HttpClient httpClient = new HttpClient(); stream = httpClient.GetStreamAsync("https://docs.google.com/spreadsheets/d/e/2PACX-1vS8keuE8lw59mGtiyYEL4cUg_Ol4562EFK3OIVS6N6sEP488ryBkKbJfvhcxyZoMqXKJWkKnInUSg7r/pub?gid=1026568403&single=true&output=csv").Result; } catch { stream = _assembly.GetManifestResourceStream("MyBI.Data.Product.csv"); } if (stream == null) { return(false); } List <Product> productList = new List <Product>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { Product product = new Product(); product.iD = id; product.Name = row[1]; productList.Add(product); } } } productList.Insert(0, new Product() { iD = 0, Name = MyBI.Resources.AppResources.AllProductsItem }); ProductList = new C1DataCollection <Product>(productList); return(true); }
private async Task UpdateVideos() { try { // Load video collection _videos = new ObservableCollection <YouTubeVideo>((await YouTubeCollectionView.LoadVideosAsync("WinForms", "relevance", null, 50)).Item2); // wrap the loaded collection to DataCollection _collectionView = new C1DataCollection <YouTubeVideo>(_videos); // grouping by ChannelTitle // Note: grouping is async await _collectionView.GroupAsync(v => v.ChannelTitle); // fill FlexGrid with loaded data c1FlexGrid1.Rows.RemoveRange(1, c1FlexGrid1.Rows.Count - 1); PopulateItemsAndGroups(_collectionView as IDataCollection <object>); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e.Message); } }
private async Task UpdateData() { try { message.Visibility = System.Windows.Visibility.Collapsed; activityIndicator.Visibility = System.Windows.Visibility.Visible; _dataCollection = new C1DataCollection <Customer>(Customer.GetCustomerList(100)); grid.ItemsSource = _dataCollection; _dataCollection.SortChanged += OnSortChanged; UpdateSortButton(); } catch { message.Text = AppResources.InternetConnectionError; message.Visibility = System.Windows.Visibility.Visible; } finally { activityIndicator.Visibility = System.Windows.Visibility.Collapsed; } }
private bool InstallProducts() { System.IO.Stream stream; try { stream = _assembly.GetManifestResourceStream("MyBI.Data.Product.csv"); } catch { stream = null; } if (stream == null) { return(false); } List <Product> productList = new List <Product>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { Product product = new Product(); product.iD = id; product.Name = row[1]; productList.Add(product); } } } productList.Insert(0, new Product() { iD = 0, Name = MyBI.Resources.AppResources.AllProductsItem }); ProductList = new C1DataCollection <Product>(productList); return(true); }
private bool InstallRegions() { System.IO.Stream stream; try { HttpClient httpClient = new HttpClient(); stream = httpClient.GetStreamAsync("https://docs.google.com/spreadsheets/d/e/2PACX-1vTTU_DjLrC_AMfTaGMEmi5HfastFteMfqK3w2ZB3FKQzYOe6hPYSeoLYsdz0RyyOcoGvdBal4rT8kMG/pub?gid=791843885&single=true&output=csv").Result; } catch { stream = _assembly.GetManifestResourceStream("MyBI.Data.Region.csv"); } if (stream == null) { return(false); } List <Region> regionList = new List <Region>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { Region region = new Region(); region.iD = id; region.Name = row[1]; regionList.Add(region); } } } regionList.Insert(0, new Region() { iD = 0, Name = MyBI.Resources.AppResources.AllRegionsItem }); RegionList = new C1DataCollection <Region>(regionList); return(true); }
private async Task UpdateVideos() { try { message.IsVisible = false; list.IsVisible = false; activityIndicator.IsRunning = true; var _videos = new ObservableCollection <YouTubeVideo>((await YouTubeDataCollection.LoadVideosAsync("Xamarin Forms", "relevance", null, 50)).Item2); _dataCollection = new C1DataCollection <YouTubeVideo>(_videos); list.ItemsSource = _dataCollection; list.IsVisible = true; } catch { message.Text = AppResources.InternetConnectionError; message.IsVisible = true; } finally { activityIndicator.IsRunning = false; } }
public MainWindow() { InitializeComponent(); var data = new C1DataCollection <Employee>(_dataProvider.GetEmployees()); c1DataFilter1.ItemsSource = data; flexGrid.ItemsSource = data; //// Color filter //var cf = new ColorFilter //{ // HeaderText = "Color", // PropertyName = "Color" //}; //cf.SetColors(_dataProvider.Colors.Select(c => c.ToString())); //c1DataFilter1.Filters.Add(cf); foreach (ChecklistFilter filter in c1DataFilter1.Filters.Where(f => f is ChecklistFilter)) { filter.SelectAll(); } }
private bool InstallRegions() { System.IO.Stream stream; try { stream = _assembly.GetManifestResourceStream("MyBI.Data.Region.csv"); } catch { stream = null; } if (stream == null) { return(false); } List <Region> regionList = new List <Region>(); using (CsvFileReader reader = new CsvFileReader(stream)) { CsvRow row = new CsvRow(); while (reader.ReadRow(row)) { int id = 0; if (int.TryParse(row[0], out id)) { Region region = new Region(); region.iD = id; region.Name = row[1]; regionList.Add(region); } } } regionList.Insert(0, new Region() { iD = 0, Name = MyBI.Resources.AppResources.AllRegionsItem }); RegionList = new C1DataCollection <Region>(regionList); return(true); }