Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

OpenWPFChart: assembling charts from components: Part I - Parts

, 19 Mar 2009
Provides the component model along with base components to assemble charts.
SourceCode.zip
trunk
ChartControls
ChartControls.csproj.user
OpenWPFChart.Chart.Icon.png
OpenWPFChart.WellLogChart.Icon.png
Properties
Themes
ChartHelpers
AxisPropertiesDialog
ChartHelpers.csproj.user
ChartScaleControl
FontChooser
ItemPropertiesDialog
Properties
ChartParts
Axes
ChartParts.csproj.user
Grid
Items
Data
DataView
Elements
Visuals
NumericalRecipes
Properties
Scales
ChartParts.vsmdi
SampleDataFiles
WellLog
Samples
ControlSamples
ColumnChartControlSample
Properties
Settings.settings
CurveChartControlSample
Properties
Settings.settings
WellLogControlSample
Properties
Settings.settings
DirectCompositionSamples
BasicSample
Properties
Settings.settings
TemperatureSample
Properties
Settings.settings
WellLogSample
Properties
Settings.settings
// <copyright file="LinearAxisDataView.cs" company="Oleg V. Polikarpotchkin">
// Copyright © 2008-2009 Oleg V. Polikarpotchkin. All Right Reserved
// </copyright>
// <author>Oleg V. Polikarpotchkin</author>
// <email>ov-p@yandex.ru</email>
// <date>2009-03-06</date>
// <summary>OpenWPFChart library. Linear Axis DataView.</summary>
// <revision>$Id: LinearAxisDataView.cs 18093 2009-03-16 04:15:06Z unknown $</revision>

using OpenWPFChart.Parts;

namespace OpenWPFChart.Helpers
{
	/// <summary>
	/// Coordinate Axis Properties dialog.
	/// </summary>
	public class LinearAxisDataView : AxisDataView
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="LinearAxisDataView"/> class.
		/// </summary>
		/// <param name="axis">The axis.</param>
		public LinearAxisDataView(LinearAxis axis) : base(axis)
		{
			ChartLinearScale linearScale = axis.AxisScale as ChartLinearScale;
			tickStep = linearScale.TickStep;
			longTickAnchor = linearScale.LongTickAnchor;
			longTickRate = linearScale.LongTickRate;
		}

		#region TickStep
		double tickStep;
		/// <summary>
		/// Gets or sets the TickStep property.
		/// <para>The space between two regular (not long) ticks. It should be positive regardeless 
		/// of <see cref="Start"/> and <see cref="Stop"/> values relationship.</para>
		/// </summary>
		/// <value>Any positive double value.</value>
		public double TickStep
		{
			get { return tickStep; }
			set
			{
				if (tickStep != value)
				{
					tickStep = value;
					Notify("TickStep");
				}
			}
		}
		#endregion TickStep

		#region LongTickAnchor
		double longTickAnchor;
		/// <summary>
		/// Gets or sets the LongTickAnchor property.
		/// <para>Represents the position of any long tick.</para>
		/// </summary>
		/// <value>Any finite double value.</value>
		public double LongTickAnchor
		{
			get { return longTickAnchor; }
			set
			{
				if (longTickAnchor != value)
				{
					longTickAnchor = value;
					Notify("LongTickAnchor");
				}
			}
		}
		#endregion LongTickAnchor

		#region LongTickRate
		int longTickRate;
		/// <summary>
		/// Gets or sets the LongTickRate property.
		/// <para>Represents long ticks rate; e.g. 
		/// <list>
		/// if LongTickRate == 1 then all ticks will be long.
		/// if LongTickRate == 2 then will be one short tick between two long ticks.
		/// if LongTickRate == 10 then every tenth tick will be long.
		/// </list>
		/// </para>
		/// </summary>
		/// <value>Positive integer value.</value>
		public int LongTickRate
		{
			get { return longTickRate; }
			set
			{
				if (longTickRate != value)
				{
					longTickRate = value;
					Notify("LongTickRate");
				}
			}
		}
		#endregion LongTickRate

		#region IDataErrorInfo Members
		protected override string GetDataErrorInfo(string columnName)
		{
			switch(columnName)
			{
				case "TickStep":
					if (TickStep <= 0)
						return "TickStep must be positive";
					return null;
				case "LongTickRate":
					if (LongTickRate <= 0)
						return "LongTickRate must be positive";
					return null;
			}
			return base.GetDataErrorInfo(columnName);
		}
		#endregion IDataErrorInfo Members
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Oleg V. Polikarpotchkin
Team Leader
Russian Federation Russian Federation
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 19 Mar 2009
Article Copyright 2009 by Oleg V. Polikarpotchkin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid