Exemple #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);
        }
Exemple #2
0
        /// <summary>
        /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionScalesAxes"/> set.
        /// </summary>
        /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> 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;
                }
            }
        }
Exemple #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 { }
            }
        }
Exemple #4
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsScaleTitle"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionsScaleTitle(OptionsBase owner)
 {
     this.Owner = owner;
 }
Exemple #5
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsScalesTicks"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionsScalesTicks(OptionsBase owner)
 {
     this.Owner = owner;
 }
Exemple #6
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionScalesAxesY"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionScalesAxesY(OptionsBase owner)
     : base(owner)
 {
 }
Exemple #7
0
 /// <summary>
 /// Constructs a new instance.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public ScaleTime(OptionsBase owner)
 {
     this.Owner = owner;
 }
		/// <summary>
		/// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsLegend"/> set.
		/// </summary>
		/// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
		public OptionsLegend(OptionsBase owner)
		{
			this.Owner = owner;
		}
Exemple #9
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsDataLabel"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionsDataLabel(OptionsBase owner)
 {
     this.Owner = owner;
 }
Exemple #10
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionScalesAxesX"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionScalesAxesX(OptionsBase owner)
     : base(owner)
 {
     this.Type = ScaleType.Category;
 }
Exemple #11
0
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsTtooltips"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionsTooltips(OptionsBase owner)
 {
     this.Owner = owner;
 }
 /// <summary>
 /// Constructs a new instance of the <see cref="T:Wisej.Web.Ext.ChartJS.OptionsAxisGridlines"/> set.
 /// </summary>
 /// <param name="owner">The <see cref="T:Wisej.Web.Ext.ChartJS.ChartJS"/> that owns this set of options.</param>
 public OptionsAxisGridLines(OptionsBase owner)
 {
     this.Owner = owner;
 }