예제 #1
0
        private void CreatePowGraphOnLeftYAxis(ChartPlotter plotter)
        {
            EnumerableDataSource <TPoint> edsPow = new EnumerableDataSource <TPoint>(
                Enumerable.Range(1, 2000).Select(s =>
                                                 new TPoint
            {
                X = DateTime.Now.AddYears(-20).AddDays(s),
                Y = Math.Pow(10, s / 700.0)
            }
                                                 ).ToList());

            edsPow.SetXMapping(s => xAxis.ConvertToDouble(s.X));
            edsPow.SetYMapping(s => s.Y);

            double minData, maxData, M, B;

            GetMinAndMaxForEDS(edsPow, out minData, out maxData);
            Get_M_and_B(Math.Floor(Math.Log10(minData)), Math.Ceiling(Math.Log10(maxData)), out M, out B);

            Func <double, double> ConvertToDouble = s => M *Math.Log10(s) + B;

            Func <double, double> ConvertFromDouble = t => Math.Pow(10.0, (t - B) / M);
            Func <Point, Point>   DataToViewport    = s => new Point(s.X, ConvertToDouble(s.Y));
            Func <Point, Point>   ViewportToData    = t => new Point(t.X, ConvertFromDouble(t.Y));

            Brush          brushPow   = new SolidColorBrush(Colors.Green);
            Pen            linePenPow = new Pen(brushPow, 2.0);
            PenDescription descPow    = new PenDescription("f(x) = 10 ^ x");
            LineGraph      lg         = plotter.AddLineGraph(edsPow, linePenPow, descPow);

            lg.DataTransform            = new LambdaDataTransform(DataToViewport, ViewportToData);
            yAxisLeft.ConvertFromDouble = ConvertFromDouble;
            yAxisLeft.ConvertToDouble   = ConvertToDouble;
        }
예제 #2
0
파일: Graphic.cs 프로젝트: sm-g/weatherlog
        private static ChartPlotter SamplePlot()
        {
            ChartPlotter           plotter  = new ChartPlotter();
            HorizontalDateTimeAxis dateAxis = new HorizontalDateTimeAxis();

            plotter.HorizontalAxis = dateAxis;

            // chart.Children.Add(plotter);

            int    size   = 15;
            Random random = new Random();

            DateTime[] dates   = new DateTime[size];
            int[]      values1 = new int[size];
            int[]      values2 = new int[size];

            for (int i = 0; i < size; ++i)
            {
                dates[i]   = DateTime.Today.AddDays(i);
                values1[i] = random.Next(0, 10);
                values2[i] = random.Next(5, 15);
            }

            var datesDataSource = new EnumerableDataSource <DateTime>(dates);

            datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));

            var numberOpenDataSource = new EnumerableDataSource <int>(values1);

            numberOpenDataSource.SetYMapping(y => y);

            var numberOpenDataSource2 = new EnumerableDataSource <int>(values2);

            numberOpenDataSource2.SetYMapping(y => y);

            var datesDataSource2 = new EnumerableDataSource <DateTime>(dates);

            datesDataSource2.SetXMapping(x => dateAxis.ConvertToDouble(((DateTime)x).AddDays(2)));

            CompositeDataSource compositeDataSource1 = new CompositeDataSource(datesDataSource, numberOpenDataSource);
            CompositeDataSource compositeDataSource2 = new CompositeDataSource(
                datesDataSource2,
                numberOpenDataSource2);
            LinearPalette pal = new LinearPalette(Colors.Crimson, Colors.DarkBlue);

            plotter.AddLineGraph(compositeDataSource1,
                                 new Pen(Brushes.Blue, 2),
                                 new CirclePointMarker {
                Size = 10.0, Fill = Brushes.Red
            },
                                 new PenDescription("1n"));
            plotter.AddLineGraph(compositeDataSource2,
                                 new Pen(Brushes.Cyan, 1),
                                 new TrianglePointMarker {
                Size = 5.0
            },
                                 new PenDescription("2n"));

            return(plotter);
        }
