public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. picker.Model = new ChartTypesModel(this); chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); //chart.ChartType = ChartType.Area; //chart.Stacking = Stacking.Stacked; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. picker.Model = new ChartTypesModel(this); chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.SelectionMode = ChartSelectionModeType.Series; chart.SelectionStyle = new ChartStyle { Stroke = UIColor.Red, StrokeThickness = 3 }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. picker.Model = new ThemeModel(this); picker.ShowSelectionIndicator = true; chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.AxisX.LabelLoading += (object sender, AxisLabelLoadingEventArgs e) => { string path = "Images/" + e.LabelString; UIImage image = null; try { image = new UIImage(path); } catch (Exception) { image = null; } UIImageView imageView = new UIImageView(); imageView.Frame = new CGRect(0, 0, 25, 20); imageView.Image = image; e.Label = imageView; }; chart.AxisY.LabelLoading += (object sender, AxisLabelLoadingEventArgs e) => { UILabel label = new UILabel(); label.Text = "$" + (e.Value / 1000).ToString() + "K"; label.AdjustsFontSizeToFitWidth = true; if (e.Value <= 8000) { label.TextColor = UIColor.Red; } else if (e.Value <= 12000 && e.Value > 8000) { label.TextColor = UIColor.Green; } else { label.TextColor = UIColor.Black; } e.Label = label; }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.AxisX.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { string path = "Images/" + e.LabelString; UIImage image = null; try { image = new UIImage(path); } catch (Exception) { image = null; } if (image != null) { image.Draw(new CGRect(e.Rect.Left, e.Rect.Top, e.Rect.Width, e.Rect.Height)); } e.LabelString = null; }; chart.AxisY.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { if (e.Value <= 8000) { e.Engine.SetFill(UIColor.Red); } else if (e.Value <= 12000 && e.Value > 8000) { e.Engine.SetFill(UIColor.Green); } else { e.Engine.SetFill(UIColor.Black); } e.LabelString = "$" + (e.Value / 1000).ToString() + "K"; }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.Palette = Palette.Cocoa; chart.Stacking = ChartStackingType.Stacked; chart.LegendPosition = ChartPositionType.Bottom; MyTooltip t = new MyTooltip(); t.Frame = new CGRect(0, 0, 100, 50); t.BackgroundColor = new UIColor(1.0f, 1.0f, 0.792f, 1.0f); chart.ToolTip = t; chart.ToolTipLoading += (object sender, ChartTooltipLoadingEventArgs args) => { ChartHitTestInfo e = args.HitTestInfo; if (e.Distance < 2 && e.PointIndex >= 0) { double left = e.Point.X, top = e.Point.Y - t.Frame.Height, width = t.Frame.Width, height = t.Frame.Height; double screenWidth = UIScreen.MainScreen.Bounds.Size.Width; double margin = 5; if (left + width > screenWidth) { left = screenWidth - width - margin; } t.Frame = new CGRect(left, top, width, height); t.UpdateContent(e); t.IsOpen = true; } else { t.IsOpen = false; } }; }
public override void ViewDidLoad() { base.ViewDidLoad(); Chart.BindingX = "Name"; Chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); Chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); Chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); Chart.ItemsSource = SalesData.GetSalesDataList(); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.ChartType = C1.iOS.Chart.ChartType.Bubble; chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Downloads" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. treeMap = new C1TreeMap(); treeMap.ChartType = C1.iOS.Chart.TreeMapType.Squarified; treeMap.Binding = "sales"; treeMap.BindingName = "type"; treeMap.MaxDepth = 2; treeMap.ChildItemsPath = "items"; treeMap.ItemsSource = SalesData.CreateHierarchicalData(); this.Add(treeMap); treeMap.DataLabel = new ChartDataLabel() { Content = "{}{type}", Position = ChartLabelPosition.Center }; treeMap.DataLabel.Style.FontSize = 10; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.ChartType = C1.iOS.Chart.ChartType.Scatter; chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.Header = "Sample Chart"; chart.HeaderAlignment = UITextAlignment.Center; chart.HeaderStyle = new ChartStyle { Stroke = new UIColor(0.502f, 0.016f, 0.302f, 1), FontFamily = UIFont.SystemFontOfSize(24, UIFontWeight.Bold) }; chart.Footer = "2017 GrapeCity, Inc."; chart.FooterAlignment = UITextAlignment.Center; chart.FooterStyle = new ChartStyle { Stroke = new UIColor(0.502f, 0.016f, 0.302f, 1), FontFamily = UIFont.SystemFontOfSize(16, UIFontWeight.Bold) }; chart.AxisX.Title = "Country"; chart.AxisX.MajorGrid = true; chart.AxisX.TitleStyle = new ChartStyle { FontFamily = UIFont.ItalicSystemFontOfSize(16) }; chart.AxisY.AxisLine = true; chart.AxisY.Labels = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales" }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses" }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads" }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); chart.Palette = Palette.Cocoa; chart.Stacking = ChartStackingType.Stacked; chart.LegendPosition = ChartPositionType.Bottom; MyTooltip t = new MyTooltip(); t.Frame = new CGRect(0, 0, 100, 50); t.BackgroundColor = new UIColor(1.0f, 1.0f, 0.792f, 1.0f); chart.ToolTipLoading += (object sender, ChartTooltipLoadingEventArgs args) => { ChartHitTestInfo e = args.HitTestInfo; if (e.Distance < 2 && e.PointIndex >= 0) { t.UpdateContent(e); } args.view = t; }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Sales", Binding = "Sales,Sales", Style = new ChartStyle { Fill = new UIColor(0, 0.8f, 0, 1), Stroke = UIColor.Green, StrokeThickness = 2 } }); chart.Series.Add(new ChartSeries() { SeriesName = "Expenses", Binding = "Expenses,Expenses", Style = new ChartStyle { Fill = UIColor.Red, Stroke = new UIColor(0.702f, 0, 0, 1), StrokeThickness = 2 } }); chart.Series.Add(new ChartSeries() { SeriesName = "Downloads", Binding = "Downloads,Downloads", ChartType = ChartType.LineSymbols, Style = new ChartStyle { Fill = new UIColor(1, 0.416f, 1, 1), Stroke = UIColor.Blue, StrokeThickness = 10 }, SymbolStyle = new ChartStyle { Fill = UIColor.Yellow, Stroke = UIColor.Yellow, StrokeThickness = 5 } }); chart.ItemsSource = SalesData.GetSalesDataList(); this.Add(chart); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.ChartType = ChartType.Bar; chart.BindingX = "Name"; chart.Series.Add(new ChartSeries() { SeriesName = "Total Expenses", Binding = "Expenses" }); chart.ItemsSource = SalesData.GetSalesDataList2(); chart.Palette = Palette.Organic; chart.AxisY.AxisLine = true; chart.AxisY.Labels = false; this.Add(chart); chart.DataLabel.Position = ChartLabelPosition.Left; chart.DataLabel.Content = "{x} {y}"; chart.DataLabel.Border = true; chart.DataLabel.BorderStyle = new ChartStyle { Stroke = UIColor.Red, StrokeThickness = 1 }; chart.DataLabel.Style = new ChartStyle { FontFamily = UIFont.SystemFontOfSize(20, UIFontWeight.Black) }; modeSelector.SelectedSegment = 1; }
public void UpdateContent(ChartHitTestInfo hitTestInfo) { if (label == null && imageView == null) { label = new UILabel(new CGRect(this.Bounds.Size.Width / 4, 0, this.Bounds.Size.Width * 3 / 4, this.Bounds.Size.Height)); label.TextColor = UIColor.Black; label.Lines = 3; label.Text = string.Format("{0} \n\n {1:C2}", hitTestInfo.Series.Name, hitTestInfo.Y); label.Font = label.Font.WithSize(11); image = new UIImage("Images/" + SalesData.GetCountries()[hitTestInfo.PointIndex]); imageView = new UIImageView(image); this.AddSubview(imageView); this.AddSubview(label); } else { image = new UIImage("Images/" + SalesData.GetCountries()[hitTestInfo.PointIndex]); imageView.Image = image; label.Text = string.Format("{0} \n\n {1:C2}", hitTestInfo.Series.Name, hitTestInfo.Y); imageView.SetNeedsLayout(); label.SetNeedsLayout(); } }