Beispiel #1
0
        public BDeviceChart(DateTime start, DateTime stop, BeamCutDevice device)
        {
            InitializeComponent();
            Device = device;
            MachineTimeLineForm = new MachineTimeLine();

            ZedGraphControl.GraphPane.Title.Text = $"Device: {Device.Name}";
            ZedGraphControl.MouseDoubleClick    += ZedGraphControl_MouseDoubleClick;
            ZedGraphControl.IsShowPointValues    = true;

            ZedGraphControl.GraphPane.XAxis.Title.Text = "Date";
            ZedGraphControl.GraphPane.YAxis.Title.Text = "Cut quantity (ps), Cut times (t)";

            var RecordList = BeamCutQuery.GetBDeviceStatistic(start, stop, device);

            if (RecordList == null)
            {
                return;
            }

            var pane = ZedGraphControl.GraphPane;

            pane.XAxis.MajorGrid.DashOn = 2.0F;
            pane.XAxis.MajorGrid.Color  = System.Drawing.Color.LightGray;
            pane.YAxis.MajorGrid.DashOn = 2.0F;
            pane.YAxis.MajorGrid.Color  = System.Drawing.Color.LightGray;

            pane.XAxis.Scale.IsVisible = true;
            pane.YAxis.Scale.IsVisible = true;

            pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;


            //var pointsCurve;
            pane.XAxis.Scale.TextLabels = RecordList.Select(i => i.Date).ToArray();
            pane.XAxis.Type             = ZedGraph.AxisType.Text;

            LineItem CutQuantity = pane.AddCurve("Quantity", null, RecordList.Select(i => (double)i.TotalCutQty).ToArray(), System.Drawing.Color.DarkRed);
            LineItem CutTimes    = pane.AddCurve("Cut Times", null, RecordList.Select(i => (double)i.TotalCuttime).ToArray(), System.Drawing.Color.Blue);

            CutQuantity.Line.IsVisible = true;
            CutQuantity.Line.Width     = 1.0F;
            //Create your own scale of colors.

            CutQuantity.Symbol.Fill             = new Fill(new System.Drawing.Color[] { System.Drawing.Color.Blue, System.Drawing.Color.Green, System.Drawing.Color.Red });
            CutQuantity.Symbol.Fill.Type        = FillType.Solid;
            CutQuantity.Symbol.Type             = SymbolType.Circle;
            CutQuantity.Symbol.Border.IsVisible = true;

            CutTimes.Line.IsVisible          = true;
            CutTimes.Line.Width              = 1.0F;
            CutTimes.Symbol.Fill             = new Fill(new System.Drawing.Color[] { System.Drawing.Color.Black, System.Drawing.Color.Black, System.Drawing.Color.Black });
            CutTimes.Symbol.Fill.Type        = FillType.Solid;
            CutTimes.Symbol.Type             = SymbolType.Diamond;
            CutTimes.Symbol.Border.IsVisible = true;

            for (int i = 0; i < CutQuantity.Points.Count; i++)
            {
                var    pt   = CutQuantity.Points[i];
                string date = ZedGraphControl.GraphPane.XAxis.Scale.TextLabels[i];

                TextObj text1 = new TextObj(
                    $"{pt.Y}", pt.X, pt.Y + 0.1,
                    CoordType.AxisXYScale, AlignH.Left, AlignV.Top);
                text1.ZOrder         = ZOrder.A_InFront;
                text1.FontSpec.Angle = 0;

                pane.GraphObjList.Add(text1);

                pt = CutTimes.Points[i];
                TextObj text2 = new TextObj(
                    $"{pt.Y}", pt.X, pt.Y + 0.1,
                    CoordType.AxisXYScale, AlignH.Left, AlignV.Center);
                text2.ZOrder         = ZOrder.A_InFront;
                text2.FontSpec.Angle = 0;
                pane.GraphObjList.Add(text2);
            }

            pane.AxisChange();
            ZedGraphControl.Refresh();
            this.Controls.Add(ZedGraphControl);
            ZedGraphControl.Dock = DockStyle.Fill;
            ZedGraphControl.BringToFront();
        }
Beispiel #2
0
        void UpdateCurrentDateStatistic(BeamCutDevice device, DateTime date, int totalCutQty, int totalCutTime)
        {
            lbDate.Text         = $"Date: {date.ToString("dd/MM/yyyy")}";
            lbTotalCut.Text     = totalCutQty.ToString();
            lbTotalCutTime.Text = totalCutTime.ToString();

            var timeLine = BeamCutQuery.GetBeamCutDeviceTimeLineRecorde(device.id, date);

            ZedGraphControl ZedGraphControl = new ZedGraphControl();

            ZedGraphControl.IsShowPointValues = true;

            ZedGraphControl.GraphPane.XAxis.Title.Text = "Date";
            ZedGraphControl.GraphPane.YAxis.Title.Text = "Confirm (ps), Cut times (t)";

            var pane = ZedGraphControl.GraphPane;

            pane.XAxis.MajorGrid.DashOn = 2.0F;
            pane.XAxis.MajorGrid.Color  = Color.LightGray;
            pane.YAxis.MajorGrid.DashOn = 2.0F;
            pane.YAxis.MajorGrid.Color  = Color.LightGray;

            pane.XAxis.Scale.IsVisible = true;
            pane.YAxis.Scale.IsVisible = true;

            pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;


            //var pointsCurve;
            pane.XAxis.Scale.TextLabels = timeLine.Select(i => i.Date).ToArray();
            pane.XAxis.Type             = ZedGraph.AxisType.Text;

            List <double> pointVal1 = new List <double>();
            List <double> pointVal2 = new List <double>();

            int index = 0;

            foreach (var item in timeLine)
            {
                pointVal1.Add(0);
                pointVal2.Add(0);

                if (item.ConfirmQuantity != null)
                {
                    pointVal1[index] = (double)item.ConfirmQuantity;
                }

                if (item.TotalCutTime != null)
                {
                    pointVal2[index] = (double)item.TotalCutTime;
                }

                index++;
            }

            LineItem ConfirmQty = pane.AddCurve("Confirm Quantity", null, pointVal1.ToArray(), Color.DarkRed, SymbolType.VDash);
            LineItem CutTimes   = pane.AddCurve("Cut Times", null, pointVal2.ToArray(), Color.Blue, SymbolType.Plus);

            ConfirmQty.Line.IsVisible = true;
            ConfirmQty.Line.Width     = 1.0F;
            //Create your own scale of colors.

            ConfirmQty.Symbol.Fill             = new Fill(new System.Drawing.Color[] { Color.DarkRed, Color.DarkRed, Color.DarkRed });
            ConfirmQty.Symbol.Fill.Type        = FillType.Solid;
            ConfirmQty.Symbol.Type             = SymbolType.Circle;
            ConfirmQty.Symbol.Border.IsVisible = true;

            CutTimes.Line.IsVisible          = true;
            CutTimes.Line.Width              = 1.0F;
            CutTimes.Symbol.Fill             = new Fill(new Color[] { Color.Blue, Color.Blue, Color.Blue });
            CutTimes.Symbol.Fill.Type        = FillType.Solid;
            CutTimes.Symbol.Type             = SymbolType.Diamond;
            CutTimes.Symbol.Border.IsVisible = true;

            pane.AxisChange();
            ZedGraphControl.Refresh();
            panel2.Controls.Clear();
            this.panel2.Controls.Add(ZedGraphControl);
            ZedGraphControl.Dock = DockStyle.Fill;
            ZedGraphControl.BringToFront();
        }