예제 #3
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            #region Prepering arrays with data

            const int N = 200;
            DateTime[] x = new DateTime[N];
            double[] y = new double[N];

            TimeSpan step = new TimeSpan(11, 21, 31);

            x[0] = DateTime.Now;
            y[0] = 0;

            for (int i = 1; i < N; i++)
            {
                x[i] = x[i - 1] + step;
                y[i] = (Int32)(y[i - 1] + Math.E) % 37;
            }
            #endregion

            //Here we replace default numeric axis with DateTime Axis
            dateAxis = new HorizontalDateTimeAxis();
            plotter.HorizontalAxis =dateAxis;

            //Now we should set xMapping using ConvertToDouble method
            var xDataSource = x.AsXDataSource();
            xDataSource.SetXMapping(d => dateAxis.ConvertToDouble(d));
            var yDataSource = y.AsYDataSource();

            CompositeDataSource compositeDataSource = xDataSource.Join(yDataSource);
            LineGraph line = new LineGraph(compositeDataSource,"Graph depends on DateTime");

            plotter.Children.Add(line);
            plotter.FitToView();
        }
예제 #4
0
        public void AddChartValues(DateTime x, double y)
        {
            HorizontalDateTimeAxis axis = multimeter.dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;

            minX = axis.ConvertToDouble(x.AddSeconds(-8 * multimeter.TimingInterval));
            maxX = axis.ConvertToDouble(x.AddSeconds(4 * multimeter.TimingInterval));
            maxY = 2 * y;

            loggedValues.AppendAsync(Application.Current.Dispatcher, new DatePoint(x, y));
            if (multimeter.GraphAutoScroll)
            {
                multimeter.dynamicChart.Viewport.Visible = new Microsoft.Research.DynamicDataDisplay.Common.DataRect(new Point(minX, 0), new Point(maxX, maxY));
            }

            multimeter.program.AddChartValues(x, y, multimeter.Index);
        }
예제 #5
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            #region Prepering arrays with data

            const int  N = 200;
            DateTime[] x = new DateTime[N];
            double[]   y = new double[N];

            TimeSpan step = new TimeSpan(23, 11, 21, 31);

            x[0] = new DateTime(1990, 1, 1);
            y[0] = 0;

            for (int i = 1; i < N; i++)
            {
                x[i] = x[i - 1] + step;
                y[i] = (Int32)(y[i - 1] + Math.E) % 37;
            }
            #endregion

            //Here we replace default numeric axis with DateTime Axis
            dateAxis = new HorizontalDateTimeAxis();
            plotter.HorizontalAxis = dateAxis;

            //Now we should set xMapping using ConvertToDouble method
            var xDataSource = x.AsXDataSource();
            xDataSource.SetXMapping(d => dateAxis.ConvertToDouble(d));
            var yDataSource = y.AsYDataSource();

            CompositeDataSource compositeDataSource = xDataSource.Join(yDataSource);
            LineGraph           line = new LineGraph(compositeDataSource, "Graph depends on DateTime");

//            plotter.Children.Add(line);
            plotter.FitToView();
        }
예제 #6
0
        private EnumerableDataSource <CurrencyInfo> CreateCurrencyDataSource(List <CurrencyInfo> rates)
        {
            EnumerableDataSource <CurrencyInfo> ds = new EnumerableDataSource <CurrencyInfo>(rates);

            ds.SetXMapping(ci => dateAxis.ConvertToDouble(ci.Date));
            ds.SetYMapping(ci => ci.Rate);
            return(ds);
        }
예제 #7
0
        public void AddChartValues(DateTime x, double y, int index)
        {
            HorizontalDateTimeAxis axis = dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;

            maxX = axis.ConvertToDouble(x.AddSeconds(10));
            if (y > maxY)
            {
                maxY = y;
            }
            minX = axis.ConvertToDouble(x.AddSeconds(-50));

            points[index].AppendAsync(Application.Current.Dispatcher, new DatePoint(x, y));

            /*if (reference.GraphAutoScroll)
             * {*/
            dynamicChart.Viewport.Visible = new Microsoft.Research.DynamicDataDisplay.Common.DataRect(new Point(minX, 0), new Point(maxX, maxY * 2));
            //}
        }
