protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_toggle_series); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.toggleSeries); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mSalesSwitch = (Switch)FindViewById(Resource.Id.salesSwitch); mExpensesSwitch = (Switch)FindViewById(Resource.Id.expensesSwitch); mDownloadsSwitch = (Switch)FindViewById(Resource.Id.downloadsSwitch); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); mChart.ChartType = ChartType.Line; mChart.LegendToggle = true; mSalesSwitch.Checked = true; mExpensesSwitch.Checked = true; mDownloadsSwitch.Checked = true; mSeriesSales = mChart.Series[0] as ChartSeries; mSeriesExpenses = mChart.Series[1] as ChartSeries; mSeriesDownloads = mChart.Series[2] as ChartSeries; mSalesSwitch.CheckedChange += MSalesSwitch_CheckedChange; mExpensesSwitch.CheckedChange += MExpensesSwitch_CheckedChange; mDownloadsSwitch.CheckedChange += MDownloadsSwitch_CheckedChange; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_theming); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.theming); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mPalette_spinner = (Spinner)FindViewById(Resource.Id.paletteSpinner); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); ArrayAdapter adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.paletteSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mPalette_spinner.Adapter = adapter; mPalette_spinner.ItemSelected += MPalette_spinner_ItemSelected; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_data_labels); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.dataLabels); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mDataLabelSpinner = (Spinner)FindViewById(Resource.Id.dataLabelSpinner); // set the binding for X-axis of FlexChart mChart.BindingX = "Name"; // initialize series elements and set the binding to variables of // ChartPoint ChartSeries seriesSales = new ChartSeries(); seriesSales.Chart = mChart; seriesSales.SeriesName = "Sales"; seriesSales.Binding = "Sales"; // add series to list mChart.Series.Add(seriesSales); // setting the source of data/items in FlexChart mChart.ItemsSource = ChartPoint.GetList(); mChart.ChartType = ChartType.Bar; mChart.DataLabel.Content = "{x},{y}"; mChart.DataLabel.Border = true; mChart.DataLabel.BorderStyle = new ChartStyle() { Stroke = Color.Green, StrokeThickness = 2, Fill = Color.Transparent }; // create custom adapter for spinner and initialize with string array ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartDataLabelPositionSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mDataLabelSpinner.Adapter = adapter1; int defaultPosition = adapter1.GetPosition("Left"); mDataLabelSpinner.SetSelection(defaultPosition); mDataLabelSpinner.ItemSelected += MDataLabelSpinner_ItemSelected; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_basic_chart_types); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.basicChartTypes); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widgets mChart = (FlexChart)FindViewById(Resource.Id.flexchart); mChartTypeSpinner = (Spinner)FindViewById(Resource.Id.chartTypeSpinner); mStackingSpinner = (Spinner)FindViewById(Resource.Id.stackingSpinner); mRotatedSwitch = (Switch)FindViewById(Resource.Id.rotatedSwitch); // set the binding for X-axis of FlexChart // setting the source of data/items in FlexChart dataSource = ChartPoint.GetList(); Chartinitialization.InitialDefaultChart(mChart, dataSource); ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartTypeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mChartTypeSpinner.Adapter = adapter1; mChartTypeSpinner.ItemSelected += MChartTypeSpinner_ItemSelected; // create custom adapter for second spinner and initialize with string // array ArrayAdapter adapter2 = ArrayAdapter.CreateFromResource(this, Resource.Array.stackingSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mStackingSpinner.Adapter = adapter2; mStackingSpinner.ItemSelected += MStackingSpinner_ItemSelected; mRotatedSwitch.CheckedChange += MRotatedSwitch_CheckedChange; mChart.SelectionMode = ChartSelectionModeType.Point; mChart.SelectionStyle = new ChartStyle(); mChart.SelectionStyle.StrokeDashArray = new double[] { 10, 10 }; mChart.SelectionStyle.Stroke = Color.Red; mChart.SelectionStyle.StrokeThickness = 3; // mChart.SetBackgroundColor(Color.Gray); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_snapshot); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.snapshot); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_bubble_chart); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.bubbleChart); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widgets mChart = (FlexChart)FindViewById(Resource.Id.flexchart); mChart.ChartType = ChartType.Bubble; // set the binding for X-axis of FlexChart mChart.BindingX = "Name"; // initialize series elements and set the binding to variables of // ChartPoint ChartSeries seriesSales = new ChartSeries(); seriesSales.Chart = mChart; seriesSales.SeriesName = "Sales"; seriesSales.Binding = "Sales,Downloads"; ChartSeries seriesExpenses = new ChartSeries(); seriesExpenses.Chart = mChart; seriesExpenses.SeriesName = "Expenses"; seriesExpenses.Binding = "Expenses,Downloads"; // add series to list mChart.Series.Add(seriesSales); mChart.Series.Add(seriesExpenses); // setting the source of data/items and default values in FlexChart mChart.ItemsSource = ChartPoint.GetList(); // property set in XML layout // mChart.setChartType(ChartType.BUBBLE); mChart.SelectionMode = ChartSelectionModeType.Point; mChart.SelectionStyle = new ChartStyle(); mChart.SelectionStyle.StrokeDashArray = new double[] { 10, 10 }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_mixed_chart_types); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.mixedChartTypes); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widgets mChart = (FlexChart)FindViewById(Resource.Id.flexchart); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); (mChart.Series[2] as ChartSeries).ChartType = ChartType.Line; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_selection_modes); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.selectionModes); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mChart = (FlexChart)FindViewById(Resource.Id.flexchart); mChartTypeSpinner = (Spinner)FindViewById(Resource.Id.chartTypeSpinner); mSelectionModeSpinner = (Spinner)FindViewById(Resource.Id.selectionModeSpinner); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); mChart.SelectionStyle = new ChartStyle(); mChart.SelectionStyle.Stroke = Android.Graphics.Color.Red; // create custom adapter for first spinner and initialize with string // array ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartTypeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mChartTypeSpinner.Adapter = adapter1; mChartTypeSpinner.ItemSelected += MChartTypeSpinner_ItemSelected; // create custom adapter for second spinner and initialize with string // array ArrayAdapter adapter2 = ArrayAdapter.CreateFromResource(this, Resource.Array.selectionModeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem); // Specify the layout to use when the list of choices appears adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // Apply the adapter to the spinner mSelectionModeSpinner.Adapter = adapter2; mSelectionModeSpinner.ItemSelected += MSelectionModeSpinner_ItemSelected; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.activity_custom_tooltips); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.customTooltips); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); mChart.Stacking = ChartStackingType.Stacked; mChart.Palette = Palette.Cocoa; mChart.LegendPosition = ChartPositionType.Bottom; MyToolTip t = new MyToolTip(mChart, ApplicationContext); FrameLayout.LayoutParams l = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); mChart.ToolTip = t; mChart.ToolTipLoading += (object sender, ChartTooltipLoadingEventArgs args) => { ChartHitTestInfo e = args.HitTestInfo; if (e.Distance < 2 && e.PointIndex >= 0) { t.Point = new C1Point(e.Point.X, e.Point.Y); t.UpdateContent(e); t.IsOpen = true; } else { t.IsOpen = false; } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_getting_started); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.gettingStarted); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); // set the binding for X-axis of FlexChart Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); // set title/footer mChart.Header = "FlexChart Sales"; mChart.Footer = "GrapeCity"; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_legend_and_titles); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.legendAndTitles); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); Chartinitialization.InitialDefaultChart(mChart, ChartPoint.GetList()); mChart.ChartType = ChartType.Scatter; mChart.AxisX.Title = "Country"; mChart.AxisX.MajorGrid = true; mChart.AxisY.Title = "Amount"; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_customizing_axes); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.customizingAxes); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // Create your application here mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); // set the binding for X-axis of FlexChart mChart.BindingX = "Name"; // initialize series elements and set the binding to variables of // ChartPoint ChartSeries seriesSales = new ChartSeries(); seriesSales.Chart = mChart; seriesSales.SeriesName = "Sales"; seriesSales.Binding = "Sales"; ChartSeries seriesExpenses = new ChartSeries(); seriesExpenses.Chart = mChart; seriesExpenses.SeriesName = "Expenses"; seriesExpenses.Binding = "Expenses"; // add series to list mChart.Series.Add(seriesSales); mChart.Series.Add(seriesExpenses); // setting the source of data/items in FlexChart mChart.ItemsSource = ChartPoint.GetList(); // customize the axis title and format // properties set in XML layout mChart.AxisX.Title = "Country"; mChart.AxisY.MinorTickMarks = ChartTickMarkType.Cross; mChart.AxisY.MajorGridStyle = new ChartStyle() { StrokeThickness = 1, Stroke = Color.ParseColor("#C4C4C4") }; mChart.AxisY.MinorGrid = true; mChart.AxisY.MinorGridStyle = new ChartStyle() { StrokeThickness = 0.5f, StrokeDashArray = new double[] { 4, 4 } }; mChart.AxisY.MajorUnit = 2000; mChart.AxisX.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { int[] imageResources = { Resource.Drawable.US, Resource.Drawable.Germany, Resource.Drawable.UK, Resource.Drawable.Japan, Resource.Drawable.Italy, Resource.Drawable.Greece }; int imgId = imageResources[e.Index]; Bitmap bmp = BitmapFactory.DecodeResource(this.Resources, imgId); e.Engine.DrawImage(bmp, e.Rect.X, e.Rect.Y, e.Rect.Width, e.Rect.Height); e.LabelString = null; }; mChart.AxisY.LabelLoading += (object sender, RenderLabelLoadingEventArgs e) => { if (e.Value <= 8000) { e.Engine.SetFill(Color.Red); } else if (e.Value <= 12000 && e.Value > 8000) { e.Engine.SetFill(Color.Green); } else { e.Engine.SetFill(Color.Black); } e.LabelString = "$" + (e.Value / 1000).ToString() + "K"; }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_styling_series); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = GetString(Resource.String.stylingSeries); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); // initializing widget mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart); mChart.BindingX = "Name"; // initialize series elements and set the binding to variables of // ChartPoint ChartSeries seriesSales = new ChartSeries(); seriesSales.Chart = mChart; seriesSales.SeriesName = "Sales"; seriesSales.Binding = "Sales"; ChartSeries seriesExpenses = new ChartSeries(); seriesExpenses.Chart = mChart; seriesExpenses.SeriesName = "Expenses"; seriesExpenses.Binding = "Expenses"; ChartSeries seriesDownloads = new ChartSeries(); seriesDownloads.Chart = mChart; seriesDownloads.SeriesName = "Downloads"; seriesDownloads.Binding = "Downloads"; // style series sales seriesSales.Style = new ChartStyle() { Fill = Android.Graphics.Color.ParseColor("#009400"), Stroke = Android.Graphics.Color.Green, StrokeThickness = 3 }; // style series expenses seriesExpenses.Style = new ChartStyle() { Fill = Android.Graphics.Color.ParseColor("#C40000"), Stroke = Android.Graphics.Color.Red, StrokeThickness = 3 }; // style series downloads seriesDownloads.ChartType = ChartType.LineSymbols; seriesDownloads.Style = new ChartStyle() { Stroke = Android.Graphics.Color.Blue, StrokeThickness = 10 }; seriesDownloads.SymbolStyle = new ChartStyle() { Fill = Android.Graphics.Color.Yellow, Stroke = Android.Graphics.Color.Cyan, StrokeThickness = 3 }; // add series to list mChart.Series.Add(seriesSales); mChart.Series.Add(seriesExpenses); mChart.Series.Add(seriesDownloads); // setting the source of data/items in FlexChart mChart.ItemsSource = (ChartPoint.GetList()); }