Example #1
0
        private LegendLayout ComputeLegendLayout(Layout _l)
        {
            var leftpadding   = 3 * _l.em; /* the distance where there is place for the connecting lines */
            var yspacepadding = 0.5F * _l.em;
            var ysize         = 3.0F * _l.em;
            var _ll           = new LegendLayout()
            {
                YStride = ysize + yspacepadding
            };
            var computedheight = _data.Series.Count * _ll.YStride;
            var centeredtop    = _l.bb_Legend.Top + (_l.bb_Legend.Height - computedheight) / 2;

            _ll.Boundingbox = new RectangleF(_l.bb_Legend.Left + leftpadding, centeredtop, _l.bb_Legend.Width - leftpadding - _l.em_2, computedheight);
            int si          = 0;
            var outlines    = new List <RectangleF>();
            var layoutrects = new List <Rectangle>();
            var connexs     = new List <PointF>();

            foreach (var seri in _data.Series)
            {
                var outline = new RectangleF(_ll.Boundingbox.Left, centeredtop + si * _ll.YStride, _ll.Boundingbox.Width, ysize);
                outlines.Add(outline);
                layoutrects.Add(new Rectangle((int)(outline.Left + _l.em_2), (int)(outline.Top + _l.em_2 / 2), (int)(outline.Width - _l.em_2), (int)(outline.Height - _l.em_2)));
                connexs.Add(new PointF(outline.Left, outline.Top + ysize / 2));
                ++si;
            }
            /* deliver */
            _ll.Outline       = outlines.ToArray();
            _ll.Textcontainer = layoutrects.ToArray();
            _ll.Connector     = connexs.ToArray();
            return(_ll);
        }
 public LegendConfigurator Layout(LegendLayout layout)
 {
     this.legend.Layout = layout;
     return this;
 }
Example #3
0
 public LegendConfigurator Layout(LegendLayout layout)
 {
     this.legend.Layout = layout;
     return(this);
 }
