// 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); }
/// <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; } } }
// 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 { } } }
/// <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; }
/// <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; }
/// <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) { }
/// <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; }
/// <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; }
/// <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; }
/// <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; }