예제 #8
0
        /// <summary>
        /// 绘制曲线
        /// </summary>
        private void Curve()
        {
            try
            {
                int        len = _aValues.Length / 2, index = 0;
                DateTime[] dates      = new DateTime[len];
                Double[]   numberOpen = new Double[len];
                Double[]   intDate    = new Double[len];
                for (int i = 0; i < _aValues.Length; ++i)
                {
                    if (_vValues[i] > 64436 && _aValues[i] > 0)
                    {
                        if (i > 0 && _vValues[i] == _vValues[i - 1])
                        {
                            continue;
                        }

                        //DateTime dt = Convert.ToDateTime("01/01/000" + (_vValues[i] - 64436));
                        DateTime dt = Convert.ToDateTime("01/01/000" + (i + 1));
                        dates[index] = dt;

                        //intDate[index] = (int)_vValues[i];
                        numberOpen[index] = (Double)_aValues[i];
                        index++;
                    }
                }

                var datesDataSource = new EnumerableDataSource <DateTime>(dates);
                datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));

                //var datesDataSource = new EnumerableDataSource<Double>(intDate);
                //datesDataSource.SetXMapping(x => dateAxis.ConvertFromDouble(x));
                var numberOpenDataSource = new EnumerableDataSource <Double>(numberOpen);
                numberOpenDataSource.SetYMapping(y => y);

                CompositeDataSource compositeDataSource1 = new CompositeDataSource(datesDataSource, numberOpenDataSource);

                plotter.AddLineGraph(compositeDataSource1,
                                     new Pen(Brushes.Red, 2),
                                     new CirclePointMarker {
                    Size = 2.0, Fill = Brushes.Blue
                },
                                     new PenDescription("Number bugs open"));
                plotter.Viewport.FitToView();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #9
0
        public ltepopupModel()
        {
            PinCommand         = new DelegateCommand(new Action(OnPinCommandExecute));
            CloseWindowCommand = new DelegateCommand(new Action(OnCloseWindowCommandExecute));

            LTECollection  = new LTECollection();
            LTECollection2 = new LTECollection();
            DateTimeAxis1  = new HorizontalDateTimeAxis();
            DateTimeAxis2  = new HorizontalDateTimeAxis();

            var ds = new EnumerableDataSource <LTEData>(LTECollection);

            ds.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
            ds.SetYMapping(y => y.Data);

            RsrqGraph = ds;

            var ds2 = new EnumerableDataSource <LTEData>(LTECollection2);

            ds2.SetXMapping(x => DateTimeAxis1.ConvertToDouble(x.Date));
            ds2.SetYMapping(y => y.Data);

            RsrpGraph = ds2;
        }
예제 #10
0
        public DataHandler(Multimeter refer)
        {
            s            = new Stopwatch();
            g            = new Stopwatch();
            multimeter   = refer;
            currentMeter = "DMM " + (multimeter.Index + 1).ToString();

            totalStopWatch = new Stopwatch();
            totalLogTimer  = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate
            {
                multimeter.overview.ElapsedTimeDisplay.Text = String.Format("{0:hh\\:mm\\:ss}", totalStopWatch.Elapsed);
            }, Application.Current.Dispatcher);

            HorizontalDateTimeAxis axis = multimeter.dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;

            loggedValues = new ObservableDataSource <DatePoint>();
            loggedValues.SetXMapping(p => axis.ConvertToDouble(p.X));
            loggedValues.SetYMapping(p => p.Y);
            graph = multimeter.dynamicChart.AddLineGraph(loggedValues, Colors.Blue, 2, currentMeter);
        }
