private void chart_SelectionChanged(object sender, ChartSelectionEventArgs e)
        {
            var selectedindex = e.SelectedDataPointIndex;

            if (selectedindex < 0)
            {
                label.Text     = "Tap on a bar segment to select a data point";
                label.FontSize = 15;
                return;
            }
            label.FontSize = 20;
            var series = e.SelectedSeries;

            if (series == null)
            {
                return;
            }
            var datapoints = (series.ItemsSource as IList <Model>);

            if (datapoints == null)
            {
                return;
            }
            var x = datapoints[selectedindex].Name.ToString();
            var y = datapoints[selectedindex].Value.ToString();

            label.Text = "Month : " + x + ",  Sales : $" + y;
        }
Esempio n. 2
0
        private void Chart_SelectionChanged(object sender, ChartSelectionEventArgs e)
        {
            IList items             = e.SelectedSeries.ItemsSource as IList;
            Model selectedDatapoint = items[e.SelectedDataPointIndex] as Model;

            Navigation.PushAsync(new SecondayPage(selectedDatapoint));
            series.SelectedDataPointIndex = -1;
        }
 protected override void OnSelectionChanged(ChartSelectionEventArgs arg)
 {
     if (arg.SelectedDataPointIndex != -1)
     {
         ((ExpenseViewModel)BindingContext).UpdateTrends(arg.SelectedDataPointIndex);
     }
     base.OnSelectionChanged(arg);
 }
        /// <summary>
        /// daily and monthly  bar chart click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DailyBarChart_SelectionChanged(object sender, ChartSelectionEventArgs e)
        {
            var index = e.SelectedDataPointIndex;

            if (index < 0)
            {
            }
            else
            {
            }
        }
