Exemple #1
0
        public Panel createGoalBox(measure m, string CompleteID)
        {
            Panel max_panel = new Panel()
            {
                TabIndex = 1, ID = "GoalPanel2~" + CompleteID, CssClass = "maxValue goalbox_Container col-6 col-sm-3 order-2 order-sm-3"
            };
            //Panel max_panel = new Panel() { TabIndex = 1, ID = "GoalPanel2~" + CompleteID, CssClass = "maxValue goalbox_Container col-6 col-sm-3 order-2 order-sm-3" };
            Panel goal_panel = new Panel()
            {
                TabIndex = 1, ID = "GoalPanel~" + CompleteID, CssClass = " maxlabel"
            };
            TextBox goal_box = new TextBox()
            {
                ID = "Goal_tb~" + CompleteID, CssClass = "d-none goalbox", Text = fixPercentages(m.goal.ToString()), Enabled = false
            };
            Label goal_box_lbl = new Label()
            {
                ID = "Goal_lbl~" + CompleteID, CssClass = "goalboxLbl", Text = addsymbol(m.goal.ToString()), Enabled = false
            };

            goal_box.Attributes.Add("Type", "number");
            goal_panel.Controls.Add(goal_box_lbl);
            goal_panel.Controls.Add(goal_box);
            max_panel.Controls.Add(goal_panel);

            return(max_panel);
        }
Exemple #2
0
        public Panel createMinLabel(measure m)
        {
            // Panel min_panel = new Panel() { CssClass = "col-6 col-sm-2 minValue order-1" }; // add some media query magic to make this move
            Panel min_panel = new Panel()
            {
                CssClass = "col-6 col-sm-2 minValue order-2 order-sm-1"
            };
            Panel min_panel_inner = new Panel()
            {
                CssClass = "minlabel"
            };


            //MOVE THIS TO CLASS
            double lowvalue;

            if (m.lowgoal && unittype.ToUpper() == "PERCENTAGE")
            {
                lowvalue = 100;
            }
            else
            {
                lowvalue = 0;
            }
            Label min_lbl = new Label()
            {
                Text = addsymbol(lowvalue.ToString())
            };

            min_panel.Controls.Add(min_panel_inner);
            min_panel_inner.Controls.Add(min_lbl);

            return(min_panel);
        }
Exemple #3
0
        public Panel CreateValue(measure m, double percentofGoal, string CSSClassName, bool positioning = true)
        {
            // value in text
            Panel value_panel = new Panel()
            {
                CssClass = CSSClassName
            };
            Panel value_panel_inner = new Panel()
            {
            };

            value_panel_inner.Style.Add("Position", "Absolute");
            if (positioning)
            {
                value_panel_inner.Style.Add("Left", percentofGoal.ToString() + "%");
                value_panel_inner.Style.Add("transform", "translateX(-" + percentofGoal.ToString() + "%)");
            }
            //value_panel_inner.Style.Add("Top", formatMeasure(BAR_HEIGHT+2));

            Label value_lbl = new Label()
            {
                Text = addsymbol(m.value.ToString())
            };                                                                     //,CssClass = CSSClassName };

            value_panel_inner.Controls.Add(value_lbl);
            value_panel.Controls.Add(value_panel_inner);

            //value_lbl.Attributes.Add("contenteditable", "true");
            //contenteditable

            return(value_panel);
        }
Exemple #4
0
        public Panel CreateLine(measure m, double percentofGoal)
        {
            Panel line_panel = new Panel()
            {
                CssClass = "line"
            };

            line_panel.Style.Add("Left", percentofGoal.ToString() + "%");
            line_panel.Style.Add("height", formatMeasure(BAR_HEIGHT + 4));

            return(line_panel);
        }
Exemple #5
0
        public Panel createLabel(measure m, string CompleteID)
        {
            Panel metricLabel_panel = new Panel()
            {
                CssClass = "col-sm-4 metricLabel", ID = "LabelPanel~" + CompleteID
            };
            Label label_lbl = new Label()
            {
                Text = name
            };                                            // +" " + m.ID };

            metricLabel_panel.Controls.Add(label_lbl);

            return(metricLabel_panel);
            //metricInner_panel_inner.Controls.Add(metricLabel_panel);
        }
Exemple #6
0
        //for compare one measure with anothers goals
        public double GetPercentOfGoal(measure m, measure otherM)
        {
            float  lowvalue      = 0;
            double percentofGoal = (m.value / otherM.goal) * 100;

            if (otherM.lowgoal && unittype.ToUpper() == "PERCENTAGE")
            {
                lowvalue = 1;
            }
            else
            {
                lowvalue = 0;
            }
            if (otherM.lowgoal)
            {
                percentofGoal = (lowvalue - otherM.goal - m.value);
            }
            percentofGoal = Math.Min(percentofGoal, 100);
            percentofGoal = Math.Max(percentofGoal, 0);
            return(percentofGoal);
        }