예제 #11
0
        private void AddNewTab(int index = 1)
        {
            TabItem t = new TabItem();

            MultimeterTabs.Items.Insert(index, t);
            Multimeter multimeter = new Multimeter(this, t, MultimeterTabs, multimeters.Count);

            multimeters.Add(multimeter);
            t.Content = multimeter;
            MultimeterTabs.SelectedIndex = index;

            HorizontalDateTimeAxis           axis   = dynamicChart.HorizontalAxis as HorizontalDateTimeAxis;
            ObservableDataSource <DatePoint> values = new ObservableDataSource <DatePoint>();

            values.SetYMapping(p => p.Y);
            values.SetXMapping(p => axis.ConvertToDouble(p.X));
            points.Add(values);
            graphs.Add(dynamicChart.AddLineGraph(values, 2, multimeter.handler.currentMeter));
            multimeter.graph = graphs.Last <LineGraph>();
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            const int count = 4;

            for (int i = 0; i < count; i++)
            {
                data.Add(CreateRandomRect());
            }

            chart.AddPropertyBinding <TimeSpan>(ViewportPanel.ViewportWidthProperty,
                                                duration =>
            {
                DateTime durationDT         = new DateTime(duration.Ticks);
                HorizontalDateTimeAxis axis = (HorizontalDateTimeAxis)plotter.MainHorizontalAxis;
                var result = axis.ConvertToDouble(durationDT);

                return(result);
            },
                                                "Duration");

            DataContext = data;
        }
		void LogYWindow_Loaded(object sender, RoutedEventArgs e)
		{
			//ChartPlotter plotter = new ChartPlotter();

			//plotter.Children.Add(new CursorCoordinateGraph());

			//plotter.DataTransform = new Log10YTransform();
			//VerticalAxis axis = new VerticalAxis
			//{
			//    TicksProvider = new LogarithmNumericTicksProvider(10),
			//    LabelProvider = new UnroundingLabelProvider()
			//};
			//plotter.MainVerticalAxis = axis;

			//plotter.AxisGrid.DrawVerticalMinorTicks = true;

			//const int count = 500;
			//double[] xs = Enumerable.Range(1, count).Select(x => x * 0.01).ToArray();
			//EnumerableDataSource<double> xDS = xs.AsXDataSource();

			//var pows = xs.Select(x => Math.Pow(10, x));
			//var linear = xs.Select(x => x);
			//var logXs = Enumerable.Range(101, count).Select(x => x * 0.01);
			//var logarithmic = logXs.Select(x => Math.Log10(x));

			//plotter.AddLineGraph(pows.AsYDataSource().Join(xDS), "f(x) = 10^x");
			//plotter.AddLineGraph(linear.AsYDataSource().Join(xDS), "f(x) = x");
			//plotter.AddLineGraph(logarithmic.AsYDataSource().Join(logXs.AsXDataSource()), "f(x) = log(x)");

			//Content = plotter;

			ChartPlotter plotter = new ChartPlotter();
			plotter.DataTransform = new Log10YTransform();
			VerticalAxis yAxis = new VerticalAxis
			{
				TicksProvider = new LogarithmNumericTicksProvider(10),
				LabelProvider = new UnroundingLabelProvider()
			};
			plotter.MainVerticalAxis = yAxis;
			plotter.AxisGrid.DrawVerticalMinorTicks = true;

			HorizontalDateTimeAxis xAxis = new HorizontalDateTimeAxis();
			plotter.MainHorizontalAxis = xAxis;

			EnumerableDataSource<TPoint> edsPow = new EnumerableDataSource<TPoint>(
				Enumerable.Range(1, 2000).Select(s =>
					new TPoint
					{
						X = DateTime.Now.AddYears(-20).AddDays(s),
						Y = Math.Pow(10, s / 5000.0)
					}
					).ToList());
			//edsPow.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
			edsPow.SetXMapping(s => xAxis.ConvertToDouble(s.X));
			edsPow.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
			edsPow.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => String.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

			EnumerableDataSource<TPoint> edsLinear = new EnumerableDataSource<TPoint>(
				Enumerable.Range(1, 2000).Select(s =>
					new TPoint
					{
						X = DateTime.Now.AddYears(-20).AddDays(s),
						Y = s / 2000.0
					}
					).ToList());
			//edsLinear.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
			edsLinear.SetXMapping(s => xAxis.ConvertToDouble(s.X));
			edsLinear.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
			edsLinear.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => String.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

			edsLog10 = new EnumerableDataSource<TPoint>(
				Enumerable.Range(1, 2000).Select(s =>
					new TPoint
					{
						X = DateTime.Now.AddYears(-20).AddDays(s),
						Y = Math.Log10(s)
					}
					).Where(s => s.Y > 0).ToList());
			//edsLog10.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
			edsLog10.SetXMapping(s => xAxis.ConvertToDouble(s.X));
			edsLog10.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
			edsLog10.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => String.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

			SolidColorBrush brushPow = new SolidColorBrush(Colors.Green);
			Pen linePenPow = new Pen(brushPow, 2.0);
			CircleElementPointMarker markerPow = new CircleElementPointMarker
			{
				Size = 4,
				Brush = brushPow,
				Fill = brushPow
			};
			PenDescription descPow = new PenDescription("f(x) = 10 ^ x");
			//var chartPow = plotter.AddLineGraph(edsPow, linePenPow, (ShapeElementPointMarker)null/*markerPow*/, descPow);

			SolidColorBrush brushLinear = new SolidColorBrush(Colors.Blue);
			Pen linePenLinear = new Pen(brushLinear, 2.0);
			CircleElementPointMarker markerLinear = new CircleElementPointMarker
			{
				Size = 4,
				Brush = brushLinear,
				Fill = brushLinear
			};
			PenDescription descLinear = new PenDescription("f(x) = x");
			//var chartLinear = plotter.AddLineGraph(edsLinear, linePenLinear, (ShapeElementPointMarker)null/*markerLinear*/, descLinear);

			SolidColorBrush brushLog10 = new SolidColorBrush(Colors.Red);
			Pen linePenLog10 = new Pen(brushLog10, 2.0);
			CircleElementPointMarker markerLog10 = new CircleElementPointMarker
			{
				Size = 4,
				Brush = brushLog10,
				Fill = brushLog10
			};
			PenDescription descLog10 = new PenDescription("f(x) = log(x)");
			var chartLog10 = plotter.AddLineGraph(edsLog10, linePenLog10, (ShapeElementPointMarker)null/*markerLog10*/, descLog10);

			//plotter.Children.Add(new DataFollowChart(chartPow.LineGraph).WithProperty(c =>
			//{
			//    c.Marker.SetValue(Shape.FillProperty, brushPow);
			//    c.Marker.SetValue(Shape.StrokeProperty, brushPow.MakeDarker(0.2));
			//}));
			//plotter.Children.Add(new DataFollowChart(chartLinear.LineGraph).WithProperty(c =>
			//{
			//    c.Marker.SetValue(Shape.FillProperty, brushLinear);
			//    c.Marker.SetValue(Shape.StrokeProperty, brushLinear.MakeDarker(0.2));
			//}));

			plotter.Children.Add(new CursorCoordinateGraph());

			ValueStore store = new ValueStore();
			DataFollowChart dataFollowChart = new DataFollowChart(chartLog10.LineGraph);
			dataFollowChart.Marker.SetValue(Shape.FillProperty, brushLog10);
			dataFollowChart.Marker.SetValue(Shape.StrokeProperty, brushLog10.ChangeLightness(0.8));
			dataFollowChart.MarkerPositionChanged += new EventHandler(dataFollowChart_MarkerPositionChanged);
			//dataFollowChart.CustomDataContextCallback = () =>
			//    {
			//        if (dataFollowChart.ClosestPointIndex != -1)
			//        {
			//            var closestPoint = ((List<TPoint>)edsLog10.Data)[dataFollowChart.ClosestPointIndex];
			//            return store.SetValue("X", closestPoint.Y.ToString()).SetValue("Y", closestPoint.X.ToShortDateString());
			//        }
			//        else return null;
			//    };

#if true
			dataFollowChart.MarkerTemplate = (DataTemplate)FindResource("followMarkerTemplate");
#else
				dataFollowChart.MarkerAdjustCallback = marker =>
				{
				    Ellipse ellipse = (Ellipse)marker;
				    var markerPosition = c.MarkerPosition;
				    var date = xAxis.ConvertFromDouble(markerPosition.X);
				    var y = yAxis.ConvertFromDouble(markerPosition.Y);
				    ellipse.ToolTip = String.Format("Vol:{0}\r\nOn:{1}", y, date.ToShortDateString());
				};
#endif

			plotter.Children.Add(dataFollowChart);

			Content = plotter;
		}
