Rock.Model.DiscService.PlotOneGraph C# (CSharp) Method

PlotOneGraph() public static method

Plots the one DISC graph.
public static PlotOneGraph ( System barD, System barI, System barS, System barC, int scoreD, int scoreI, int scoreS, int scoreC, int maxScale ) : void
barD System The D bar.
barI System The I bar.
barS System The S bar.
barC System The C bar.
scoreD int The D score.
scoreI int The I score.
scoreS int The S score.
scoreC int The C score.
maxScale int Highest score which is used for the scale of the chart.
return void
        public static void PlotOneGraph( System.Web.UI.HtmlControls.HtmlGenericControl barD, System.Web.UI.HtmlControls.HtmlGenericControl barI, 
            System.Web.UI.HtmlControls.HtmlGenericControl barS, System.Web.UI.HtmlControls.HtmlGenericControl barC,
            int scoreD, int scoreI, int scoreS, int scoreC, int maxScale )
        {
            barD.RemoveCssClass( "discbar-primary" );
            barI.RemoveCssClass( "discbar-primary" );
            barS.RemoveCssClass( "discbar-primary" );
            barC.RemoveCssClass( "discbar-primary" );

            // find the max value
            var maxScore = barD;
            var maxValue = scoreD;
            if ( scoreI > maxValue )
            {
                maxScore = barI;
                maxValue = scoreI;
            }
            if ( scoreS > maxValue )
            {
                maxScore = barS;
                maxValue = scoreS;
            }
            if ( scoreC > maxValue )
            {
                maxScore = barC;
                maxValue = scoreC;
            }
            maxScore.AddCssClass( "discbar-primary" );
            var score = Math.Floor( (double)( (double)scoreD / (double)maxScale ) * 100 ).ToString();
            barD.Style.Add( "height", score + "%" );
            barD.Attributes["title"] = scoreD.ToString();

            score = Math.Floor( (double)( (double)scoreI / (double)maxScale ) * 100 ).ToString();
            barI.Style.Add( "height", score + "%" );
            barI.Attributes["title"] = scoreI.ToString();

            score = Math.Floor( (double)( (double)scoreS / (double)maxScale ) * 100 ).ToString();
            barS.Style.Add( "height", score + "%" );
            barS.Attributes["title"] = scoreS.ToString();

            score = Math.Floor( (double)( (double)scoreC / (double)maxScale ) * 100 ).ToString();
            barC.Style.Add( "height", score + "%" );
            barC.Attributes["title"] = scoreC.ToString();
        }
        #endregion