예제 #1
0
        // Clones this instance and all its children.
        internal OptionsBase Clone()
        {
            OptionsBase options = (OptionsBase)Activator.CreateInstance(this.GetType());

            options.CopyFrom(this);
            options._chart = this._chart;

            return(options);
        }
예제 #2
0
        /// <summary>
        /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionScalesAxes"/> set.
        /// </summary>
        /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
        public OptionScalesAxes(OptionsBase owner)
        {
            this.Owner = owner;

            var chart = this.Chart;

            if (chart != null)
            {
                switch (chart.ChartType)
                {
                case ChartType.Pie:
                case ChartType.Radar:
                case ChartType.Doughnut:
                case ChartType.PolarArea:
                    this.Display = false;
                    break;
                }
            }
        }
예제 #3
0
        // Initializes this option set copying the value from another option set.
        internal virtual void CopyFrom(OptionsBase source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // copy only the shared base properties.
            var targetProperties = TypeDescriptor.GetProperties(this);
            var sourceProperties = TypeDescriptor.GetProperties(source);

            foreach (PropertyDescriptor pSource in sourceProperties)
            {
                var pTarget = targetProperties[pSource.Name];
                if (pTarget == null || pTarget.PropertyType != pSource.PropertyType)
                {
                    continue;
                }

                try
                {
                    // go deep for nested options.
                    if (pSource.PropertyType.IsSubclassOf(typeof(OptionsBase)))
                    {
                        // create a new instance of the child options member.
                        OptionsBase options = (OptionsBase)Activator.CreateInstance(pSource.PropertyType, this);
                        options.CopyFrom((OptionsBase)pSource.GetValue(source));
                        pTarget.SetValue(this, options);
                    }
                    else
                    {
                        if (pSource.ShouldSerializeValue(source))
                        {
                            pTarget.SetValue(this, pSource.GetValue(source));
                        }
                    }
                }
                catch { }
            }
        }
예제 #4
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsTitle"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsTitle(OptionsBase owner)
 {
     this.Owner = owner;
 }
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsAxisGridlines"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsAxisGrid(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #6
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsTooltips"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsTooltips(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #7
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsDataLabel"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsDataLabels(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #8
0
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public ScaleTime(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #9
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsLegend"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsLegend(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #10
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsPlugins"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsPlugins(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #11
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionsScalesTicks"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionsScalesTicks(OptionsBase owner)
 {
     this.Owner = owner;
 }
예제 #12
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionScalesAxesY"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionScalesAxesY(OptionsBase owner)
     : base(owner)
 {
 }
예제 #13
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS3.OptionScalesAxesX"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS3.ChartJS3"/> that owns this set of options.</param>
 public OptionScalesAxesX(OptionsBase owner)
     : base(owner)
 {
     this.Type = ScaleType.Category;
 }