상속: DisplayAxis, ICategoryAxis
        private async void LoadChartContents(DateTime date)
        {

            MobileServiceInvalidOperationException exception = null;
            string idDeshidratadora;
            object selectedItem = comboBox.SelectedValue.ToString();
            idDeshidratadora = selectedItem.ToString();


            try
            {
                ProgressBarBefore();
                temperaturas = await TempDeshTable
                    .Where(Tempe => Tempe.Fecha == date.ToString("yyyy-MM-dd") && Tempe.idDeshidratadora == idDeshidratadora)
                    .ToCollectionAsync();
                if (temperaturas.Count >= 1)
                {
                    foreach (var c in temperaturas)
                    {
                        string[] hora = c.Hora.Split(' ');
                        c.Hora = hora[1];
                    }

                    CategoryAxis categoryAxis = new CategoryAxis() { Orientation = AxisOrientation.X, Location = AxisLocation.Bottom, AxisLabelStyle = App.Current.Resources["VerticalAxisStyle"] as Style };
                    (LineSeries.Series[0] as LineSeries).IndependentAxis = categoryAxis;
                    (LineSeries.Series[0] as LineSeries).ItemsSource = temperaturas;
                    LineSeries.Visibility = Visibility.Visible;

                    ProgressBarAfter();
                }
                else
                {
                    LineSeries.Visibility = Visibility.Collapsed;
                    MessageDialog mensaje = new MessageDialog("No existe registro para esta fecha.", "No existe registro");
                    await mensaje.ShowAsync();
                    ProgressBarAfter();
                }



            }
            catch (MobileServiceInvalidOperationException ex)
            {
                exception = ex;
            }

            if (exception != null)
            {
                await new MessageDialog(exception.Message, "Error!").ShowAsync();
            }

            // (LineSeries.Series[0] as LineSeries).ItemsSource = financialStuffList;




        }
 /// <summary>
 /// Acquires an independent axis suitable for use with the data values of the series.
 /// </summary>
 /// <returns>Axis instance.</returns>
 protected override IAxis AcquireIndependentAxis()
 {
     IAxis independentAxis = SeriesHost.Axes
         .Where(a => (a.Orientation == IndependentAxisOrientation) && ((a is ICategoryAxis) || (a is IRangeAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue)))
         .FirstOrDefault();
     if (null == independentAxis)
     {
         independentAxis = new CategoryAxis { Orientation = IndependentAxisOrientation };
     }
     return independentAxis;
 }
        /// <summary>
        /// Acquires an independent axis suitable for use with the data values of the series.
        /// </summary>
        /// <returns>Axis instance.</returns>
        protected override IAxis AcquireIndependentAxis()
        {
            IAxis independentAxis = SeriesHost.Axes
                                    .Where(a => (a.Orientation == IndependentAxisOrientation) && ((a is ICategoryAxis) || (a is IRangeAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue)))
                                    .FirstOrDefault();

            if (null == independentAxis)
            {
                independentAxis = new CategoryAxis {
                    Orientation = IndependentAxisOrientation
                };
            }
            return(independentAxis);
        }
예제 #4
0
 /// <summary>
 /// Acquire a horizontal linear axis and a vertical linear axis.
 /// </summary>
 /// <param name="firstDataPoint">The first data point.</param>
 protected override void GetAxes(DataPoint firstDataPoint)
 {
     GetAxes(
         firstDataPoint,
         (axis) => axis.Orientation == AxisOrientation.X,
         () =>
         {
             IAxis axis = CreateRangeAxisFromData(firstDataPoint.IndependentValue);
             if (axis == null)
             {
                 axis = new CategoryAxis();
             }
             axis.Orientation = AxisOrientation.X;
             return axis;
         },
         (axis) => axis.Orientation == AxisOrientation.Y && axis is IRangeAxis,
         () =>
         {
             DisplayAxis axis = (DisplayAxis)CreateRangeAxisFromData(firstDataPoint.DependentValue);
             if (axis == null)
             {
                 throw new InvalidOperationException(Properties.Resources.DataPointSeriesWithAxes_NoSuitableAxisAvailableForPlottingDependentValue);
             }
             axis.ShowGridLines = true;
             axis.Orientation = AxisOrientation.Y;
             return axis;
         });
 }
예제 #5
0
        /// <summary>
        /// SortOrderProperty property changed handler.
        /// </summary>
        /// <param name="d">CategoryAxis that changed its SortOrder.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnSortOrderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryAxis source = (CategoryAxis)d;

            source.OnSortOrderPropertyChanged();
        }
 /// <summary>
 /// Acquires an independent axis suitable for use with the data values of the series.
 /// </summary>
 /// <returns>Axis instance.</returns>
 protected override IAxis AcquireIndependentAxis()
 {
     IAxis independentAxis = SeriesHost.Axes
         .Where(a => (a.Orientation == AxisOrientation.X) && ((a is IRangeAxis) || (a is ICategoryAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue)))
         .FirstOrDefault();
     if (null == independentAxis)
     {
         object probeValue = DataItems.Any() ? DataItems.First().ActualIndependentValue : null;
         double convertedDouble;
         DateTime convertedDateTime;
         if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDouble))
         {
             independentAxis = new LinearAxis();
         }
         else if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDateTime))
         {
             independentAxis = new DateTimeAxis();
         }
         else
         {
             independentAxis = new CategoryAxis();
         }
         independentAxis.Orientation = AxisOrientation.X;
     }
     return independentAxis;
 }