/// <summary> /// Set a data bar formatting with built-in types. /// </summary> /// <param name="DataBar">A built-in data bar type.</param> public void SetDataBar(SLConditionalFormatDataBarValues DataBar) { SLDataBarOptions dbo = new SLDataBarOptions(DataBar, false); this.SetCustomDataBar(dbo); }
/// <summary> /// Set a custom data bar formatting. /// </summary> /// <param name="ShowBarOnly">True to show only the data bar. False to show both data bar and value.</param> /// <param name="MinLength">The minimum length of the data bar as a percentage of the cell width. The default value is 10.</param> /// <param name="MaxLength">The maximum length of the data bar as a percentage of the cell width. The default value is 90.</param> /// <param name="ShortestBarType">The conditional format type for the shortest bar.</param> /// <param name="ShortestBarValue">The value for the shortest bar. If <paramref name="ShortestBarType"/> is Value, you can just set this to "0".</param> /// <param name="LongestBarType">The conditional format type for the longest bar.</param> /// <param name="LongestBarValue">The value for the longest bar. If <paramref name="LongestBarType"/> is Value, you can just set this to "0".</param> /// <param name="BarColor">The theme color to be used for the data bar.</param> /// <param name="Tint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param> public void SetCustomDataBar(bool ShowBarOnly, uint MinLength, uint MaxLength, SLConditionalFormatMinMaxValues ShortestBarType, string ShortestBarValue, SLConditionalFormatMinMaxValues LongestBarType, string LongestBarValue, SLThemeColorIndexValues BarColor, double Tint) { SLDataBarOptions dbo = new SLDataBarOptions(false); dbo.ShowBarOnly = ShowBarOnly; dbo.MinLength = MinLength; dbo.MaxLength = MaxLength; dbo.MinimumType = this.TranslateMinMaxValues(ShortestBarType); dbo.MinimumValue = ShortestBarValue; dbo.MaximumType = this.TranslateMinMaxValues(LongestBarType); dbo.MaximumValue = LongestBarValue; dbo.FillColor.SetThemeColor(BarColor, Tint); this.SetCustomDataBar(dbo); }
/// <summary> /// Set a custom data bar formatting. /// </summary> /// <param name="Options">Data bar options.</param> public void SetCustomDataBar(SLDataBarOptions Options) { SLConditionalFormattingRule cfr = new SLConditionalFormattingRule(); cfr.Type = ConditionalFormatValues.DataBar; cfr.DataBar.Is2010 = Options.Is2010; cfr.DataBar.MinimumType = Options.MinimumType; cfr.DataBar.MinimumValue = Options.MinimumValue; cfr.DataBar.MaximumType = Options.MaximumType; cfr.DataBar.MaximumValue = Options.MaximumValue; cfr.DataBar.Color = Options.FillColor.Clone(); cfr.DataBar.BorderColor = Options.BorderColor.Clone(); cfr.DataBar.NegativeFillColor = Options.NegativeFillColor.Clone(); cfr.DataBar.NegativeBorderColor = Options.NegativeBorderColor.Clone(); cfr.DataBar.AxisColor = Options.AxisColor.Clone(); cfr.DataBar.MinLength = Options.MinLength; cfr.DataBar.MaxLength = Options.MaxLength; cfr.DataBar.ShowValue = !Options.ShowBarOnly; cfr.DataBar.Border = Options.Border; cfr.DataBar.Gradient = Options.Gradient; cfr.DataBar.Direction = Options.Direction; cfr.DataBar.NegativeBarColorSameAsPositive = Options.NegativeBarColorSameAsPositive; cfr.DataBar.NegativeBarBorderColorSameAsPositive = Options.NegativeBarBorderColorSameAsPositive; cfr.DataBar.AxisPosition = Options.AxisPosition; cfr.HasDataBar = true; this.AppendRule(cfr); }
/// <summary> /// Set a custom data bar formatting. /// </summary> /// <param name="ShowBarOnly">True to show only the data bar. False to show both data bar and value.</param> /// <param name="MinLength">The minimum length of the data bar as a percentage of the cell width. The default value is 10.</param> /// <param name="MaxLength">The maximum length of the data bar as a percentage of the cell width. The default value is 90.</param> /// <param name="ShortestBarType">The conditional format type for the shortest bar.</param> /// <param name="ShortestBarValue">The value for the shortest bar. If <paramref name="ShortestBarType"/> is Value, you can just set this to "0".</param> /// <param name="LongestBarType">The conditional format type for the longest bar.</param> /// <param name="LongestBarValue">The value for the longest bar. If <paramref name="LongestBarType"/> is Value, you can just set this to "0".</param> /// <param name="BarColor">The color of the data bar.</param> public void SetCustomDataBar(bool ShowBarOnly, uint MinLength, uint MaxLength, SLConditionalFormatMinMaxValues ShortestBarType, string ShortestBarValue, SLConditionalFormatMinMaxValues LongestBarType, string LongestBarValue, System.Drawing.Color BarColor) { SLDataBarOptions dbo = new SLDataBarOptions(false); dbo.ShowBarOnly = ShowBarOnly; dbo.MinLength = MinLength; dbo.MaxLength = MaxLength; dbo.MinimumType = this.TranslateMinMaxValues(ShortestBarType); dbo.MinimumValue = ShortestBarValue; dbo.MaximumType = this.TranslateMinMaxValues(LongestBarType); dbo.MaximumValue = LongestBarValue; dbo.FillColor.Color = BarColor; this.SetCustomDataBar(dbo); }