Esempio n. 1
0
        public string Render()
        {
            var dir = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            var p   = Path.Combine(dir, @"neatchartstemplates\svg.html");

            var HTML       = File.ReadAllText(p);
            var ShadowHTML = String.Empty;
            var FillHTML   = String.Empty;

            if (HasShadow)
            {
                p          = Path.Combine(dir, @"neatchartstemplates\shadow.html");
                ShadowHTML = File.ReadAllText(p);
                ShadowHTML = ShadowHTML.Replace("shadow", Shadow);
                FilterHtml = "filter=\"url(#shadow)\"";
            }

            if (Filled)
            {
                p = Path.Combine(dir, @"neatchartstemplates\fill.html");

                FillHTML = File.ReadAllText(p);
                FillHTML = FillHTML
                           .Replace("{{width}}", Width.ToString())
                           .Replace("{{height}}", Height.ToString())
                           .Replace("{{origHeight}}", _origHeight.ToString())
                           .Replace("{{origWidth}}", _origWidth.ToString())
                           .Replace("{{chartPoints}}", ChartPointsHtml)
                           .Replace("{{chartId}}", Id);
            }

            if (YAxisEnabled || XAxisEnabled)
            {
            }

            HTML = HTML
                   .Replace("{{leftPadding}}", PaddingLeft.ToString())
                   .Replace("{{topPadding}}", PaddingTop.ToString())
                   .Replace("{{width}}", Width.ToString())
                   .Replace("{{height}}", Height.ToString())
                   .Replace("{{origHeight}}", _origHeight.ToString())
                   .Replace("{{origWidth}}", _origWidth.ToString())
                   .Replace("{{markerColor}}", MarkerColor)
                   .Replace("{{lineColor}}", LineColor)
                   .Replace("{{filter}}", FilterHtml)
                   .Replace("{{gridLabels}}", LabelHtml)
                   .Replace("{{fontSize}}", FontSize.ToString())
                   .Replace("{{shadow}}", Shadow)
                   .Replace("{{chartPoints}}", ChartPointsHtml)
                   .Replace("{{chartId}}", Id)
                   .Replace("{{shadowHtml}}", ShadowHTML)
                   .Replace("{{filter}}", FilterHtml)
                   .Replace("{{oneThirdFont}}", (FontSize / 3).ToString())
                   .Replace("{{fillHtml}}", FillHTML);

            return(HTML);
        }
Esempio n. 2
0
        public void WriteXml(XmlWriter writer)
        {
            TypeConverter ffc = TypeDescriptor.GetConverter(typeof(FontFamily));
            TypeConverter fsc = TypeDescriptor.GetConverter(typeof(FontStyle));
            TypeConverter fwc = TypeDescriptor.GetConverter(typeof(FontWeight));
            TypeConverter rc  = TypeDescriptor.GetConverter(typeof(Rect));

            writer.WriteElementString("FontFamily", ffc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontFamily));
            writer.WriteElementString("FontStyle", fsc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontStyle));
            writer.WriteElementString("FontWeight", fwc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontWeight));
            writer.WriteElementString("FontSize", FontSize.ToString(CultureInfo.InvariantCulture));

            writer.WriteElementString("HorizontalAlignment", HorizontalAlignment.ToString());
            writer.WriteElementString("VerticalAlignment", VerticalAlignment.ToString());

            writer.WriteStartElement("Padding");
            writer.WriteElementString("Left", PaddingLeft.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Top", PaddingTop.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Right", PaddingRight.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("Bottom", PaddingBottom.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            if (Decorations.HasFlag(Helios.TextDecorations.Underline))
            {
                writer.WriteStartElement("Underline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Strikethrough))
            {
                writer.WriteStartElement("Strikethrough");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.Baseline))
            {
                writer.WriteStartElement("Baseline");
                writer.WriteEndElement();
            }

            if (Decorations.HasFlag(Helios.TextDecorations.OverLine))
            {
                writer.WriteStartElement("OverLine");
                writer.WriteEndElement();
            }
        }
Esempio n. 3
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if (PaddingTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
            }
            if (PaddingLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
            }
            if (PaddingRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString());
            }
            if (PaddingBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString());
            }

            if (MarginTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString());
            }
            if (MarginLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString());
            }
            if (MarginRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString());
            }
            if (MarginBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString());
            }

            if (!String.IsNullOrEmpty(BackImageUrl))
            {
                attributes.Add(HtmlTextWriterStyle.BackgroundImage, String.Format("url({0})", urlResolver.ResolveClientUrl(BackImageUrl)));
            }
        }
Esempio n. 4
0
 protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
 {
     base.FillStyleAttributes(attributes, urlResolver);
     attributes["float"] = "left";
     if (!PaddingTop.IsEmpty)
     {
         attributes[HtmlTextWriterStyle.PaddingTop] = PaddingTop.ToString();
     }
     else
     {
         attributes[HtmlTextWriterStyle.PaddingTop] = "5px";
     }
     if (!PaddingLeft.IsEmpty)
     {
         attributes[HtmlTextWriterStyle.PaddingLeft] = PaddingLeft.ToString();
     }
     else
     {
         attributes[HtmlTextWriterStyle.PaddingLeft] = "5px";
     }
 }
Esempio n. 5
0
 public override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebControl owner)
 {
     base.AddAttributesToRender(writer, owner);
     writer.AddStyleAttribute("float", "left");
     if (!PaddingTop.IsEmpty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
     }
     else
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "5px");
     }
     if (!PaddingLeft.IsEmpty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
     }
     else
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "5px");
     }
 }
Esempio n. 6
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            base.FillStyleAttributes(attributes, urlResolver);

            if (PaddingTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString());
            }
            if (PaddingLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString());
            }
            if (PaddingRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString());
            }
            if (PaddingBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString());
            }

            if (MarginTop != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString());
            }
            if (MarginLeft != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString());
            }
            if (MarginRight != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString());
            }
            if (MarginBottom != Unit.Empty)
            {
                attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString());
            }
        }