public static List <FinancialData> FinancialData() { Random rnd = new Random(); List <FinancialData> listdata = new List <FinancialData>(); for (int i = 0; i < 20; i++) { FinancialData data = new FinancialData(); data.Date = DateTime.Today.AddDays(i); if (i > 0 && !double.IsNaN(listdata[i - 1].Close)) { data.Open = listdata[i - 1].Close; } else { data.Open = 1000; } data.High = data.Open + rnd.Next(20); data.Low = data.Open - rnd.Next(20); data.Close = rnd.Next((int)data.Low, (int)data.High); data.Volume = rnd.Next(40, 100); listdata.Add(data); } return(listdata); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. chart = new FlexChart(); chart.BindingX = "Date"; chart.Series.Add(new ChartSeries() { SeriesName = "AAPL", Binding = "High,Low,Open,Close" }); chart.ItemsSource = FinancialData.GetFinancialDataList(); chart.ChartType = ChartType.Candlestick; chart.SelectionMode = ChartSelectionModeType.Point; chart.LegendPosition = ChartPositionType.None; this.Add(chart); chart.AxisX.Format = "MM/dd/yyyy"; }