public static int GetIndexPoint2DType(BasePointMarker point)
 {
     if (point is SquarePointMarker)
     {
         return(1);
     }
     else
     {
         return(0);
     }
 }
Exemple #2
0
        public static LineAndMarker <MarkerPointsGraph> AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource,
                                                                     Pen linePen, BasePointMarker marker, Description description)
        {
            if (pointSource == null)
            {
                throw new ArgumentNullException("pointSource");
            }

            var res = new LineAndMarker <MarkerPointsGraph>();

            if (linePen != null)             // We are requested to draw line graphs
            {
                LineGraph graph = new LineGraph
                {
                    DataSource = pointSource,
                    LinePen    = linePen
                };
                if (description != null)
                {
                    graph.Description = description;
                }
                if (marker == null)
                {
                    // Add inclination filter only to graphs without markers
                    graph.Filters.Add(new InclinationFilter());
                }

                res.LineGraph = graph;

                graph.Filters.Add(new FrequencyFilter());
                //graph.Filters.Add(new CountFilter());
                plotter.Children.Add(graph);
            }

            if (marker != null)             // We are requested to draw marker graphs
            {
                MarkerPointsGraph markerGraph = new MarkerPointsGraph
                {
                    DataSource = pointSource,
                    Marker     = marker
                };

                res.MarkerGraph = markerGraph;

                plotter.Children.Add(markerGraph);
            }

            return(res);
        }
        private void ChartTypButton_Click(object sender, RoutedEventArgs e)
        {
            TypeChartWindow chartWindow = new TypeChartWindow(_styleType)
            {
                Length        = CA.Length,
                SelectAlpha   = _selectAlpha,
                SelectAxis    = _selectAxis,
                SelectColor   = _selectColor,
                SelectPoint   = GetIndexPointType(_selectPointMarker),
                SelectSize    = (int)_selectPointMarker.Size,
                SelectIndex   = _selectIndex,
                SelectChart   = _selectChart,
                SelectPoint2D = GetIndexPoint2DType(_selectPointMarker2D)
            };

            if (chartWindow.ShowDialog() == true)
            {
                _selectAlpha = chartWindow.SelectAlpha;
                if (((_selectChart == Chart.PointChart2D) && (chartWindow.SelectChart < Chart.PointChart2D)) || ((chartWindow.SelectChart == Chart.PointChart2D) && (_selectChart < Chart.PointChart2D)))
                {
                    _selectChart = chartWindow.SelectChart;
                    AddCharting();
                }
                else
                {
                    _selectChart = chartWindow.SelectChart;
                }
                _selectColor         = chartWindow.SelectColor;
                _selectIndex         = chartWindow.SelectIndex;
                _selectAxis          = chartWindow.SelectAxis;
                _selectPointMarker   = GetPoint(chartWindow.SelectPoint, chartWindow.SelectSize);
                _selectPointMarker2D = GetPoint2D(chartWindow.SelectPoint2D);

                SetAxis();
                Paint();
            }
        }