Exemple #7
0
        public Panel createBarOutSide(measure m, string CompleteID)
        {
            // outside bar container
            // Panel barbox = new Panel() { CssClass = "col-sm-7 MetricContainouter order-3 order-sm-2 ", ID = "MeasurePanel2~" + CompleteID };
            Panel barbox = new Panel()
            {
                CssClass = "col-sm-7 MetricContainouter order-1 order-sm-2 ", ID = "MeasurePanel2~" + CompleteID
            };

            barbox.Style.Add("height", formatMeasure(BAR_HEIGHT));


            for (int i = 5; i < 100; i += 5)
            {
                LiteralControl lineC      = new LiteralControl(@"<svg> <line x1='0' y1='0' x2='0' y2='20' style='stroke: rgb(0, 0, 0); stroke - width:10' /> </svg>");
                Panel          linemarker = new Panel()
                {
                    CssClass = "line50"
                };
                linemarker.Style.Add("Left", i.ToString() + "%");
                linemarker.Style.Add("height", "20%");

                if (i % 25 == 0)
                {
                    linemarker.Style.Add("height", "35%");
                }
                if (i % 50 == 0)
                {
                    linemarker.Style.Add("height", "60%");
                }

                linemarker.Style.Add("bottom", formatMeasure(-1));
                linemarker.Controls.Add(lineC);
                barbox.Controls.Add(linemarker);
            }


            return(barbox);
        }
Exemple #8
0
        public void SetValue(string scope, double value)
        {
            measure tempMeasure = measures.Find(x => x.scope == scope);

            tempMeasure.value = value;
        }
Exemple #9
0
        //public void addMeasure(string name, string MetricID, string calc, string unittype, string scope)
        //{
        //    addMeasure(scope, new metric(name, MetricID, calc, unittype, scope));
        //}

        //public void addMeasure(string scope,metric m)
        //{
        //    if (measures.ContainsKey(scope))
        //    {
        //        measures[scope].Add(m);
        //    }
        //    else
        //    {
        //        measures.Add(scope, new List<metric>());
        //        measures[scope].Add(m);
        //    }
        //}

        public void SetGoal(string scope, double goal)
        {
            measure tempMeasure = measures.Find(x => x.scope == scope);

            tempMeasure.goal = goal;
        }
Exemple #10
0
        public void CreateTileALT(string IDPrefix, Panel BIN, string neededScope)
        {
            foreach (measure m in measures)
            {
                string CompleteID = IDPrefix + "^" + MetricID + "^" + m.goalID;
                if (neededScope.ToUpper() != m.scope.ToUpper() || m.scope.ToUpper() == "ALL")
                {
                    //ignore the scopes we don't want.
                    continue;
                }


                double percentOfGoal, L_percentOfGoal = 0;
                percentOfGoal = GetPercentOfGoal(m);
                measure Lastm = getFromScope("L_" + neededScope);
                if (Lastm != null)
                {
                    L_percentOfGoal = GetPercentOfGoal(Lastm, m);
                }

                // creates the outside "shell"
                Panel OuterShell_Panel2 = new Panel()
                {
                    CssClass = "measure_outer col-12", ID = "Outer~" + CompleteID
                };
                Panel OuterShell_Panel1 = new Panel()
                {
                    CssClass = "measure_inner container-fluid", ID = "Inner~" + CompleteID
                };
                Panel InnerShell_Panel1 = new Panel()
                {
                    CssClass = "measure_inner_inner row no-gutters", ID = "asd" + CompleteID
                };
                OuterShell_Panel2.Controls.Add(OuterShell_Panel1);
                OuterShell_Panel1.Controls.Add(InnerShell_Panel1);


                InnerShell_Panel1.Controls.Add(createLabel(m, CompleteID));

                Panel measureboxOuter_Panel = new Panel()
                {
                    CssClass = "col-sm-8 container-fluid"
                };
                Panel measureboxInner_Panel = new Panel()
                {
                    CssClass = "row no-gutters measureBoxInner"
                };
                measureboxOuter_Panel.Controls.Add(measureboxInner_Panel);

                InnerShell_Panel1.Controls.Add(measureboxOuter_Panel);

                //measurebar and labels
                measureboxInner_Panel.Controls.Add(createMinLabel(m));

                Panel BarOutSide = createBarOutSide(m, CompleteID);
                measureboxInner_Panel.Controls.Add(BarOutSide);


                Panel measureBox = CreatreMeasureBoxBar(CompleteID);
                measureBox.Controls.Add(CreateBarScores(percentOfGoal, "bar"));

                BarOutSide.Controls.Add(CreateValue(m, percentOfGoal, "value1"));
                BarOutSide.Controls.Add(measureBox);


                //if (Lastm != null)
                //{
                //    Panel bar2 = CreateBarScores(L_percentOfGoal, "bar2", 1);
                //    bar2.Controls.Add(CreateValue(Lastm, L_percentOfGoal, "value2",false));
                //    measureBox.Controls.Add(bar2);
                //    //BarOutSide.Controls.AddAt(0,CreateValue(Lastm, L_percentOfGoal, "value2"));

                //}

                BarOutSide.Controls.Add(CreateLine(m, percentOfGoal));



                measureboxInner_Panel.Controls.Add(createGoalBox(m, CompleteID));

                BIN.Controls.Add(OuterShell_Panel2);
            }
        }