Esempio n. 5
0
 private void Chart_SelectionChanged(object sender, ChartSelectionEventArgs e)
 {
     Navigation.PushAsync(new ContentPage()
     {
         Content = new Label()
         {
             FontSize          = 20,
             TextColor         = Color.Purple,
             VerticalOptions   = LayoutOptions.Center,
             HorizontalOptions = LayoutOptions.CenterAndExpand,
             Text = "You have Selected an index No: " + e.SelectedDataPointIndex,
         }
     }, false);
 }
        private void Bindable_SelectionChanged(object sender, ChartSelectionEventArgs e)
        {
            if (Command == null)
            {
                return;
            }

            object parameter = Converter.Convert(e, typeof(object), null, null);

            if (Command.CanExecute(parameter))
            {
                Command.Execute(parameter);
            }
        }
        public async void on_SelectedIndexChangedBs(object sender, ChartSelectionEventArgs e)
        {
            if (e.SelectedSeries != null && e.SelectedDataPointIndex != -1)
            {
                if (e.SelectedSeries.Label == "Bloodsugar")
                {
                    BloodSugarDataPoint bloodPoint = model.SettingsModel.BloodSugarDataPoints[e.SelectedDataPointIndex];
                    bool action = await DisplayAlert("BloodSugar:", bloodPoint.BloodSugarLevel.ToString(), "Edit", "Back");

                    if (action == true)
                    {
                        openDataPoint(e.SelectedDataPointIndex, DataPoints.BloodSugar.ToString());
                    }
                }
                if (e.SelectedSeries.Label == "Meal")
                {
                    MealDataPoint mealPoint = model.SettingsModel.MealDataPoints[e.SelectedDataPointIndex];

                    string content = "";
                    content = "Total BreadUnits: " + mealPoint.BreadUnits + "\t\t\t\t" + "Total Energy: " + mealPoint.EnergyAmount + " kcal" + "\n\n";

                    foreach (Ingredient ing in mealPoint.Ingredients)
                    {
                        content += ing.Name + "\n"
                                   + "Breadunits: " + ing.BreadUnits + "\t\t" + "Energy: " + ing.EnergyAmount + "\t\t" + "Amount: " + ing.amount + "\n\n";
                    }
                    var action = await DisplayAlert("Meal:", content, "Edit", "Back");

                    if (action == true)
                    {
                        openDataPoint(e.SelectedDataPointIndex, DataPoints.Meal.ToString());
                    }
                }

                if (e.SelectedSeries.Label == "Med")
                {
                    MedicineDataPoint medPoint = model.SettingsModel.MedicineDataPoints[e.SelectedDataPointIndex];
                    var action = await DisplayAlert("Medicine:", medPoint.Name + ": " + medPoint.Amount + " " + medPoint.Unit, "Edit", "Back");

                    if (action == true)
                    {
                        openDataPoint(e.SelectedDataPointIndex, DataPoints.Medicine.ToString());
                    }
                }
            }
        }
 private void chart_SelectionChanged(object sender, ChartSelectionEventArgs e)
 {
     var selectedindex = e.SelectedDataPointIndex;
     if (selectedindex < 0)
     {
         label.Text = "Tap on a bar segment to select a data point";
         label.FontSize = 15;
         return;
     }
     label.FontSize = 20;
     var series = e.SelectedSeries;
     if (series == null) return;
     var datapoints = (series.ItemsSource as IList<Model>);
     
     if (datapoints == null) return;
     var x = datapoints[selectedindex].Name.ToString();
     var y = datapoints[selectedindex].Value.ToString();
     label.Text = "Month : " + x + ",  Sales : $" + y;
 }
        private void chart_SelectionChanged(object sender, ChartSelectionEventArgs e)
        {
            var series = e.SelectedSeries;

            if (series == null)
            {
                return;
            }

            if (Chart.EnableSeriesSelection)
            {
                productA.IsVisible        = false;
                productB.IsVisible        = false;
                seriesSelection.IsVisible = true;

                if (column.IsSelected)
                {
                    seriesSelection.Text = series.Label + " | Total Sales : $" + sumOfTotalSeries1;
                    return;
                }
                else if (column1.IsSelected)
                {
                    seriesSelection.Text = series.Label + " | Total Sales : $" + sumOfTotalSeries2;
                    return;
                }

                seriesSelection.Text = "Tap on a bar segment to select a series";
            }
            else
            {
                productA.IsVisible        = true;
                productB.IsVisible        = true;
                seriesSelection.IsVisible = false;

                var selectedindex = e.SelectedDataPointIndex;
                var seriesIndex   = Chart.Series.IndexOf(e.SelectedSeries);

                if (selectedindex < 0)
                {
                    if (seriesIndex == 0)
                    {
                        productA.Text = "Tap on a bar segment";
                    }
                    else
                    {
                        productB.Text = "Tap on a bar segment";
                    }

                    return;
                }
                else
                {
                    if (seriesIndex == 0)
                    {
                        var x = datapoint[selectedindex].Name;
                        var y = datapoint[selectedindex].Value;
                        productA.Text = "Month : " + x + ",  Sales : $" + y;
                    }
                    else if (seriesIndex == 1)
                    {
                        var x = datapoint1[selectedindex].Name;
                        var y = datapoint1[selectedindex].Value;
                        productB.Text = "Month : " + x + ",  Sales : $" + y;
                    }
                }
            }
        }
 private void OnSelectionChanged(object sender, ChartSelectionEventArgs args)
 {
 }
	    private void OnChartTapped (object sender, ChartSelectionEventArgs e)
		{
			double wValue = 0;
			double qnValue = 0;
			double qjValue = 0;

			if (e.SelectedDataPointIndex != -1) {
				if (_firstSeries != null) {
					var wAllValues = _firstSeries.GetChartDataPoints ();

					var value = wAllValues.ElementAt (e.SelectedDataPointIndex);
					wValue = value.YValue;
				}

				if (_secondSeries != null) {
					var wAllValues = _secondSeries.GetChartDataPoints ();

					var value = wAllValues.ElementAt (e.SelectedDataPointIndex);
					qnValue = value.YValue;
				}

				if (_thirdSeries != null) {
					var wAllValues = _thirdSeries.GetChartDataPoints ();

					var value = wAllValues.ElementAt (e.SelectedDataPointIndex);
					qjValue = value.YValue;
				}
			}

			var parameter = new ChartDataPointSelectionEventArgs () {
				Wvalue = wValue,
				QnValue = qnValue,
				QjValue = qjValue
			};

			MessagingCenter.Send (this, MessagingCenterKeys.ChartSelectionChangedKey, parameter);
		}