public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", series.Orientation == ChartSeriesOrientation.Horizontal ? "bar" : "column") .Add("stack", series.Stacked, () => series.Stacked == true && !series.StackName.HasValue()) .Add("stack", series.StackName, () => series.StackName.HasValue()) .Add("aggregate", series.Aggregate.ToString().ToLowerInvariant(), () => series.Aggregate != null) .Add("gap", series.Gap, () => series.Gap.HasValue) .Add("spacing", series.Spacing, () => series.Spacing.HasValue) .Add("field", series.Member, () => { return(series.Data == null && series.Member != null); }) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("border", series.Border.CreateSerializer().Serialize(), ShouldSerializeBorder) .Add("color", series.Color, () => series.Color.HasValue()) .Add("colorField", series.ColorMember, () => series.ColorMember.HasValue()); if (series.Overlay != null) { result.Add("overlay", series.Overlay.CreateSerializer().Serialize()); } var labelsData = series.Labels.CreateSerializer().Serialize(); if (labelsData.Count > 0) { result.Add("labels", labelsData); } return(result); }
private IDictionary <string, object> SerializePopUp() { var result = new Dictionary <string, object>(); var title = PopUp.Title ?? Messages.Grid_Edit; FluentDictionary.For(result) .Add("title", title) .Add("modal", PopUp.Modal) .Add("draggable", PopUp.Draggable) .Add("resizable", PopUp.ResizingSettings.Enabled) .Add("width", PopUp.Width, 0) .Add("height", PopUp.Height, 0); if (PopUp.PositionSettings.Left != int.MinValue || PopUp.PositionSettings.Top != int.MinValue) { var topLeft = new Dictionary <string, int>(); if (PopUp.PositionSettings.Top != int.MinValue) { topLeft.Add("top", PopUp.PositionSettings.Top); } if (PopUp.PositionSettings.Left != int.MinValue) { topLeft.Add("left", PopUp.PositionSettings.Left); } result.Add("position", topLeft); } return(result); }
protected override void Serialize(IDictionary <string, object> json) { var editorHtml = grid.EditorHtml; if (editorHtml != null && IsClientBinding) { if (grid.IsInClientTemplate) { editorHtml = Regex.Replace(editorHtml, "(&)#([0-9]+;)", "$1\\\\#$2"); } editorHtml = editorHtml.Trim() .Replace("\r\n", string.Empty) .Replace("</script>", "<\\/script>") .Replace("jQuery(\"#", "jQuery(\"\\\\#") .Replace("#", "\\#"); } FluentDictionary.For(json) .Add("confirmation", Confirmation, () => DisplayDeleteConfirmation) .Add("confirmDelete", ConfirmDelete) .Add("cancelDelete", CancelDelete) .Add("mode", Mode.ToString().ToLowerInvariant()) .Add("template", editorHtml, () => Mode != GridEditMode.InLine) //TODO: Implement GridBeginEditEvent option //.Add("beginEdit", BeginEdit == GridBeginEditEvent.Click ? "click" : "dblclick", () => BeginEdit != GridBeginEditEvent.Auto) .Add("createAt", CreateAt.ToString().ToLower(), () => CreateAt != GridInsertRowPosition.Top) .Add("window", SerializePopUp(), () => Mode == GridEditMode.PopUp && IsClientBinding) .Add("create", IsClientBinding) .Add("update", IsClientBinding) .Add("destroy", IsClientBinding); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", "scatter") .Add("xField", series.XMember, () => { return(series.Data == null && series.XMember != null); }) .Add("yField", series.YMember, () => { return(series.Data == null && series.YMember != null); }) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("color", series.Color, string.Empty); var labelsData = series.Labels.CreateSerializer().Serialize(); if (labelsData.Count > 0) { result.Add("labels", labelsData); } var markers = series.Markers.CreateSerializer().Serialize(); if (markers.Count > 0) { result.Add("markers", markers); } return(result); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("position", note.Position.ToString().ToLowerInvariant(), () => note.Position.HasValue); var labelData = note.Label.CreateSerializer().Serialize(); if (labelData.Count > 0) { result.Add("label", labelData); } var iconData = note.Icon.CreateSerializer().Serialize(); if (iconData.Count > 0) { result.Add("icon", iconData); } var lineData = note.Line.CreateSerializer().Serialize(); if (lineData.Count > 0) { result.Add("line", lineData); } return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", series.Type) .Add("dynamicHeight", series.DynamicHeight, () => { return(series.DynamicHeight != true); }) .Add("dynamicSlope", series.DynamicSlope, () => { return(series.DynamicSlope != false); }) .Add("neckRatio", series.NeckRatio, () => { return(series.NeckRatio != 0.3); }) .Add("segmentSpacing", series.SegmentSpacing, () => { return(series.SegmentSpacing != 0); }) .Add("field", series.Member, () => series.Member != null) .Add("categoryField", series.CategoryMember, () => series.CategoryMember != null) .Add("colorField", series.ColorMember, () => series.ColorMember != null) .Add("visibleInLegendField", series.VisibleInLegendMember, () => series.VisibleInLegendMember != null) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("border", series.Border.CreateSerializer().Serialize(), ShouldSerializeBorder); var labelsData = series.Labels.CreateSerializer().Serialize(); if (labelsData.Count > 0) { result.Add("labels", labelsData); } return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); result["type"] = "bubble"; FluentDictionary.For(result) .Add("sizeField", series.SizeMember, () => series.SizeMember != null) .Add("colorField", series.ColorMember, () => series.ColorMember != null) .Add("categoryField", series.CategoryMember, () => series.CategoryMember != null) .Add("visibleInLegendField", series.VisibleInLegendMember, () => series.VisibleInLegendMember != null) .Add("minSize", series.MinSize, () => series.MinSize.HasValue) .Add("maxSize", series.MaxSize, () => series.MaxSize.HasValue); var negativeValuesData = series.NegativeValues.CreateSerializer().Serialize(); if (negativeValuesData.Count > 0) { result.Add("negativeValues", negativeValuesData); } var borderData = series.Border.CreateSerializer().Serialize(); if (borderData.Count > 0) { result.Add("border", borderData); } return(result); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("name", series.Name, string.Empty) .Add("opacity", series.Opacity, () => series.Opacity.HasValue) .Add("visible", series.Visible, () => series.Visible.HasValue) .Add("axis", series.Axis, string.Empty) .Add("groupNameTemplate", series.GroupNameTemplate, string.Empty); var tooltipData = series.Tooltip.CreateSerializer().Serialize(); if (tooltipData.Count > 0) { result.Add("tooltip", tooltipData); } var highlightData = series.Highlight.CreateSerializer().Serialize(); if (highlightData.Count > 0) { result.Add("highlight", highlightData); } return(result); }
protected override void Serialize(IDictionary <string, object> json) { FluentDictionary.For(json) .Add("name", Name, DefaultName) .Add("size", Size, DefaultSize) .Add("extension", Extension, DefaultExtension); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("min", axis.Min, () => axis.Min.HasValue) .Add("max", axis.Max, () => axis.Max.HasValue) .Add("majorUnit", axis.MajorUnit, () => axis.MajorUnit.HasValue) .Add("minorUnit", axis.MinorUnit, () => axis.MinorUnit.HasValue); if (axis.BaseUnit != null) { result.Add("baseUnit", axis.BaseUnit.ToString().ToLowerInvariant()); } if (axis.AxisCrossingValues.Count() > 0) { var crossingValues = from ac in axis.AxisCrossingValues.AsQueryable() select ac.ToJavaScriptString(); result.Add("axisCrossingValue", crossingValues.ToArray()); } return(result); }
public virtual IDictionary <string, object> Serialize() { IDictionary <string, object> windowDictionary = new Dictionary <string, object>(); if (marker.Window != null) { FluentDictionary.For(windowDictionary) .Add("content", marker.Window.Content) .Add("disableAutoPan", marker.Window.DisableAutoPan, () => marker.Window.DisableAutoPan) .Add("openOnRightClick", marker.Window.OpenOnRightClick, () => marker.Window.OpenOnRightClick) .Add("lat", marker.Window.Latitude, () => marker.Latitude != marker.Window.Latitude) .Add("lng", marker.Window.Longitude, () => marker.Longitude != marker.Window.Longitude) .Add("maxWidth", marker.Window.MaxWidth, () => marker.Window.MaxWidth != 0) .Add("zIndex", marker.Window.zIndex, () => marker.Window.zIndex != 0); } IDictionary <string, object> result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("id", marker.Id, () => marker.Id != null) .Add("address", marker.Address, () => marker.Address != null) .Add("title", marker.Title, () => marker.Title != null) .Add("lat", marker.Latitude, () => marker.Latitude != null) .Add("lng", marker.Longitude, () => marker.Latitude != null) .Add("zIndex", marker.zIndex, 0) .Add("clickable", marker.Clickable, true) .Add("draggable", marker.Draggable, false) .Add("icon", marker.Icon, () => marker.Icon != null) .Add("window", windowDictionary, () => marker.Window != null); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", series.Type) .Add("aggregates", series.Aggregates.CreateSerializer().Serialize(), ShouldSerializeAggregates) .Add("gap", series.Gap, () => series.Gap.HasValue) .Add("spacing", series.Spacing, () => series.Spacing.HasValue) .Add("axis", series.Axis, () => series.Axis.HasValue()) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("border", series.Border.CreateSerializer().Serialize(), ShouldSerializeBorder) .Add("colorField", series.ColorMember, () => series.ColorMember.HasValue()) .Add("openField", series.OpenMember, () => series.OpenMember.HasValue()) .Add("highField", series.HighMember, () => series.HighMember.HasValue()) .Add("lowField", series.LowMember, () => series.LowMember.HasValue()) .Add("closeField", series.CloseMember, () => series.CloseMember.HasValue()) .Add("categoryField", series.CategoryMember, () => series.CategoryMember.HasValue()) .Add("noteTextField", series.NoteTextMember, () => series.NoteTextMember.HasValue()); var line = series.Line.CreateSerializer().Serialize(); if (line.Count > 0) { result.Add("line", line); } return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", "pie") .Add("field", series.Member, () => { return(series.Data == null && series.Member != null); }) .Add("categoryField", series.CategoryMember, () => { return(series.Data == null && series.CategoryMember != null); }) .Add("explodeField", series.ExplodeMember, () => { return(series.Data == null && series.ExplodeMember != null); }) .Add("colorField", series.ColorMember, () => { return(series.Data == null && series.ColorMember != null); }) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("padding", series.Padding, ChartDefaults.PieSeries.Padding) .Add("startAngle", series.StartAngle, ChartDefaults.PieSeries.StartAngle); if (series.Overlay != null) { result.Add("overlay", series.Overlay.Value); } var labelsData = series.Labels.CreateSerializer().Serialize(); if (labelsData.Count > 0) { result.Add("labels", labelsData); } var connectors = series.Connectors.CreateSerializer().Serialize(); if (connectors.Count > 0) { result.Add("connectors", connectors); } return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", series.Orientation == ChartSeriesOrientation.Horizontal ? "line" : "verticalLine") .Add("stack", series.Stacked, false) .Add("aggregate", series.Aggregate.ToString().ToLowerInvariant(), () => series.Aggregate != null) .Add("field", series.Member, () => { return(series.Data == null && series.Member.HasValue()); }) .Add("data", series.Data, () => { return(series.Data != null); }) .Add("width", series.Width, () => series.Width.HasValue) .Add("color", series.Color, () => series.Color.HasValue()) .Add("dashType", series.DashType.ToString().ToLowerInvariant(), () => series.DashType.HasValue) .Add("missingValues", series.MissingValues.ToString().ToLowerInvariant(), () => series.MissingValues.HasValue); var labelsData = series.Labels.CreateSerializer().Serialize(); if (labelsData.Count > 0) { result.Add("labels", labelsData); } var markers = series.Markers.CreateSerializer().Serialize(); if (markers.Count > 0) { result.Add("markers", markers); } return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("type", axis.Type.ToString(), () => axis.Type != null) .Add("field", axis.Member, () => axis.Categories == null && axis.Member != null) .Add("axisCrossingValue", axis.AxisCrossingValues, () => axis.AxisCrossingValues.Count() > 0) .Add("min", axis.Min.ToJavaScriptString(), () => axis.Min != null) .Add("max", axis.Max.ToJavaScriptString(), () => axis.Max != null) .Add("roundToBaseUnit", axis.RoundToBaseUnit, () => axis.RoundToBaseUnit.HasValue) .Add("justified", axis.Justified, () => axis.Justified.HasValue) .Add("maxDateGroups", axis.MaxDateGroups, () => axis.MaxDateGroups.HasValue); if (axis.BaseUnit != null) { result.Add("baseUnit", axis.BaseUnit.ToString().ToLowerInvariant()); } if (axis.BaseUnitStep.HasValue) { if (axis.BaseUnitStep > 0) { result.Add("baseUnitStep", axis.BaseUnitStep); } else { result.Add("baseUnitStep", "auto"); } } if (axis.Categories != null) { result.Add("categories", SerializeCategories()); } var autoBaseUnits = axis.AutoBaseUnitSteps.CreateSerializer().Serialize(); if (autoBaseUnits.Count > 0) { result.Add("autoBaseUnitSteps", autoBaseUnits); } var selectData = axis.Select.CreateSerializer().Serialize(); if (selectData.Count > 0) { result.Add("select", selectData); } var notes = axis.Notes.CreateSerializer().Serialize(); if (notes.Count > 0) { result.Add("notes", notes); } return(result); }
protected override void Serialize(IDictionary <string, object> json) { if (!this.FunctionData.HasValue()) { FluentDictionary.For(json).Add <string>("data", this.Data, string.Empty); } else { json.Add("data", this.FunctionData); } if (!this.FunctionTotal.HasValue()) { FluentDictionary.For(json).Add <string>("total", this.Total, string.Empty); } else { json.Add("total", this.FunctionTotal); } if (!this.FunctionErrors.HasValue()) { FluentDictionary.For(json).Add <string>("errors", this.Errors, string.Empty); } else { json.Add("errors", this.FunctionErrors); } if (!this.FunctionAggregates.HasValue()) { FluentDictionary.For(json).Add <string>("aggregates", this.Aggregates, string.Empty); } else { json.Add("aggregates", this.FunctionAggregates); } if (!this.FunctionGroups.HasValue()) { FluentDictionary.For(json).Add <string>("groups", this.Groups, string.Empty); } else { json.Add("groups", this.FunctionGroups); } if (this.FunctionModel != null) { json.Add("model", this.FunctionModel); } else if (this.Model != null) { json.Add("model", this.Model.ToJson()); } if (!string.IsNullOrEmpty(this.Type)) { json.Add("type", this.Type); } if (this.Parse.HasValue()) { json.Add("parse", this.Parse); } }
public virtual IDictionary <string, object> Serialize() { var barData = seriesDefaults.Bar.CreateSerializer().Serialize(); barData.Remove("type"); var columnData = seriesDefaults.Column.CreateSerializer().Serialize(); columnData.Remove("type"); var lineData = seriesDefaults.Line.CreateSerializer().Serialize(); lineData.Remove("type"); var verticalLineData = seriesDefaults.VerticalLine.CreateSerializer().Serialize(); verticalLineData.Remove("type"); var areaData = seriesDefaults.Area.CreateSerializer().Serialize(); areaData.Remove("type"); var verticalAreaData = seriesDefaults.VerticalArea.CreateSerializer().Serialize(); verticalAreaData.Remove("type"); var pieData = seriesDefaults.Pie.CreateSerializer().Serialize(); pieData.Remove("type"); var scatterData = seriesDefaults.Scatter.CreateSerializer().Serialize(); scatterData.Remove("type"); var scatterLineData = seriesDefaults.ScatterLine.CreateSerializer().Serialize(); scatterLineData.Remove("type"); var ohlcData = seriesDefaults.OHLC.CreateSerializer().Serialize(); ohlcData.Remove("type"); var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("bar", barData, () => barData.Count > 0) .Add("column", columnData, () => columnData.Count > 0) .Add("line", lineData, () => lineData.Count > 0) .Add("verticalLine", verticalLineData, () => verticalLineData.Count > 0) .Add("area", areaData, () => areaData.Count > 0) .Add("verticalArea", verticalAreaData, () => verticalAreaData.Count > 0) .Add("pie", pieData, () => pieData.Count > 0) .Add("scatter", scatterData, () => scatterData.Count > 0) .Add("scatterLine", scatterLineData, () => scatterLineData.Count > 0) .Add("ohlc", ohlcData, () => ohlcData.Count > 0); return(result); }
protected override void Serialize(IDictionary <string, object> json) { if (Id != null) { json["id"] = Id.Name; } FluentDictionary.For(json) .Add("hasChildren", HasChildrenMember, HasChildrenMember.HasValue); if (ChildrenDataSource != null) { json["children"] = ChildrenDataSource.ToJson(); } else if (ChildrenMember.HasValue()) { json["children"] = ChildrenMember; } if (Fields.Count > 0) { var fields = new Dictionary <string, object>(); json["fields"] = fields; Fields.Each(prop => { var field = new Dictionary <string, object>(); fields[prop.Member] = field; if (!prop.IsEditable) { field["editable"] = false; } field["type"] = prop.MemberType.ToJavaScriptType().ToLowerInvariant(); if (prop.MemberType.IsNullableType() || prop.DefaultValue != null) { field["defaultValue"] = prop.DefaultValue; } if (!string.IsNullOrEmpty(prop.From)) { field["from"] = prop.From; } if (prop.IsNullable) { field["nullable"] = prop.IsNullable; } if (prop.Parse.HasValue()) { field["parse"] = prop.Parse; } }); } }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("shared", chartTooltip.Shared, () => chartTooltip.Shared.HasValue); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("position", barLabels.Position.ToString().ToCamelCase(), ChartDefaults.BarSeries.Labels.Position.ToString().ToCamelCase()); return(result); }
protected override void Serialize(IDictionary <string, object> json) { FluentDictionary.For(json) .Add("name", Name, defaultName) .Add("size", Size, DefaultSize) .Add("extension", Extension, defaultExtension) .Add("url", Url, string.Empty) .Add("description", Description, string.Empty); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("gradient", overlay.Gradient.ToString().ToLowerInvariant()); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("value", note.Value, () => note.Value.HasValue); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("position", labels.Position.ToString().ToLowerInvariant(), () => labels.Position.HasValue); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("style", line.Style.ToString().ToLowerInvariant(), ChartAreaStyle.Normal.ToString().ToLowerInvariant()); return(result); }
public IHtmlNode Build() { if (!Component.SelectionStart.HasValue) { Component.SelectionStart = Component.Min; } if (!Component.SelectionEnd.HasValue) { Component.SelectionEnd = Component.Max; } if (!Component.LargeStep.HasValue) { Component.LargeStep = (T)Convert.ChangeType(5, typeof(T)); if (Component.LargeStep.Value.CompareTo(Component.SmallStep) < 0) { Component.LargeStep = Component.SmallStep; } } var div = new HtmlElement("div") .Attributes(new { id = Component.Id }) .Attributes(Component.HtmlAttributes) .Attributes(Component.GetUnobtrusiveValidationAttributes()); var defaultOptions = new Dictionary <string, object>(); FluentDictionary.For(defaultOptions) .Add("type", "range") .Add("step", Component.SmallStep, () => Component.SmallStep.HasValue) .Add("min", Component.Min, () => Component.Min.HasValue) .Add("max", Component.Max, () => Component.Max.HasValue); var firstInputOptions = new Dictionary <string, object>(defaultOptions); FluentDictionary.For(firstInputOptions) .Add("name ", string.Format("{0}[0]", Component.Name)) .Add("value", Component.GetValue("{0}[0]".FormatWith(Component.Name), Component.SelectionStart), () => Component.SelectionStart.HasValue); var secondInputOptions = new Dictionary <string, object>(defaultOptions); FluentDictionary.For(secondInputOptions) .Add("name ", string.Format("{0}[1]", Component.Name)) .Add("value", Component.GetValue("{0}[1]".FormatWith(Component.Name), Component.SelectionEnd), () => Component.SelectionEnd.HasValue); new HtmlElement("input", TagRenderMode.SelfClosing) .Attributes(firstInputOptions) .AppendTo(div); new HtmlElement("input", TagRenderMode.SelfClosing) .Attributes(secondInputOptions) .AppendTo(div); return(div); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("size", ticks.Size, () => ticks.Size.HasValue) .Add("visible", ticks.Visible, () => ticks.Visible.HasValue); return(result); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("color", settings.Color, () => settings.Color != null) .Add("visible", settings.Visible, () => settings.Visible.HasValue); return(result); }
public override IDictionary <string, object> Serialize() { var result = base.Serialize(); FluentDictionary.For(result) .Add("categories", axis.Categories, () => axis.Categories != null) .Add("field", axis.Member, () => axis.Categories == null && axis.Member != null); return(result); }
public virtual IDictionary <string, object> Serialize() { var result = new Dictionary <string, object>(); FluentDictionary.For(result) .Add("from", selection.From.ToJavaScriptString(), () => selection.From.HasValue) .Add("to", selection.To.ToJavaScriptString(), () => selection.To.HasValue); return(result); }