示例#1
0
        /// <summary>
        /// Adds the draw margin.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="strokeThickness">The stroke thickness.</param>
        /// <param name="oldPalette">The old palette.</param>
        /// <param name="newPalette">The new palette.</param>
        private void AddDrawMargin(PerformanceSpaceViewModel viewModel, double strokeThickness, Collection <ResourceDictionary> oldPalette, Collection <ResourceDictionary> newPalette)
        {
            if (double.IsNaN(viewModel.DrawMargin) || !(viewModel.DrawMargin > 0))
            {
                return;
            }

            // Add draw margin lines
            var margin1 = new[]
            {
                new ChartPoint <double, double>(viewModel.XMinimum, viewModel.YMinimum + viewModel.DrawMargin),
                new ChartPoint <double, double>(viewModel.XMaximum - viewModel.DrawMargin, viewModel.YMaximum)
            };
            var margin2 = new[]
            {
                new ChartPoint <double, double>(viewModel.XMinimum + viewModel.DrawMargin, viewModel.YMinimum),
                new ChartPoint <double, double>(viewModel.XMaximum, viewModel.YMaximum - viewModel.DrawMargin)
            };

            MyChart.Series.Add(
                new FastDashedSeries <double, double>
            {
                StrokeDashArray = new[] { 0.5 },
                StrokeThickness = strokeThickness,
                ItemsSource     = margin1
            });
            MyChart.Series.Add(
                new FastDashedSeries <double, double>
            {
                StrokeDashArray = new[] { 0.5 },
                StrokeThickness = strokeThickness,
                ItemsSource     = margin2
            });
            newPalette.Add(oldPalette[0]);
            newPalette.Add(oldPalette[0]);

            // Now add the text
            var pt = new ChartPoint <double, double>(
                viewModel.XMinimum + ((viewModel.XMaximum - viewModel.XMinimum) * 0.84),
                viewModel.YMinimum + ((viewModel.YMaximum - viewModel.YMinimum) * 0.16));

            MyChart.Series.Add(new ChartAnnotation <double, double> {
                ItemsSource = new[] { pt }, Annotation = "Draw", ShowBorder = this.ShowAnnotationBorders
            });

            var mid = new ChartPoint <double, double>(
                viewModel.XMinimum + ((viewModel.XMaximum - viewModel.XMinimum) * 0.75),
                viewModel.YMinimum + ((viewModel.YMaximum - viewModel.YMinimum) * 0.75));
            var pt1 = new ChartPoint <double, double>(mid.X - viewModel.DrawMargin, mid.Y);
            var pt2 = new ChartPoint <double, double>(mid.X + viewModel.DrawMargin, mid.Y);
            var pt3 = new ChartPoint <double, double>(mid.X, mid.Y - viewModel.DrawMargin);
            var pt4 = new ChartPoint <double, double>(mid.X, mid.Y + viewModel.DrawMargin);

            MyChart.Series.Add(
                new FastArrowSeries <double, double> {
                ItemsSource = new[] { pt1, pt2, pt3, pt4 }, StrokeThickness = 1.5, IsStartArrow = true
            });
        }
示例#2
0
        /// <summary>
        /// Adds the samples.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="palette">The palette.</param>
        /// <param name="newPalette">The new palette.</param>
        private void AddSamples(PerformanceSpaceViewModel viewModel, IReadOnlyList <ResourceDictionary> palette, ICollection <ResourceDictionary> newPalette)
        {
            if (viewModel.Samples == null || viewModel.Samples.Count() <= 0)
            {
                return;
            }

            MyChart.Series.Add(
                new FastScatterSeries <double, double>
            {
                ItemsSource =
                    viewModel.Samples.Select(ia => new ChartPoint <double, double>(ia.X, ia.Y)),
            });
            newPalette.Add(palette[1]);
        }
示例#3
0
        /// <summary>
        /// Adds the text annotations.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        private void AddTextAnnotations(PerformanceSpaceViewModel viewModel)
        {
            // Add the text annotations
            var pt1 = new ChartPoint <double, double>(
                viewModel.XMinimum + ((viewModel.XMaximum - viewModel.XMinimum) * 0.25),
                viewModel.YMinimum + ((viewModel.YMaximum - viewModel.YMinimum) * 0.25));
            var pt2 = new ChartPoint <double, double>(
                viewModel.XMinimum + ((viewModel.XMaximum - viewModel.XMinimum) * 0.75),
                viewModel.YMinimum + ((viewModel.YMaximum - viewModel.YMinimum) * 0.75));

            MyChart.Series.Add(new ChartAnnotation <double, double> {
                Annotation = viewModel.Player1Wins, ItemsSource = new[] { pt1 }, ShowBorder = this.ShowAnnotationBorders
            });
            MyChart.Series.Add(new ChartAnnotation <double, double> {
                Annotation = viewModel.Player2Wins, ItemsSource = new[] { pt2 }, ShowBorder = this.ShowAnnotationBorders
            });
        }