CreateFromJson() public static method

Creates from json.
public static CreateFromJson ( string name, string json ) : ChartStyle
name string The name.
json string The json.
return ChartStyle
Exemplo n.º 1
0
        /// <summary>
        /// Sets the chart style.
        /// </summary>
        /// <param name="chartStyleDefinedValueGuid">The chart style defined value unique identifier.</param>
        public void SetChartStyle(Guid?chartStyleDefinedValueGuid)
        {
            ChartStyle chartStyle = null;

            if (chartStyleDefinedValueGuid.HasValue)
            {
                var definedValue = DefinedValueCache.Get(chartStyleDefinedValueGuid.Value);
                if (definedValue != null)
                {
                    chartStyle = ChartStyle.CreateFromJson(definedValue.Value, definedValue.GetAttributeValue("ChartStyle"));
                }
            }

            SetChartStyle(chartStyle ?? new ChartStyle());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the chart style.
        /// </summary>
        /// <param name="chartStyleDefinedValueGuid">The chart style defined value unique identifier.</param>
        public void SetChartStyle(Guid?chartStyleDefinedValueGuid)
        {
            ChartStyle chartStyle = null;

            if (chartStyleDefinedValueGuid.HasValue)
            {
                using (var rockContext = new Rock.Data.RockContext())
                {
                    var definedValue = new DefinedValueService(rockContext).Get(chartStyleDefinedValueGuid.Value);
                    if (definedValue != null)
                    {
                        definedValue.LoadAttributes(rockContext);
                        chartStyle = ChartStyle.CreateFromJson(definedValue.Value, definedValue.GetAttributeValue("ChartStyle"));
                    }
                }
            }

            SetChartStyle(chartStyle ?? new ChartStyle());
        }