private void ShowHideTab( bool show, System.Web.UI.HtmlControls.HtmlGenericControl control ) { if ( show ) { control.AddCssClass( "active" ); } else { control.RemoveCssClass( "active" ); } }
/// <summary> /// Plots the one DISC graph. /// </summary> /// <param name="barD">The D bar.</param> /// <param name="barI">The I bar.</param> /// <param name="barS">The S bar.</param> /// <param name="barC">The C bar.</param> /// <param name="scoreD">The D score.</param> /// <param name="scoreI">The I score.</param> /// <param name="scoreS">The S score.</param> /// <param name="scoreC">The C score.</param> /// <param name="maxScale">Highest score which is used for the scale of the chart.</param> 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(); }