Exemplo n.º 1
0
		protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end)
		{
			double o = org.ToDouble();
			double e = end.ToDouble();

			if (!(o < e))
				return "org is not less than end";

			InternalSetOrgEnd(o, e, false, false);

			return null;
		}
 public override bool Add(Altaxo.Data.AltaxoVariant val)
 {
   return Add(val.ToDouble());
 }
Exemplo n.º 3
0
		/// <summary>
		/// PhysicalVariantToNormal translates physical values into a normal value linear along the axis
		/// a physical value of the axis origin must return a value of zero
		/// a physical value of the axis end must return a value of one
		/// the function physicalToNormal must be provided by any derived class
		/// </summary>
		/// <param name="x">the physical value</param>
		/// <returns>
		/// the normalized value linear along the axis,
		/// 0 for axis origin, 1 for axis end</returns>
		public override double PhysicalVariantToNormal(Altaxo.Data.AltaxoVariant x)
		{
			return PhysicalToNormal(x.ToDouble());
		}
Exemplo n.º 4
0
		public override void ProcessDataBounds(Altaxo.Data.AltaxoVariant org, bool orgfixed, Altaxo.Data.AltaxoVariant end, bool endfixed)
		{
			double dorg = org.ToDouble();
			double dend = end.ToDouble();

			if (!orgfixed)
			{
				dorg = Math.Ceiling(dorg) - 0.5;
			}
			if (!endfixed)
			{
				dend = Math.Floor(dend) + 0.5;
			}

			bool changed = false;
			changed |= _cachedAxisOrg != dorg;
			_cachedAxisOrg = dorg;

			changed |= _cachedAxisEnd != dend;
			_cachedAxisEnd = dend;

			changed |= _cachedAxisSpan != (dend - dorg);
			_cachedAxisSpan = dend - dorg;

			changed |= _cachedOneByAxisSpan != (1 / _cachedAxisSpan);
			_cachedOneByAxisSpan = 1 / _cachedAxisSpan;

			if (changed)
				OnChanged();
		}
Exemplo n.º 5
0
		public override double PhysicalVariantToNormal(Altaxo.Data.AltaxoVariant x)
		{
			if (x.IsType(Altaxo.Data.AltaxoVariant.Content.VString))
			{
				int idx = _dataBounds.IndexOf(x.ToString());
				return idx < 0 ? double.NaN : (1 + idx - _cachedAxisOrg) * _cachedOneByAxisSpan;
			}
			else if (x.CanConvertedToDouble)
			{
				return (x.ToDouble() - _cachedAxisOrg) * _cachedOneByAxisSpan;
			}
			else
			{
				return double.NaN;
			}
		}
 public override bool Add(Altaxo.Data.AltaxoVariant item)
 {
   return Add(item.ToDouble());
 }
Exemplo n.º 7
0
		/// <summary>
		/// PhysicalVariantToNormal translates physical values into a normal value linear along the axis
		/// a physical value of the axis origin must return a value of zero
		/// a physical value of the axis end must return a value of one
		/// the function physicalToNormal must be provided by any derived class
		/// </summary>
		/// <param name="x">the physical value</param>
		/// <returns>
		/// the normalized value linear along the axis,
		/// 0 for axis origin, 1 for axis end</returns>
		public override double PhysicalVariantToNormal(Altaxo.Data.AltaxoVariant x)
		{
			if (x.IsType(AltaxoVariant.Content.VDateTime))
				return PhysicalToNormal((DateTime)x);
			else if (x.CanConvertedToDouble)
				return PhysicalToNormal(new DateTime((long)(x.ToDouble() * 10000000)));
			else throw new ArgumentException("Variant x is neither DateTime nor numeric");
		}
Exemplo n.º 8
0
		protected override string SetScaleOrgEnd(Altaxo.Data.AltaxoVariant org, Altaxo.Data.AltaxoVariant end)
		{
			double o = org.ToDouble();
			double e = end.ToDouble();

			InternalSetOrgEnd(o, e);

			return null;
		}