Exemple #1
0
        public CartesianGrid()
        {
            //ShapeStyle arrowStyle = new ShapeStyle()
            //{
            //    Color = Color.FromArgb(255, 128, 128, 255),
            //    Fill = new SolidColorBrush(Color.FromArgb(255, 128, 128, 255)),
            //    StrokeWidth = 1,
            //    Name = "ArrowStyle"
            //};
            LineStyle axisStyle = new LineStyle()
            {
                Color       = Color.FromArgb(255, 128, 128, 255),
                Name        = "AxisStyle",
                StrokeWidth = 1
            };
            LineStyle gridStyle = new LineStyle()
            {
                Color       = Colors.LightGray,
                Name        = "GridStyle",
                StrokeWidth = 0.5
            };
            TextStyle labelsStyle = new TextStyle()
            {
                Color    = Color.FromArgb(255, 128, 128, 255),
                FontSize = 12.0,
                Name     = "LabelsStyle"
            };

            OriginPoint         = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 0);
            XUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 1, () => 0);
            YUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 1);
            OriginPoint.Name    = "Origin";
            XUnitPoint.Name     = "XUnitPoint";
            YUnitPoint.Name     = "YUnitPoint";
            OriginPoint.Visible = false;
            XUnitPoint.Visible  = false;
            YUnitPoint.Visible  = false;

            XAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, XUnitPoint });
            YAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, YUnitPoint });
            XAxisLine.Name = "XAxisLine";
            YAxisLine.Name = "YAxisLine";
            AxisLabels     = new AxisLabelsCollection()
            {
                Drawing = Drawing
            };
            GridLines = new RectangularGridLinesCollection()
            {
                Drawing = Drawing
            };

            //XAxisLine.Arrow.Style = arrowStyle;
            XAxisLine.Line.Style = axisStyle;
            //YAxisLine.Arrow.Style = arrowStyle;
            YAxisLine.Line.Style = axisStyle;
            GridLines.Style      = gridStyle;
            AxisLabels.Style     = labelsStyle;

            Children.Add(
                OriginPoint,
                XUnitPoint,
                YUnitPoint,
                XAxisLine,
                YAxisLine,
                AxisLabels,
                GridLines
                );
        }
Exemple #2
0
        public CartesianGrid()
        {
            //ShapeStyle arrowStyle = new ShapeStyle()
            //{
            //    Color = Color.FromArgb(255, 128, 128, 255),
            //    Fill = new SolidColorBrush(Color.FromArgb(255, 128, 128, 255)),
            //    StrokeWidth = 1,
            //    Name = "ArrowStyle"
            //};
            LineStyle axisStyle = new LineStyle()
            {
                Color           = Color.FromArgb(255, 128, 128, 255),
                Name            = "AxisStyle",
                StrokeWidth     = 0.5,
                StrokeDashArray = null
            };

            // Hiển thị màu cho lưới ở các vị trí điểm nổi bật
            System.Windows.Media.Color normalGridLine    = System.Windows.Media.Colors.DarkGray;
            System.Windows.Media.Color highLightGridLine = System.Windows.Media.Colors.WhiteSmoke;
            //??

            LineStyle gridStyle = new LineStyle()
            {
                Color           = Colors.WhiteSmoke,
                Name            = "GridStyle",
                StrokeWidth     = 0.1,
                StrokeDashArray = null
            };
            TextStyle labelsStyle = new TextStyle()
            {
                Color = Color.FromArgb(255, 128, 128, 255),
                //Color = Color.FromArgb(255, 201, 201, 201),
                FontSize = 12.0,
                Name     = "LabelsStyle"
            };

            OriginPoint         = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 0);
            XUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 1, () => 0);
            YUnitPoint          = Factory.CreatePointByCoordinates(Drawing, () => 0, () => 1);
            OriginPoint.Name    = "Origin";
            XUnitPoint.Name     = "XUnitPoint";
            YUnitPoint.Name     = "YUnitPoint";
            OriginPoint.Visible = false;
            XUnitPoint.Visible  = false;
            YUnitPoint.Visible  = false;

            XAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, XUnitPoint });
            YAxisLine      = Factory.CreateAxis(Drawing, new[] { OriginPoint, YUnitPoint });
            XAxisLine.Name = "XAxisLine";
            YAxisLine.Name = "YAxisLine";
            AxisLabels     = new AxisLabelsCollection()
            {
                Drawing = Drawing
            };
            GridLines = new RectangularGridLinesCollection()
            {
                Drawing = Drawing
            };

            //XAxisLine.Arrow.Style = arrowStyle;
            XAxisLine.Line.Style = axisStyle;
            //YAxisLine.Arrow.Style = arrowStyle;
            YAxisLine.Line.Style = axisStyle;
            GridLines.Style      = gridStyle;
            AxisLabels.Style     = labelsStyle;

            Children.Add(
                OriginPoint,
                XUnitPoint,
                YUnitPoint,
                XAxisLine,
                YAxisLine,
                AxisLabels,
                GridLines
                );
        }