using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using C1.Xaml.Chart;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace ChartSamples
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class XAxis : Page
    {
        public XAxis()
        {
            this.InitializeComponent();
            ChartDataCreator _dtcrtor = new ChartDataCreator();
            _dtcrtor.DrawChart(_c1MainChart);
            _dtcrtor.DrawAxisChart(_c1DupChart, (DataTemplate)Resources["EmptyTemplate"]);
        }

        /// <summary>
        /// Sets the x-axis scale based on the slider's values
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _slider_ValueChanged(object sender, EventArgs e)
        {
            if (_c1MainChart != null)
            {
                Axis ax = _c1MainChart.View.AxisX;
                ax.Scale = RngSldr.UpperValue - RngSldr.LowerValue;
                ax.Value = RngSldr.LowerValue / (1 - ax.Scale);
            }
        }
    }
}