Example #4
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtables = new Hashtable();

            if (this.Align != this.Align_DefaultValue)
            {
                LegendAlign align = this.Align;
                hashtables.Add("align", Highcharts.FirstCharacterToLower(align.ToString()));
            }
            if (this.BackgroundColor != this.BackgroundColor_DefaultValue)
            {
                hashtables.Add("backgroundColor", this.BackgroundColor);
            }
            if (this.BorderColor != this.BorderColor_DefaultValue)
            {
                hashtables.Add("borderColor", this.BorderColor);
            }
            double?borderRadius             = this.BorderRadius;
            double?borderRadiusDefaultValue = this.BorderRadius_DefaultValue;

            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("borderRadius", this.BorderRadius);
            }
            borderRadiusDefaultValue = this.BorderWidth;
            borderRadius             = this.BorderWidth_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("borderWidth", this.BorderWidth);
            }
            bool?enabled             = this.Enabled;
            bool?enabledDefaultValue = this.Enabled_DefaultValue;

            if ((enabled.GetValueOrDefault() == enabledDefaultValue.GetValueOrDefault() ? enabled.HasValue != enabledDefaultValue.HasValue : true))
            {
                hashtables.Add("enabled", this.Enabled);
            }
            enabledDefaultValue = this.Floating;
            enabled             = this.Floating_DefaultValue;
            if ((enabledDefaultValue.GetValueOrDefault() == enabled.GetValueOrDefault() ? enabledDefaultValue.HasValue != enabled.HasValue : true))
            {
                hashtables.Add("floating", this.Floating);
            }
            borderRadius             = this.ItemDistance;
            borderRadiusDefaultValue = this.ItemDistance_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("itemDistance", this.ItemDistance);
            }
            if (this.ItemHiddenStyle != this.ItemHiddenStyle_DefaultValue)
            {
                hashtables.Add("itemHiddenStyle", this.ItemHiddenStyle);
            }
            if (this.ItemHoverStyle != this.ItemHoverStyle_DefaultValue)
            {
                hashtables.Add("itemHoverStyle", this.ItemHoverStyle);
            }
            borderRadiusDefaultValue = this.ItemMarginBottom;
            borderRadius             = this.ItemMarginBottom_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("itemMarginBottom", this.ItemMarginBottom);
            }
            borderRadius             = this.ItemMarginTop;
            borderRadiusDefaultValue = this.ItemMarginTop_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("itemMarginTop", this.ItemMarginTop);
            }
            if (this.ItemStyle != this.ItemStyle_DefaultValue)
            {
                hashtables.Add("itemStyle", this.ItemStyle);
            }
            borderRadiusDefaultValue = this.ItemWidth;
            borderRadius             = this.ItemWidth_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("itemWidth", this.ItemWidth);
            }
            if (this.LabelFormat != this.LabelFormat_DefaultValue)
            {
                hashtables.Add("labelFormat", this.LabelFormat);
            }
            if (this.LabelFormatter != this.LabelFormatter_DefaultValue)
            {
                hashtables.Add("labelFormatter", this.LabelFormatter);
                Highcharts.AddFunction("LegendLabelFormatter.labelFormatter", this.LabelFormatter);
            }
            if (this.Layout != this.Layout_DefaultValue)
            {
                LegendLayout layout = this.Layout;
                hashtables.Add("layout", Highcharts.FirstCharacterToLower(layout.ToString()));
            }
            borderRadius             = this.LineHeight;
            borderRadiusDefaultValue = this.LineHeight_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("lineHeight", this.LineHeight);
            }
            if (this.Margin != this.Margin_DefaultValue)
            {
                hashtables.Add("margin", this.Margin);
            }
            borderRadiusDefaultValue = this.MaxHeight;
            borderRadius             = this.MaxHeight_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("maxHeight", this.MaxHeight);
            }
            if (this.Navigation.IsDirty())
            {
                hashtables.Add("navigation", this.Navigation.ToHashtable());
            }
            borderRadius             = this.Padding;
            borderRadiusDefaultValue = this.Padding_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("padding", this.Padding);
            }
            enabled             = this.Reversed;
            enabledDefaultValue = this.Reversed_DefaultValue;
            if ((enabled.GetValueOrDefault() == enabledDefaultValue.GetValueOrDefault() ? enabled.HasValue != enabledDefaultValue.HasValue : true))
            {
                hashtables.Add("reversed", this.Reversed);
            }
            enabledDefaultValue = this.Rtl;
            enabled             = this.Rtl_DefaultValue;
            if ((enabledDefaultValue.GetValueOrDefault() == enabled.GetValueOrDefault() ? enabledDefaultValue.HasValue != enabled.HasValue : true))
            {
                hashtables.Add("rtl", this.Rtl);
            }
            if (this.Shadow != this.Shadow_DefaultValue)
            {
                hashtables.Add("shadow", this.Shadow);
            }
            enabled             = this.SquareSymbol;
            enabledDefaultValue = this.SquareSymbol_DefaultValue;
            if ((enabled.GetValueOrDefault() == enabledDefaultValue.GetValueOrDefault() ? enabled.HasValue != enabledDefaultValue.HasValue : true))
            {
                hashtables.Add("squareSymbol", this.SquareSymbol);
            }
            borderRadiusDefaultValue = this.SymbolHeight;
            borderRadius             = this.SymbolHeight_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("symbolHeight", this.SymbolHeight);
            }
            borderRadius             = this.SymbolPadding;
            borderRadiusDefaultValue = this.SymbolPadding_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("symbolPadding", this.SymbolPadding);
            }
            borderRadiusDefaultValue = this.SymbolRadius;
            borderRadius             = this.SymbolRadius_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("symbolRadius", this.SymbolRadius);
            }
            borderRadius             = this.SymbolWidth;
            borderRadiusDefaultValue = this.SymbolWidth_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("symbolWidth", this.SymbolWidth);
            }
            if (this.Title.IsDirty())
            {
                hashtables.Add("title", this.Title.ToHashtable());
            }
            enabledDefaultValue = this.UseHTML;
            enabled             = this.UseHTML_DefaultValue;
            if ((enabledDefaultValue.GetValueOrDefault() == enabled.GetValueOrDefault() ? enabledDefaultValue.HasValue != enabled.HasValue : true))
            {
                hashtables.Add("useHTML", this.UseHTML);
            }
            if (this.VerticalAlign != this.VerticalAlign_DefaultValue)
            {
                LegendVerticalAlign verticalAlign = this.VerticalAlign;
                hashtables.Add("verticalAlign", Highcharts.FirstCharacterToLower(verticalAlign.ToString()));
            }
            borderRadiusDefaultValue = this.Width;
            borderRadius             = this.Width_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("width", this.Width);
            }
            borderRadius             = this.X;
            borderRadiusDefaultValue = this.X_DefaultValue;
            if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true))
            {
                hashtables.Add("x", this.X);
            }
            borderRadiusDefaultValue = this.Y;
            borderRadius             = this.Y_DefaultValue;
            if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true))
            {
                hashtables.Add("y", this.Y);
            }
            return(hashtables);
        }
