private void PnlPerformancePercentage_PercentageChanged(object sender, PaintEventArgs e)
        {
            float x     = this.performanceChartArea.Position.X;
            Panel panel = (Panel)sender;

            double width = this.performanceChartArea.AxisX.GetPosition(1) * this.performanceChart.Width / 100 * 0.8;
            int    locY  = PERCENTAGE_GROUP_POSITION_Y + PERCENTAGE_RECT_HEIGHT;

            for (int index = 0; index < machineGroups[selectedMachineGroup].Count; index++)
            {
                OEEMachine machine = machineGroups[selectedMachineGroup].Machines[index];
                using (Font font = new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular))
                    using (SolidBrush realBrush = new SolidBrush(realColor), baseBrush = new SolidBrush(Color.Silver),
                           fontBrush = new SolidBrush(Color.White))
                    {
                        double locX  = this.performanceChartArea.Position.X + this.performanceChartArea.InnerPlotPosition.X + width;
                        double axisX = this.performanceChartArea.AxisX.GetPosition(index) * this.performanceChart.Width / 100;

                        locX += axisX;
                        float padding = ((float)width - e.Graphics.MeasureString(machine.Name, font).Width) / 2;
                        e.Graphics.DrawString(machine.Name, font, fontBrush, (float)locX + padding, PERCENTAGE_GROUP_POSITION_Y);

                        Rectangle baseRect = new Rectangle((int)locX, locY, (int)width, PERCENTAGE_RECT_HEIGHT);
                        e.Graphics.FillRectangle(baseBrush, baseRect);

                        double    percentage = performancePercentage[index];
                        Rectangle realRect   = new Rectangle((int)locX, locY, (int)(width * percentage), PERCENTAGE_RECT_HEIGHT);
                        e.Graphics.FillRectangle(realBrush, realRect);
                        locX += width + 3;
                        string value = Convert.ToString(Math.Round(percentage, 2) * 100) + "%";
                        e.Graphics.DrawString(value, font, fontBrush, (int)locX, locY);
                    }
            }
        }
Example #2
0
 private void CreateGroupMachines(string _name, OEETypes.GROUP_TYPE _type)
 {
     machines = new OEEMachine[_count];
     for (int i = 0; i < _count; i++)
     {
         machines[i] = new OEEMachine(i, _name, _type);
     }
 }