示例#1
0
        public void DrawBase(ErrorMatrix matrix)
        {
            CtlBase.Clear();

            int  size       = 9;
            long axisOffset = 12;

            for (int y = 0; y < matrix.Output.Length; ++y)
            {
                for (int x = 0; x < matrix.Input.Length; ++x)
                {
                    CtlBase.DrawRectangle(null, PenSilver, Rects.Get(axisOffset + x * size, axisOffset + y * size, size, size));
                }
            }

            for (int x = 0; x < matrix.Output.Length; ++x)
            {
                var text = ClassesFmtText[matrix.Classes[x]];
                CtlBase.DrawText(text, Points.Get(axisOffset + x * size + (size - text.Width) / 2, 1 + axisOffset + matrix.Input.Length * size));
            }

            for (int y = 0; y < matrix.Input.Length; ++y)
            {
                var text = ClassesFmtText[matrix.Classes[y]];
                CtlBase.DrawText(text, Points.Get(1 + axisOffset + matrix.Output.Length * size + (size - text.Width) / 2, axisOffset + y * size));
            }

            CtlBase.DrawText(FmtOutput, Points.Get(axisOffset + (matrix.Output.Length * size - FmtOutput.Width) / 2, axisOffset - FmtOutput.Height - 1));
            CtlBase.DrawText(FmtInput, Points.Get(-axisOffset - (matrix.Input.Length * size - FmtInput.Width) / 1, axisOffset - FmtInput.Height - 1), -90);

            CtlBase.Update();
        }
        private void DrawPlotter()
        {
            CtlBase.Clear();

            var penBlack     = Tools.Draw.GetPen(Colors.Black);
            var penLightGray = Tools.Draw.GetPen(Colors.LightGray);

            double step = (ActualWidth - AxisOffset) / 10;
            double y    = ActualHeight - AxisOffset - AxisOffset / 2;
            double x    = 0;

            for (x = 0; x < 11; ++x)
            {
                CtlBase.DrawLine(penLightGray, Points.Get((float)(AxisOffset + step * x), (float)y), Points.Get((float)(AxisOffset + step * x), 0));
                CtlBase.DrawLine(penBlack, Points.Get((float)(AxisOffset + step * x), (float)y), Points.Get((float)(AxisOffset + step * x), (float)(y + AxisOffset)));
            }

            step = (ActualHeight - AxisOffset) / 10;
            x    = AxisOffset / 2;
            for (y = 0; y < 11; ++y)
            {
                CtlBase.DrawLine(penLightGray, Points.Get((float)x, (float)(ActualHeight - AxisOffset - step * y)), Points.Get(ActualWidth, (float)(ActualHeight - AxisOffset - step * y)));
                CtlBase.DrawLine(penBlack, Points.Get((float)x, (float)(ActualHeight - AxisOffset - step * y)), Points.Get((float)(x + AxisOffset), (float)(ActualHeight - AxisOffset - step * y)));
            }

            CtlBase.DrawLine(penBlack, Points.Get(AxisOffset, 0), Points.Get(AxisOffset, ActualHeight));
            CtlBase.DrawLine(penBlack, Points.Get(0, ActualHeight - AxisOffset), Points.Get(ActualWidth, ActualHeight - AxisOffset));
        }