/// <summary> /// The csv export code /// </summary> /// <returns>The csv code of the data fromt the database</returns> private string csvCode() { string file = "UserID, DataOne, DataTwo, DataThree\n"; for (int i = 0; i < db.Count(); i += 1) { file += db.readPrimary("UserID", i) + ", "; file += db.readData("DataOne", i) + ", "; file += db.readData("DataTwo", i) + ", "; file += db.readData("DataThree", i) + ",\n"; } return(file); }
public XYSeries SeriesCreate(string name) { XYSeries series = new XYSeries(name); for (int i = 0; i < db.Count(); i++) { series.Add(i, db.readData(name, i)); } return(series); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Chart); db = new DataDB(this); mDataSet.AddSeries(SeriesCreate("DataOne")); mDataSet.AddSeries(SeriesCreate("DataTwo")); mDataSet.AddSeries(SeriesCreate("DataThree")); XYSeriesRenderer renderOne = singleRenderer(255, 000, 000); XYSeriesRenderer renderTwo = singleRenderer(000, 255, 000); XYSeriesRenderer renderThree = singleRenderer(000, 000, 255); mRenderer.SetMargins(new int[] { 10, 60, 100, 30 }); mRenderer.XLabels = 0; mRenderer.ChartTitle = "Data Chart"; mRenderer.XTitle = "UserID"; mRenderer.YTitle = "Data Inputs"; mRenderer.AxisTitleTextSize = 32; mRenderer.ChartTitleTextSize = 40; mRenderer.LabelsTextSize = 32; mRenderer.PointSize = 3; mRenderer.ShowLegend = false; mRenderer.ShowGridX = true; mRenderer.ShowGridY = true; mRenderer.ZoomButtonsVisible = true; mRenderer.ApplyBackgroundColor = true; mRenderer.AxesColor = Color.Black; mRenderer.LabelsColor = Color.Black; mRenderer.MarginsColor = Color.White; mRenderer.GridColor = Color.Black; mRenderer.SetYLabelsColor(0, Color.Black); mRenderer.XLabelsColor = Color.Black; mRenderer.BackgroundColor = Color.White; for (int i = 0; i < db.Count(); i++) { mRenderer.AddXTextLabel(i, db.readPrimary("UserID", i)); } mRenderer.AddSeriesRenderer(renderOne); mRenderer.AddSeriesRenderer(renderTwo); mRenderer.AddSeriesRenderer(renderThree); if (mChartView == null) { chartLayout = FindViewById <LinearLayout>(Resource.Id.chart); mChartView = ChartFactory.GetLineChartView(this, mDataSet, mRenderer); chartLayout.AddView(mChartView, new LinearLayout.LayoutParams( Android.Views.ViewGroup.LayoutParams.FillParent, Android.Views.ViewGroup.LayoutParams.FillParent)); } listView = FindViewById <ListView>(Resource.Id.DataList); tableItems.Add(new TableItem() { DataName = "DataOne", ID = 9001, Red = 255, Green = 000, Blue = 000 }); tableItems.Add(new TableItem() { DataName = "DataTwo", ID = 9002, Red = 000, Green = 255, Blue = 000 }); tableItems.Add(new TableItem() { DataName = "DataThree", ID = 9003, Red = 000, Green = 000, Blue = 255 }); listView.Adapter = new ChartActivityAdapter(this, tableItems); btnSave = FindViewById <Button>(Resource.Id.btnSave); btnSave.Click += BtnSave_Click; }