Example #5
0
        public Legend()
        {
            int         num         = 1;
            LegendAlign legendAlign = (LegendAlign)num;

            this.Align_DefaultValue = (LegendAlign)num;
            this.Align = legendAlign;
            object obj = null;
            string str = (string)obj;

            this.BackgroundColor_DefaultValue = (string)obj;
            this.BackgroundColor = str;
            string str1 = "#999999";

            str = str1;
            this.BorderColor_DefaultValue = str1;
            this.BorderColor = str;
            double?nullable = new double?(0);

            this.BorderRadius_DefaultValue = nullable;
            this.BorderRadius             = nullable;
            nullable                      = new double?(0);
            this.BorderWidth_DefaultValue = nullable;
            this.BorderWidth              = nullable;
            bool?nullable1 = new bool?(true);

            this.Enabled_DefaultValue = nullable1;
            this.Enabled = nullable1;
            nullable1    = new bool?(false);
            this.Floating_DefaultValue = nullable1;
            this.Floating = nullable1;
            nullable      = new double?((double)20);
            this.ItemDistance_DefaultValue = nullable;
            this.ItemDistance = nullable;
            Hashtable hashtables = new Hashtable()
            {
                { "color", "#cccccc" }
            };
            Hashtable hashtables1 = hashtables;
            Hashtable hashtables2 = hashtables1;

            this.ItemHiddenStyle_DefaultValue = hashtables1;
            this.ItemHiddenStyle = hashtables2;
            hashtables           = new Hashtable()
            {
                { "color", "#000000" }
            };
            Hashtable hashtables3 = hashtables;

            hashtables2 = hashtables3;
            this.ItemHoverStyle_DefaultValue = hashtables3;
            this.ItemHoverStyle = hashtables2;
            nullable            = new double?(0);
            this.ItemMarginBottom_DefaultValue = nullable;
            this.ItemMarginBottom = nullable;
            nullable = new double?(0);
            this.ItemMarginTop_DefaultValue = nullable;
            this.ItemMarginTop = nullable;
            hashtables         = new Hashtable()
            {
                { "color", "#333333" },
                { "cursor", "pointer" },
                { "fontSize", "12px" },
                { "fontWeight", "bold" }
            };
            Hashtable hashtables4 = hashtables;

            hashtables2 = hashtables4;
            this.ItemStyle_DefaultValue = hashtables4;
            this.ItemStyle = hashtables2;
            nullable       = null;
            this.ItemWidth_DefaultValue = nullable;
            this.ItemWidth = nullable;
            string str2 = "{name}";

            str = str2;
            this.LabelFormat_DefaultValue = str2;
            this.LabelFormat = str;
            string str3 = "";

            str = str3;
            this.LabelFormatter_DefaultValue = str3;
            this.LabelFormatter = str;
            int          num1         = 0;
            LegendLayout legendLayout = (LegendLayout)num1;

            this.Layout_DefaultValue = (LegendLayout)num1;
            this.Layout = legendLayout;
            nullable    = new double?((double)16);
            this.LineHeight_DefaultValue = nullable;
            this.LineHeight = nullable;
            string[] strArrays  = new string[0];
            string[] strArrays1 = strArrays;
            this.Margin_DefaultValue = strArrays;
            this.Margin = strArrays1;
            nullable    = null;
            this.MaxHeight_DefaultValue = nullable;
            this.MaxHeight = nullable;
            LegendNavigation legendNavigation  = new LegendNavigation();
            LegendNavigation legendNavigation1 = legendNavigation;

            this.Navigation_DefaultValue = legendNavigation;
            this.Navigation            = legendNavigation1;
            nullable                   = new double?((double)8);
            this.Padding_DefaultValue  = nullable;
            this.Padding               = nullable;
            nullable1                  = new bool?(false);
            this.Reversed_DefaultValue = nullable1;
            this.Reversed              = nullable1;
            nullable1                  = new bool?(false);
            this.Rtl_DefaultValue      = nullable1;
            this.Rtl                   = nullable1;
            Highsoft.Web.Mvc.Charts.Shadow shadow = new Highsoft.Web.Mvc.Charts.Shadow()
            {
                Enabled = false
            };
            Highsoft.Web.Mvc.Charts.Shadow shadow1 = shadow;
            this.Shadow_DefaultValue = shadow;
            this.Shadow = shadow1;
            nullable1   = new bool?(true);
            this.SquareSymbol_DefaultValue = nullable1;
            this.SquareSymbol = nullable1;
            nullable          = null;
            this.SymbolHeight_DefaultValue = nullable;
            this.SymbolHeight = nullable;
            nullable          = new double?((double)5);
            this.SymbolPadding_DefaultValue = nullable;
            this.SymbolPadding             = nullable;
            nullable                       = null;
            this.SymbolRadius_DefaultValue = nullable;
            this.SymbolRadius              = nullable;
            nullable                       = null;
            this.SymbolWidth_DefaultValue  = nullable;
            this.SymbolWidth               = nullable;
            LegendTitle legendTitle  = new LegendTitle();
            LegendTitle legendTitle1 = legendTitle;

            this.Title_DefaultValue = legendTitle;
            this.Title = legendTitle1;
            nullable1  = new bool?(false);
            this.UseHTML_DefaultValue = nullable1;
            this.UseHTML = nullable1;
            int num2 = 2;
            LegendVerticalAlign legendVerticalAlign = (LegendVerticalAlign)num2;

            this.VerticalAlign_DefaultValue = (LegendVerticalAlign)num2;
            this.VerticalAlign      = legendVerticalAlign;
            nullable                = null;
            this.Width_DefaultValue = nullable;
            this.Width              = nullable;
            nullable                = new double?(0);
            this.X_DefaultValue     = nullable;
            this.X              = nullable;
            nullable            = new double?(0);
            this.Y_DefaultValue = nullable;
            this.Y              = nullable;
        }
 public LegendConfigurator Layout(LegendLayout layout)
 {
     this.Set(new JsonAttribute("layout", layout));
     return this;
 }