예제 #14
0
        void LogYWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //ChartPlotter plotter = new ChartPlotter();

            //plotter.Children.Add(new CursorCoordinateGraph());

            //plotter.DataTransform = new Log10YTransform();
            //VerticalAxis axis = new VerticalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider()
            //};
            //plotter.MainVerticalAxis = axis;

            //plotter.AxisGrid.DrawVerticalMinorTicks = true;

            //const int count = 500;
            //double[] xs = Enumerable.Range(1, count).Select(x => x * 0.01).ToArray();
            //EnumerableDataSource<double> xDS = xs.AsXDataSource();

            //var pows = xs.Select(x => Math.Pow(10, x));
            //var linear = xs.Select(x => x);
            //var logXs = Enumerable.Range(101, count).Select(x => x * 0.01);
            //var logarithmic = logXs.Select(x => Math.Log10(x));

            //plotter.AddLineGraph(pows.AsYDataSource().Join(xDS), "f(x) = 10^x");
            //plotter.AddLineGraph(linear.AsYDataSource().Join(xDS), "f(x) = x");
            //plotter.AddLineGraph(logarithmic.AsYDataSource().Join(logXs.AsXDataSource()), "f(x) = log(x)");

            //Content = plotter;

            ChartPlotter plotter = new ChartPlotter();

            plotter.DataTransform = new Log10YTransform();
            VerticalAxis yAxis = new VerticalAxis
            {
                TicksProvider = new LogarithmNumericTicksProvider(10),
                LabelProvider = new UnroundingLabelProvider()
            };

            plotter.MainVerticalAxis = yAxis;
            plotter.AxisGrid.DrawVerticalMinorTicks = true;

            HorizontalDateTimeAxis xAxis = new HorizontalDateTimeAxis();

            plotter.MainHorizontalAxis = xAxis;

            EnumerableDataSource <TPoint> edsPow = new EnumerableDataSource <TPoint>(
                Enumerable.Range(1, 2000).Select(s =>
                                                 new TPoint
            {
                X = DateTime.Now.AddYears(-20).AddDays(s),
                Y = Math.Pow(10, s / 5000.0)
            }
                                                 ).ToList());

            //edsPow.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
            edsPow.SetXMapping(s => xAxis.ConvertToDouble(s.X));
            edsPow.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
            edsPow.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => string.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

            EnumerableDataSource <TPoint> edsLinear = new EnumerableDataSource <TPoint>(
                Enumerable.Range(1, 2000).Select(s =>
                                                 new TPoint
            {
                X = DateTime.Now.AddYears(-20).AddDays(s),
                Y = s / 2000.0
            }
                                                 ).ToList());

            //edsLinear.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
            edsLinear.SetXMapping(s => xAxis.ConvertToDouble(s.X));
            edsLinear.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
            edsLinear.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => string.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

            edsLog10 = new EnumerableDataSource <TPoint>(
                Enumerable.Range(1, 2000).Select(s =>
                                                 new TPoint
            {
                X = DateTime.Now.AddYears(-20).AddDays(s),
                Y = Math.Log10(s)
            }
                                                 ).Where(s => s.Y > 0).ToList());
            //edsLog10.SetXYMapping(s => new Point(xax.ConvertToDouble(s.X), s.Y));
            edsLog10.SetXMapping(s => xAxis.ConvertToDouble(s.X));
            edsLog10.SetYMapping(s => yAxis.ConvertToDouble(s.Y));
            edsLog10.AddMapping(ShapeElementPointMarker.ToolTipTextProperty, s => string.Format("Vol:{0}\r\nOn:{1}", s.Y, s.X.ToShortDateString()));

            SolidColorBrush          brushPow   = new SolidColorBrush(Colors.Green);
            Pen                      linePenPow = new Pen(brushPow, 2.0);
            CircleElementPointMarker markerPow  = new CircleElementPointMarker
            {
                Size  = 4,
                Brush = brushPow,
                Fill  = brushPow
            };
            PenDescription descPow = new PenDescription("f(x) = 10 ^ x");
            //var chartPow = plotter.AddLineGraph(edsPow, linePenPow, (ShapeElementPointMarker)null/*markerPow*/, descPow);

            SolidColorBrush          brushLinear   = new SolidColorBrush(Colors.Blue);
            Pen                      linePenLinear = new Pen(brushLinear, 2.0);
            CircleElementPointMarker markerLinear  = new CircleElementPointMarker
            {
                Size  = 4,
                Brush = brushLinear,
                Fill  = brushLinear
            };
            PenDescription descLinear = new PenDescription("f(x) = x");
            //var chartLinear = plotter.AddLineGraph(edsLinear, linePenLinear, (ShapeElementPointMarker)null/*markerLinear*/, descLinear);

            SolidColorBrush          brushLog10   = new SolidColorBrush(Colors.Red);
            Pen                      linePenLog10 = new Pen(brushLog10, 2.0);
            CircleElementPointMarker markerLog10  = new CircleElementPointMarker
            {
                Size  = 4,
                Brush = brushLog10,
                Fill  = brushLog10
            };
            PenDescription descLog10  = new PenDescription("f(x) = log(x)");
            var            chartLog10 = plotter.AddLineGraph(edsLog10, linePenLog10, (ShapeElementPointMarker)null /*markerLog10*/, descLog10);

            //plotter.Children.Add(new DataFollowChart(chartPow.LineGraph).WithProperty(c =>
            //{
            //    c.Marker.SetValue(Shape.FillProperty, brushPow);
            //    c.Marker.SetValue(Shape.StrokeProperty, brushPow.MakeDarker(0.2));
            //}));
            //plotter.Children.Add(new DataFollowChart(chartLinear.LineGraph).WithProperty(c =>
            //{
            //    c.Marker.SetValue(Shape.FillProperty, brushLinear);
            //    c.Marker.SetValue(Shape.StrokeProperty, brushLinear.MakeDarker(0.2));
            //}));

            plotter.Children.Add(new CursorCoordinateGraph());

            ValueStore      store           = new ValueStore();
            DataFollowChart dataFollowChart = new DataFollowChart(chartLog10.LineGraph);

            dataFollowChart.Marker.SetValue(Shape.FillProperty, brushLog10);
            dataFollowChart.Marker.SetValue(Shape.StrokeProperty, brushLog10.ChangeLightness(0.8));
            dataFollowChart.MarkerPositionChanged += new EventHandler(dataFollowChart_MarkerPositionChanged);
            //dataFollowChart.CustomDataContextCallback = () =>
            //    {
            //        if (dataFollowChart.ClosestPointIndex != -1)
            //        {
            //            var closestPoint = ((List<TPoint>)edsLog10.Data)[dataFollowChart.ClosestPointIndex];
            //            return store.SetValue("X", closestPoint.Y.ToString()).SetValue("Y", closestPoint.X.ToShortDateString());
            //        }
            //        else return null;
            //    };

#if true
            dataFollowChart.MarkerTemplate = (DataTemplate)FindResource("followMarkerTemplate");
#else
            dataFollowChart.MarkerAdjustCallback = marker =>
            {
                Ellipse ellipse        = (Ellipse)marker;
                var     markerPosition = c.MarkerPosition;
                var     date           = xAxis.ConvertFromDouble(markerPosition.X);
                var     y = yAxis.ConvertFromDouble(markerPosition.Y);
                ellipse.ToolTip = String.Format("Vol:{0}\r\nOn:{1}", y, date.ToShortDateString());
            };
#endif

            plotter.Children.Add(dataFollowChart);

            Content = plotter;
        }