public Chart(PatientModel model, InspectionModel currentInspection, bool ageChart = true)
        {
            InitializeComponent();
            pwi            = new PatientWithInspection();
            pwi.Patient    = model;
            pwi.Inspection = currentInspection;
            this.leftEye   = leftEye;

            DataContext = pwi;

            this.ageChart = ageChart;
            if (!ageChart)
            {
                tbDesc.Text = "身 高(0-180cm)";
            }

            DrawArea(model);
        }
        void DrawArea(PatientModel model)
        {
            var maxAge = model.Inspections.Max(p => p.Age);
            var minAge = model.Inspections.Min(p => p.Age);

            //var maxEyeSight = models.Max(p => p.EyeSight);
            //var minEyeSight = models.Min(p => p.EyeSight);

            //刻度长度,用来画轴线上的标记刻度的
            const double margin = 5;

            //scale为轴的两端空余px
            const double xscale = 50;
            double       xmin   = xscale;
            double       xmax   = (int)canGraph.Width;

            const double yscale  = 50;
            double       ymin    = yscale;
            double       ymax    = (int)canGraph.Height - yscale;
            double       yLength = ymax - ymin;

            //坐标轴分成多少份
            var sectionCounts = 10;
            //x坐标使用年龄以月为单位,从0-216个月即18岁为止,所以步长为4,共216个刻度698宽
            double xstep = 3;
            //y1坐标使用屈光度,从-20到+30,步长6,共100个刻度600高
            double y1step = 6;
            //y2坐标眼轴,从 5到35,共30高度分为300个刻度
            double y2step = 3;

            //坐标原点,在y最大值的3分之2处
            var oiriginPositionYSPH   = 601;
            var oiriginPositionYAxial = 601;
            var xAxis          = 468;
            var originPostionX = 0;

            //x轴
            DrawAxis(new Point(xmin, xAxis), new Point(canGraph.Width, xAxis), 180, 18);
            //y轴
            DrawAxis(new Point(xmin, 0), new Point(xmin, canGraph.Height), 180, 45);
            //DrawAxis(new Point(xmax, 0), new Point(xmax, canGraph.Height), 180);


            var orderedModels = model.Inspections.OrderBy(p => p.Age).ToList();

            var pxPerAge      = 3.6111;
            var pxPerHeight   = 3.6111;
            var pxPerSPH      = 13.33;
            var pxPerEyeAxial = 13.33;

            var pointsAgeLeftAxial  = new PointCollection();
            var pointsAgeRightAxial = new PointCollection();
            var pointsAgeLeftSPH    = new PointCollection();
            var pointsAgeRightSPH   = new PointCollection();

            var pointsHeightLeftAxial  = new PointCollection();
            var pointsHeightRightAxial = new PointCollection();
            var pointsHeightLeftSPH    = new PointCollection();
            var pointsHeightRightSPH   = new PointCollection();

            var heightOrderedModels = model.Inspections.OrderBy(p => p.Height).ToList();

            if (!ageChart)
            {
                //画点连线,身高
                for (int i = 0; i < heightOrderedModels.Count; i++)
                {
                    var x = xmin + orderedModels[i].Height * pxPerHeight;

                    var yLeftEyeSPH    = oiriginPositionYSPH + ((orderedModels[i].LeftEye.SPH - 10) * pxPerSPH);
                    var yRightEyeSPH   = oiriginPositionYSPH + ((orderedModels[i].RightEye.SPH - 10) * pxPerSPH);
                    var yLeftEyeAxial  = oiriginPositionYAxial - ((orderedModels[i].LeftEye.EyeAxial + 10) * pxPerEyeAxial);
                    var yRightEyeAxial = oiriginPositionYAxial - ((orderedModels[i].RightEye.EyeAxial + 10) * pxPerEyeAxial);

                    pointsHeightLeftSPH.Add(new Point(x, yLeftEyeSPH));
                    pointsHeightRightSPH.Add(new Point(x, yRightEyeSPH));
                    pointsHeightLeftAxial.Add(new Point(x, yLeftEyeAxial));
                    pointsHeightRightAxial.Add(new Point(x, yRightEyeAxial));
                }
            }
            else
            {
                //画点连线,年龄
                for (int i = 0; i < orderedModels.Count; i++)
                {
                    //月份x每月占像素,先把岁转成月,后续按照实际月份来算
                    var x = xmin + orderedModels[i].Age * pxPerAge;

                    //y轴有些不同,y的最大值是坐标0点,但是在画布上是左下角点(即top大,left0的点)
                    //所以用视力的最大值去减,得到的结果就从y的最小值上按比例加,越大越靠上方
                    //ymax / 2作为0点,+-要根据屈光度取反(为了对应坐标轴)
                    //左眼
                    var yLeftEyeSPH    = oiriginPositionYSPH + ((orderedModels[i].LeftEye.SPH - 10) * pxPerSPH);
                    var yRightEyeSPH   = oiriginPositionYSPH + ((orderedModels[i].RightEye.SPH - 10) * pxPerSPH);
                    var yLeftEyeAxial  = oiriginPositionYAxial - ((orderedModels[i].LeftEye.EyeAxial + 10) * pxPerEyeAxial);
                    var yRightEyeAxial = oiriginPositionYAxial - ((orderedModels[i].RightEye.EyeAxial + 10) * pxPerEyeAxial);

                    pointsAgeLeftSPH.Add(new Point(x, yLeftEyeSPH));
                    pointsAgeRightSPH.Add(new Point(x, yRightEyeSPH));
                    pointsAgeLeftAxial.Add(new Point(x, yLeftEyeAxial));
                    pointsAgeRightAxial.Add(new Point(x, yRightEyeAxial));
                }
            }

            //年龄
            Polyline polylineAgeLeftSPH = new Polyline();

            polylineAgeLeftSPH.StrokeThickness = 2;
            polylineAgeLeftSPH.Stroke          = Brushes.Red;
            polylineAgeLeftSPH.Points          = pointsAgeLeftSPH;

            Polyline polylineRightSPH = new Polyline();

            polylineRightSPH.StrokeThickness = 2;
            polylineRightSPH.Stroke          = Brushes.Blue;
            polylineRightSPH.Points          = pointsAgeRightSPH;

            Polyline polylineAgeLeftAxial = new Polyline();

            polylineAgeLeftAxial.StrokeThickness = 2;
            polylineAgeLeftAxial.Stroke          = Brushes.Yellow;
            polylineAgeLeftAxial.Points          = pointsAgeLeftAxial;

            Polyline polylineRightAxial = new Polyline();

            polylineRightAxial.StrokeThickness = 2;
            polylineRightAxial.Stroke          = Brushes.Green;
            polylineRightAxial.Points          = pointsAgeRightAxial;

            canGraph.Children.Add(polylineAgeLeftSPH);
            canGraph.Children.Add(polylineRightSPH);
            canGraph.Children.Add(polylineAgeLeftAxial);
            canGraph.Children.Add(polylineRightAxial);



            //身高
            Polyline p1 = new Polyline();

            p1.StrokeThickness = 2;
            p1.Stroke          = Brushes.Red;
            p1.Points          = pointsHeightLeftSPH;

            Polyline p2 = new Polyline();

            p2.StrokeThickness = 2;
            p2.Stroke          = Brushes.Blue;
            p2.Points          = pointsHeightRightSPH;

            Polyline p3 = new Polyline();

            p3.StrokeThickness = 2;
            p3.Stroke          = Brushes.Yellow;
            p3.Points          = pointsHeightLeftAxial;

            Polyline p4 = new Polyline();

            p4.StrokeThickness = 2;
            p4.Stroke          = Brushes.Green;
            p4.Points          = pointsHeightRightAxial;

            canGraph.Children.Add(p1);
            canGraph.Children.Add(p2);
            canGraph.Children.Add(p3);
            canGraph.Children.Add(p4);
        }