Axis.cs 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="Axis.cs" company="OxyPlot">
  3. // Copyright (c) 2014 OxyPlot contributors
  4. // </copyright>
  5. // <summary>
  6. // The axis base.
  7. // </summary>
  8. // --------------------------------------------------------------------------------------------------------------------
  9. using Avalonia;
  10. namespace OxyPlot.Avalonia
  11. {
  12. using global::Avalonia.Controls;
  13. using global::Avalonia.Media;
  14. using System;
  15. /// <summary>
  16. /// The axis base.
  17. /// </summary>
  18. public abstract class Axis : Control
  19. {
  20. /// <summary>
  21. /// Identifies the <see cref="AbsoluteMaximum"/> dependency property.
  22. /// </summary>
  23. public static readonly StyledProperty<double> AbsoluteMaximumProperty = AvaloniaProperty.Register<Axis, double>(nameof(AbsoluteMaximum), double.MaxValue);
  24. /// <summary>
  25. /// Identifies the <see cref="AbsoluteMinimum"/> dependency property.
  26. /// </summary>
  27. public static readonly StyledProperty<double> AbsoluteMinimumProperty = AvaloniaProperty.Register<Axis, double>(nameof(AbsoluteMinimum), double.MinValue);
  28. /// <summary>
  29. /// Identifies the <see cref="Angle"/> dependency property.
  30. /// </summary>
  31. public static readonly StyledProperty<double> AngleProperty = AvaloniaProperty.Register<Axis, double>(nameof(Angle), 0.0);
  32. /// <summary>
  33. /// Identifies the <see cref="AxisTickToLabelDistance"/> dependency property.
  34. /// </summary>
  35. public static readonly StyledProperty<double> AxisTickToLabelDistanceProperty = AvaloniaProperty.Register<Axis, double>(nameof(AxisTickToLabelDistance), 4.0);
  36. /// <summary>
  37. /// Identifies the <see cref="AxisTitleDistance"/> dependency property.
  38. /// </summary>
  39. public static readonly StyledProperty<double> AxisTitleDistanceProperty = AvaloniaProperty.Register<Axis, double>(nameof(AxisTitleDistance), 4.0);
  40. /// <summary>
  41. /// Identifies the <see cref="AxisDistance"/> dependency property.
  42. /// </summary>
  43. public static readonly StyledProperty<double> AxisDistanceProperty = AvaloniaProperty.Register<Axis, double>(nameof(AxisDistance), 0.0);
  44. /// <summary>
  45. /// Identifies the <see cref="AxislineColor"/> dependency property.
  46. /// </summary>
  47. public static readonly StyledProperty<Color> AxislineColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(AxislineColor), Colors.Black);
  48. /// <summary>
  49. /// Identifies the <see cref="AxislineStyle"/> dependency property.
  50. /// </summary>
  51. public static readonly StyledProperty<LineStyle> AxislineStyleProperty = AvaloniaProperty.Register<Axis, LineStyle>(nameof(AxislineStyle), LineStyle.None);
  52. /// <summary>
  53. /// Identifies the <see cref="AxislineThickness"/> dependency property.
  54. /// </summary>
  55. public static readonly StyledProperty<double> AxislineThicknessProperty = AvaloniaProperty.Register<Axis, double>(nameof(AxislineThickness), 1.0);
  56. /// <summary>
  57. /// Identifies the <see cref="ClipTitle"/> dependency property.
  58. /// </summary>
  59. public static readonly StyledProperty<bool> ClipTitleProperty = AvaloniaProperty.Register<Axis, bool>(nameof(ClipTitle), true);
  60. /// <summary>
  61. /// Identifies the <see cref="EndPosition"/> dependency property.
  62. /// </summary>
  63. public static readonly StyledProperty<double> EndPositionProperty = AvaloniaProperty.Register<Axis, double>(nameof(EndPosition), 1.0);
  64. /// <summary>
  65. /// Identifies the <see cref="ExtraGridlineColor"/> dependency property.
  66. /// </summary>
  67. public static readonly StyledProperty<Color> ExtraGridlineColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(ExtraGridlineColor), Colors.Black);
  68. /// <summary>
  69. /// Identifies the <see cref="ExtraGridlineStyle"/> dependency property.
  70. /// </summary>
  71. public static readonly StyledProperty<LineStyle> ExtraGridlineStyleProperty = AvaloniaProperty.Register<Axis, LineStyle>(nameof(ExtraGridlineStyle), LineStyle.Solid);
  72. /// <summary>
  73. /// Identifies the <see cref="ExtraGridlineThickness"/> dependency property.
  74. /// </summary>
  75. public static readonly StyledProperty<double> ExtraGridlineThicknessProperty = AvaloniaProperty.Register<Axis, double>(nameof(ExtraGridlineThickness), 1.0);
  76. /// <summary>
  77. /// Identifies the <see cref="ExtraGridlines"/> dependency property.
  78. /// </summary>
  79. public static readonly StyledProperty<double[]> ExtraGridlinesProperty = AvaloniaProperty.Register<Axis, double[]>("ExtraGridLines", null);
  80. /// <summary>
  81. /// Identifies the <see cref="FilterFunction"/> dependency property.
  82. /// </summary>
  83. public static readonly StyledProperty<Func<double, bool>> FilterFunctionProperty = AvaloniaProperty.Register<Axis, Func<double, bool>>(nameof(FilterFunction), null);
  84. /// <summary>
  85. /// Identifies the <see cref="FilterMaxValue"/> dependency property.
  86. /// </summary>
  87. public static readonly StyledProperty<double> FilterMaxValueProperty = AvaloniaProperty.Register<Axis, double>(nameof(FilterMaxValue), double.MaxValue);
  88. /// <summary>
  89. /// Identifies the <see cref="FilterMinValue"/> dependency property.
  90. /// </summary>
  91. public static readonly StyledProperty<double> FilterMinValueProperty = AvaloniaProperty.Register<Axis, double>(nameof(FilterMinValue), double.MinValue);
  92. /// <summary>
  93. /// Identifies the <see cref="Font"/> dependency property.
  94. /// </summary>
  95. public static readonly StyledProperty<string> FontProperty = AvaloniaProperty.Register<Axis, string>(nameof(Font), null);
  96. /// <summary>
  97. /// Identifies the <see cref="FontSize"/> dependency property.
  98. /// </summary>
  99. public static readonly StyledProperty<double> FontSizeProperty = AvaloniaProperty.Register<Axis, double>(nameof(FontSize), double.NaN);
  100. /// <summary>
  101. /// Identifies the <see cref="FontWeight"/> dependency property.
  102. /// </summary>
  103. public static readonly StyledProperty<FontWeight> FontWeightProperty = AvaloniaProperty.Register<Axis, FontWeight>(nameof(FontWeight), FontWeight.Normal);
  104. /// <summary>
  105. /// Identifies the <see cref="IntervalLength"/> dependency property.
  106. /// </summary>
  107. public static readonly StyledProperty<double> IntervalLengthProperty = AvaloniaProperty.Register<Axis, double>(nameof(IntervalLength), 60.0);
  108. /// <summary>
  109. /// Identifies the <see cref="IsAxisVisible"/> dependency property.
  110. /// </summary>
  111. public static readonly StyledProperty<bool> IsAxisVisibleProperty = AvaloniaProperty.Register<Axis, bool>(nameof(IsAxisVisible), true);
  112. /// <summary>
  113. /// Identifies the <see cref="IsPanEnabled"/> dependency property.
  114. /// </summary>
  115. public static readonly StyledProperty<bool> IsPanEnabledProperty = AvaloniaProperty.Register<Axis, bool>(nameof(IsPanEnabled), true);
  116. /// <summary>
  117. /// Identifies the <see cref="IsZoomEnabled"/> dependency property.
  118. /// </summary>
  119. public static readonly StyledProperty<bool> IsZoomEnabledProperty = AvaloniaProperty.Register<Axis, bool>(nameof(IsZoomEnabled), true);
  120. /// <summary>
  121. /// Identifies the <see cref="Key"/> dependency property.
  122. /// </summary>
  123. public static readonly StyledProperty<string> KeyProperty = AvaloniaProperty.Register<Axis, string>(nameof(Key), null);
  124. /// <summary>
  125. /// Identifies the <see cref="LabelFormatter"/> dependency property.
  126. /// </summary>
  127. public static readonly StyledProperty<Func<double, string>> LabelFormatterProperty = AvaloniaProperty.Register<Axis, Func<double, string>>(nameof(LabelFormatter), null);
  128. /// <summary>
  129. /// Identifies the <see cref="Layer"/> dependency property.
  130. /// </summary>
  131. public static readonly StyledProperty<Axes.AxisLayer> LayerProperty = AvaloniaProperty.Register<Axis, Axes.AxisLayer>(nameof(Layer), Axes.AxisLayer.BelowSeries);
  132. /// <summary>
  133. /// Identifies the <see cref="MajorGridlineColor"/> dependency property.
  134. /// </summary>
  135. public static readonly StyledProperty<Color> MajorGridlineColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(MajorGridlineColor), Color.FromArgb(0x40, 0, 0, 0));
  136. /// <summary>
  137. /// Identifies the <see cref="MajorGridlineStyle"/> dependency property.
  138. /// </summary>
  139. public static readonly StyledProperty<LineStyle> MajorGridlineStyleProperty = AvaloniaProperty.Register<Axis, LineStyle>(nameof(MajorGridlineStyle), LineStyle.None);
  140. /// <summary>
  141. /// Identifies the <see cref="MajorGridlineThickness"/> dependency property.
  142. /// </summary>
  143. public static readonly StyledProperty<double> MajorGridlineThicknessProperty = AvaloniaProperty.Register<Axis, double>(nameof(MajorGridlineThickness), 1.0);
  144. /// <summary>
  145. /// Identifies the <see cref="MajorStep"/> dependency property.
  146. /// </summary>
  147. public static readonly StyledProperty<double> MajorStepProperty = AvaloniaProperty.Register<Axis, double>(nameof(MajorStep), double.NaN);
  148. /// <summary>
  149. /// Identifies the <see cref="MajorTickSize"/> dependency property.
  150. /// </summary>
  151. public static readonly StyledProperty<double> MajorTickSizeProperty = AvaloniaProperty.Register<Axis, double>(nameof(MajorTickSize), 7.0);
  152. /// <summary>
  153. /// Identifies the <see cref="MaximumPadding"/> dependency property.
  154. /// </summary>
  155. public static readonly StyledProperty<double> MaximumPaddingProperty = AvaloniaProperty.Register<Axis, double>(nameof(MaximumPadding), 0.01);
  156. /// <summary>
  157. /// Identifies the <see cref="MaximumMargin"/> dependency property.
  158. /// </summary>
  159. public static readonly StyledProperty<double> MaximumMarginProperty = AvaloniaProperty.Register<Axis, double>(nameof(MaximumMargin), 0.0);
  160. /// <summary>
  161. /// Identifies the <see cref="MaximumDataMargin"/> dependency property.
  162. /// </summary>
  163. public static readonly StyledProperty<double> MaximumDataMarginProperty = AvaloniaProperty.Register<Axis, double>(nameof(MaximumDataMargin), 0.0);
  164. /// <summary>
  165. /// Identifies the <see cref="Maximum"/> dependency property.
  166. /// </summary>
  167. public static readonly StyledProperty<double> MaximumProperty = AvaloniaProperty.Register<Axis, double>(nameof(Maximum), double.NaN);
  168. /// <summary>
  169. /// Identifies the <see cref="MaximumRange"/> dependency property.
  170. /// </summary>
  171. public static readonly StyledProperty<double> MaximumRangeProperty = AvaloniaProperty.Register<Axis, double>(nameof(MaximumRange), double.PositiveInfinity);
  172. /// <summary>
  173. /// Identifies the <see cref="MinimumPadding"/> dependency property.
  174. /// </summary>
  175. public static readonly StyledProperty<double> MinimumPaddingProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinimumPadding), 0.01);
  176. /// <summary>
  177. /// Identifies the <see cref="MinimumMargin"/> dependency property.
  178. /// </summary>
  179. public static readonly StyledProperty<double> MinimumMarginProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinimumMargin), 0.0);
  180. /// <summary>
  181. /// Identifies the <see cref="MinimumDataMargin"/> dependency property.
  182. /// </summary>
  183. public static readonly StyledProperty<double> MinimumDataMarginProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinimumDataMargin), 0.0);
  184. /// <summary>
  185. /// Identifies the <see cref="Minimum"/> dependency property.
  186. /// </summary>
  187. public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<Axis, double>(nameof(Minimum), double.NaN);
  188. /// <summary>
  189. /// Identifies the <see cref="MinimumRange"/> dependency property.
  190. /// </summary>
  191. public static readonly StyledProperty<double> MinimumRangeProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinimumRange), 0.0);
  192. /// <summary>
  193. /// Identifies the <see cref="MinorGridlineColor"/> dependency property.
  194. /// </summary>
  195. public static readonly StyledProperty<Color> MinorGridlineColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(MinorGridlineColor), Color.FromArgb(0x20, 0, 0, 0));
  196. /// <summary>
  197. /// Identifies the <see cref="MinorGridlineStyle"/> dependency property.
  198. /// </summary>
  199. public static readonly StyledProperty<LineStyle> MinorGridlineStyleProperty = AvaloniaProperty.Register<Axis, LineStyle>(nameof(MinorGridlineStyle), LineStyle.None);
  200. /// <summary>
  201. /// Identifies the <see cref="MinorGridlineThickness"/> dependency property.
  202. /// </summary>
  203. public static readonly StyledProperty<double> MinorGridlineThicknessProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinorGridlineThickness), 1.0);
  204. /// <summary>
  205. /// Identifies the <see cref="MinorStep"/> dependency property.
  206. /// </summary>
  207. public static readonly StyledProperty<double> MinorStepProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinorStep), double.NaN);
  208. /// <summary>
  209. /// Identifies the <see cref="MinorTickSize"/> dependency property.
  210. /// </summary>
  211. public static readonly StyledProperty<double> MinorTickSizeProperty = AvaloniaProperty.Register<Axis, double>(nameof(MinorTickSize), 4.0);
  212. /// <summary>
  213. /// Identifies the <see cref="PositionAtZeroCrossing"/> dependency property.
  214. /// </summary>
  215. public static readonly StyledProperty<bool> PositionAtZeroCrossingProperty = AvaloniaProperty.Register<Axis, bool>(nameof(PositionAtZeroCrossing), false);
  216. /// <summary>
  217. /// Identifies the <see cref="Position"/> dependency property.
  218. /// </summary>
  219. public static readonly StyledProperty<Axes.AxisPosition> PositionProperty = AvaloniaProperty.Register<Axis, Axes.AxisPosition>(nameof(Position), Axes.AxisPosition.Left);
  220. /// <summary>
  221. /// Identifies the <see cref="PositionTier"/> dependency property.
  222. /// </summary>
  223. public static readonly StyledProperty<int> PositionTierProperty = AvaloniaProperty.Register<Axis, int>(nameof(PositionTier), 0);
  224. /// <summary>
  225. /// Identifies the <see cref="StartPosition"/> dependency property.
  226. /// </summary>
  227. public static readonly StyledProperty<double> StartPositionProperty = AvaloniaProperty.Register<Axis, double>(nameof(StartPosition), 0.0);
  228. /// <summary>
  229. /// Identifies the <see cref="StringFormat"/> dependency property.
  230. /// </summary>
  231. public static readonly StyledProperty<string> StringFormatProperty = AvaloniaProperty.Register<Axis, string>(nameof(StringFormat), null);
  232. /// <summary>
  233. /// Identifies the <see cref="TextColor"/> dependency property.
  234. /// </summary>
  235. public static readonly StyledProperty<Color> TextColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(TextColor), MoreColors.Automatic);
  236. /// <summary>
  237. /// Identifies the <see cref="TickStyle"/> dependency property.
  238. /// </summary>
  239. public static readonly StyledProperty<Axes.TickStyle> TickStyleProperty = AvaloniaProperty.Register<Axis, Axes.TickStyle>(nameof(TickStyle), Axes.TickStyle.Outside);
  240. /// <summary>
  241. /// Identifies the <see cref="TicklineColor"/> dependency property.
  242. /// </summary>
  243. public static readonly StyledProperty<Color> TicklineColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(TicklineColor), Colors.Black);
  244. /// <summary>
  245. /// Identifies the <see cref="TitleClippingLength"/> dependency property.
  246. /// </summary>
  247. public static readonly StyledProperty<double> TitleClippingLengthProperty = AvaloniaProperty.Register<Axis, double>(nameof(TitleClippingLength), 0.9);
  248. /// <summary>
  249. /// Identifies the <see cref="TitleColor"/> dependency property.
  250. /// </summary>
  251. public static readonly StyledProperty<Color> TitleColorProperty = AvaloniaProperty.Register<Axis, Color>(nameof(TitleColor), OxyColors.Automatic.ToColor());
  252. /// <summary>
  253. /// Identifies the <see cref="TitleFont"/> dependency property.
  254. /// </summary>
  255. public static readonly StyledProperty<string> TitleFontProperty = AvaloniaProperty.Register<Axis, string>(nameof(TitleFont), null);
  256. /// <summary>
  257. /// Identifies the <see cref="TitleFontSize"/> dependency property.
  258. /// </summary>
  259. public static readonly StyledProperty<double> TitleFontSizeProperty = AvaloniaProperty.Register<Axis, double>(nameof(TitleFontSize), double.NaN);
  260. /// <summary>
  261. /// Identifies the <see cref="TitleFontWeight"/> dependency property.
  262. /// </summary>
  263. public static readonly StyledProperty<FontWeight> TitleFontWeightProperty = AvaloniaProperty.Register<Axis, FontWeight>(nameof(TitleFontWeight), FontWeight.Normal);
  264. /// <summary>
  265. /// Identifies the <see cref="TitleFormatString"/> dependency property.
  266. /// </summary>
  267. public static readonly StyledProperty<string> TitleFormatStringProperty = AvaloniaProperty.Register<Axis, string>(nameof(TitleFormatString), "{0} [{1}]");
  268. /// <summary>
  269. /// Identifies the <see cref="TitlePosition"/> dependency property.
  270. /// </summary>
  271. public static readonly StyledProperty<double> TitlePositionProperty = AvaloniaProperty.Register<Axis, double>(nameof(TitlePosition), 0.5);
  272. /// <summary>
  273. /// Identifies the <see cref="Title"/> dependency property.
  274. /// </summary>
  275. public static readonly StyledProperty<string> TitleProperty = AvaloniaProperty.Register<Axis, string>(nameof(Title), null);
  276. /// <summary>
  277. /// Identifies the <see cref="Unit"/> dependency property.
  278. /// </summary>
  279. public static readonly StyledProperty<string> UnitProperty = AvaloniaProperty.Register<Axis, string>(nameof(Unit), null);
  280. /// <summary>
  281. /// Identifies the <see cref="UseSuperExponentialFormat"/> dependency property.
  282. /// </summary>
  283. public static readonly StyledProperty<bool> UseSuperExponentialFormatProperty = AvaloniaProperty.Register<Axis, bool>(nameof(UseSuperExponentialFormat), false);
  284. /// <summary>
  285. /// Identifies the <see cref="EdgeRenderingMode"/> dependency property.
  286. /// </summary>
  287. public static readonly StyledProperty<EdgeRenderingMode> EdgeRenderingModeProperty = AvaloniaProperty.Register<Axis, EdgeRenderingMode>(nameof(EdgeRenderingMode), EdgeRenderingMode.Automatic);
  288. /// <summary>
  289. /// Gets or sets the internal axis.
  290. /// </summary>
  291. public Axes.Axis InternalAxis { get; protected set; }
  292. /// <summary>
  293. /// Gets or sets the absolute maximum. This is only used for the UI control. It will not be possible to zoom/pan beyond this limit.
  294. /// </summary>
  295. public double AbsoluteMaximum
  296. {
  297. get
  298. {
  299. return GetValue(AbsoluteMaximumProperty);
  300. }
  301. set
  302. {
  303. SetValue(AbsoluteMaximumProperty, value);
  304. }
  305. }
  306. /// <summary>
  307. /// Gets or sets the absolute minimum. This is only used for the UI control. It will not be possible to zoom/pan beyond this limit.
  308. /// </summary>
  309. public double AbsoluteMinimum
  310. {
  311. get
  312. {
  313. return GetValue(AbsoluteMinimumProperty);
  314. }
  315. set
  316. {
  317. SetValue(AbsoluteMinimumProperty, value);
  318. }
  319. }
  320. /// <summary>
  321. /// Gets or sets Angle.
  322. /// </summary>
  323. public double Angle
  324. {
  325. get
  326. {
  327. return GetValue(AngleProperty);
  328. }
  329. set
  330. {
  331. SetValue(AngleProperty, value);
  332. }
  333. }
  334. /// <summary>
  335. /// Gets or sets AxisDistance.
  336. /// </summary>
  337. public double AxisDistance
  338. {
  339. get
  340. {
  341. return GetValue(AxisDistanceProperty);
  342. }
  343. set
  344. {
  345. SetValue(AxisDistanceProperty, value);
  346. }
  347. }
  348. /// <summary>
  349. /// Gets or sets AxisTickToLabelDistance.
  350. /// </summary>
  351. public double AxisTickToLabelDistance
  352. {
  353. get
  354. {
  355. return GetValue(AxisTickToLabelDistanceProperty);
  356. }
  357. set
  358. {
  359. SetValue(AxisTickToLabelDistanceProperty, value);
  360. }
  361. }
  362. /// <summary>
  363. /// Gets or sets AxisTitleDistance.
  364. /// </summary>
  365. public double AxisTitleDistance
  366. {
  367. get
  368. {
  369. return GetValue(AxisTitleDistanceProperty);
  370. }
  371. set
  372. {
  373. SetValue(AxisTitleDistanceProperty, value);
  374. }
  375. }
  376. /// <summary>
  377. /// Gets or sets the color of the axis line.
  378. /// </summary>
  379. /// <value>The color of the axis line.</value>
  380. public Color AxislineColor
  381. {
  382. get
  383. {
  384. return GetValue(AxislineColorProperty);
  385. }
  386. set
  387. {
  388. SetValue(AxislineColorProperty, value);
  389. }
  390. }
  391. /// <summary>
  392. /// Gets or sets the axis line style.
  393. /// </summary>
  394. /// <value>The axis line style.</value>
  395. public LineStyle AxislineStyle
  396. {
  397. get
  398. {
  399. return GetValue(AxislineStyleProperty);
  400. }
  401. set
  402. {
  403. SetValue(AxislineStyleProperty, value);
  404. }
  405. }
  406. /// <summary>
  407. /// Gets or sets the axis line thickness.
  408. /// </summary>
  409. /// <value>The axis line thickness.</value>
  410. public double AxislineThickness
  411. {
  412. get
  413. {
  414. return GetValue(AxislineThicknessProperty);
  415. }
  416. set
  417. {
  418. SetValue(AxislineThicknessProperty, value);
  419. }
  420. }
  421. /// <summary>
  422. /// Gets or sets a value indicating whether [clip title].
  423. /// </summary>
  424. /// <value><c>true</c> if [clip title]; otherwise, <c>false</c> .</value>
  425. public bool ClipTitle
  426. {
  427. get
  428. {
  429. return GetValue(ClipTitleProperty);
  430. }
  431. set
  432. {
  433. SetValue(ClipTitleProperty, value);
  434. }
  435. }
  436. /// <summary>
  437. /// Gets or sets EndPosition.
  438. /// </summary>
  439. public double EndPosition
  440. {
  441. get
  442. {
  443. return GetValue(EndPositionProperty);
  444. }
  445. set
  446. {
  447. SetValue(EndPositionProperty, value);
  448. }
  449. }
  450. /// <summary>
  451. /// Gets or sets ExtraGridlineColor.
  452. /// </summary>
  453. public Color ExtraGridlineColor
  454. {
  455. get
  456. {
  457. return GetValue(ExtraGridlineColorProperty);
  458. }
  459. set
  460. {
  461. SetValue(ExtraGridlineColorProperty, value);
  462. }
  463. }
  464. /// <summary>
  465. /// Gets or sets ExtraGridlineStyle.
  466. /// </summary>
  467. public LineStyle ExtraGridlineStyle
  468. {
  469. get
  470. {
  471. return GetValue(ExtraGridlineStyleProperty);
  472. }
  473. set
  474. {
  475. SetValue(ExtraGridlineStyleProperty, value);
  476. }
  477. }
  478. /// <summary>
  479. /// Gets or sets ExtraGridlineThickness.
  480. /// </summary>
  481. public double ExtraGridlineThickness
  482. {
  483. get
  484. {
  485. return GetValue(ExtraGridlineThicknessProperty);
  486. }
  487. set
  488. {
  489. SetValue(ExtraGridlineThicknessProperty, value);
  490. }
  491. }
  492. /// <summary>
  493. /// Gets or sets ExtraGridLines.
  494. /// </summary>
  495. public double[] ExtraGridlines
  496. {
  497. get
  498. {
  499. return GetValue(ExtraGridlinesProperty);
  500. }
  501. set
  502. {
  503. SetValue(ExtraGridlinesProperty, value);
  504. }
  505. }
  506. /// <summary>
  507. /// Gets or sets the filter function.
  508. /// </summary>
  509. /// <value>The filter function.</value>
  510. public Func<double, bool> FilterFunction
  511. {
  512. get
  513. {
  514. return GetValue(FilterFunctionProperty);
  515. }
  516. set
  517. {
  518. SetValue(FilterFunctionProperty, value);
  519. }
  520. }
  521. /// <summary>
  522. /// Gets or sets FilterMaxValue.
  523. /// </summary>
  524. public double FilterMaxValue
  525. {
  526. get
  527. {
  528. return GetValue(FilterMaxValueProperty);
  529. }
  530. set
  531. {
  532. SetValue(FilterMaxValueProperty, value);
  533. }
  534. }
  535. /// <summary>
  536. /// Gets or sets FilterMinValue.
  537. /// </summary>
  538. public double FilterMinValue
  539. {
  540. get
  541. {
  542. return GetValue(FilterMinValueProperty);
  543. }
  544. set
  545. {
  546. SetValue(FilterMinValueProperty, value);
  547. }
  548. }
  549. /// <summary>
  550. /// Gets or sets Font.
  551. /// </summary>
  552. public string Font
  553. {
  554. get
  555. {
  556. return GetValue(FontProperty);
  557. }
  558. set
  559. {
  560. SetValue(FontProperty, value);
  561. }
  562. }
  563. /// <summary>
  564. /// Gets or sets FontSize.
  565. /// </summary>
  566. public double FontSize
  567. {
  568. get
  569. {
  570. return GetValue(FontSizeProperty);
  571. }
  572. set
  573. {
  574. SetValue(FontSizeProperty, value);
  575. }
  576. }
  577. /// <summary>
  578. /// Gets or sets the font weight.
  579. /// </summary>
  580. public FontWeight FontWeight
  581. {
  582. get
  583. {
  584. return GetValue(FontWeightProperty);
  585. }
  586. set
  587. {
  588. SetValue(FontWeightProperty, value);
  589. }
  590. }
  591. /// <summary>
  592. /// Gets or sets the interval length.
  593. /// </summary>
  594. public double IntervalLength
  595. {
  596. get
  597. {
  598. return GetValue(IntervalLengthProperty);
  599. }
  600. set
  601. {
  602. SetValue(IntervalLengthProperty, value);
  603. }
  604. }
  605. /// <summary>
  606. /// Gets or sets a value indicating whether the axis is visible.
  607. /// </summary>
  608. public bool IsAxisVisible
  609. {
  610. get
  611. {
  612. return GetValue(IsAxisVisibleProperty);
  613. }
  614. set
  615. {
  616. SetValue(IsAxisVisibleProperty, value);
  617. }
  618. }
  619. /// <summary>
  620. /// Gets or sets a value indicating whether pan is enabled.
  621. /// </summary>
  622. public bool IsPanEnabled
  623. {
  624. get
  625. {
  626. return GetValue(IsPanEnabledProperty);
  627. }
  628. set
  629. {
  630. SetValue(IsPanEnabledProperty, value);
  631. }
  632. }
  633. /// <summary>
  634. /// Gets or sets a value indicating whether zoom is enabled.
  635. /// </summary>
  636. public bool IsZoomEnabled
  637. {
  638. get
  639. {
  640. return GetValue(IsZoomEnabledProperty);
  641. }
  642. set
  643. {
  644. SetValue(IsZoomEnabledProperty, value);
  645. }
  646. }
  647. /// <summary>
  648. /// Gets or sets the axis key.
  649. /// </summary>
  650. public string Key
  651. {
  652. get
  653. {
  654. return GetValue(KeyProperty);
  655. }
  656. set
  657. {
  658. SetValue(KeyProperty, value);
  659. }
  660. }
  661. /// <summary>
  662. /// Gets or sets the label formatter.
  663. /// </summary>
  664. public Func<double, string> LabelFormatter
  665. {
  666. get
  667. {
  668. return GetValue(LabelFormatterProperty);
  669. }
  670. set
  671. {
  672. SetValue(LabelFormatterProperty, value);
  673. }
  674. }
  675. /// <summary>
  676. /// Gets or sets the layer.
  677. /// </summary>
  678. public Axes.AxisLayer Layer
  679. {
  680. get
  681. {
  682. return GetValue(LayerProperty);
  683. }
  684. set
  685. {
  686. SetValue(LayerProperty, value);
  687. }
  688. }
  689. /// <summary>
  690. /// Gets or sets the color of the major gridlines.
  691. /// </summary>
  692. public Color MajorGridlineColor
  693. {
  694. get
  695. {
  696. return GetValue(MajorGridlineColorProperty);
  697. }
  698. set
  699. {
  700. SetValue(MajorGridlineColorProperty, value);
  701. }
  702. }
  703. /// <summary>
  704. /// Gets or sets the line style of the major gridlines.
  705. /// </summary>
  706. public LineStyle MajorGridlineStyle
  707. {
  708. get
  709. {
  710. return GetValue(MajorGridlineStyleProperty);
  711. }
  712. set
  713. {
  714. SetValue(MajorGridlineStyleProperty, value);
  715. }
  716. }
  717. /// <summary>
  718. /// Gets or sets MajorGridlineThickness.
  719. /// </summary>
  720. public double MajorGridlineThickness
  721. {
  722. get
  723. {
  724. return GetValue(MajorGridlineThicknessProperty);
  725. }
  726. set
  727. {
  728. SetValue(MajorGridlineThicknessProperty, value);
  729. }
  730. }
  731. /// <summary>
  732. /// Gets or sets MajorStep.
  733. /// </summary>
  734. public double MajorStep
  735. {
  736. get
  737. {
  738. return GetValue(MajorStepProperty);
  739. }
  740. set
  741. {
  742. SetValue(MajorStepProperty, value);
  743. }
  744. }
  745. /// <summary>
  746. /// Gets or sets MajorTickSize.
  747. /// </summary>
  748. public double MajorTickSize
  749. {
  750. get
  751. {
  752. return GetValue(MajorTickSizeProperty);
  753. }
  754. set
  755. {
  756. SetValue(MajorTickSizeProperty, value);
  757. }
  758. }
  759. /// <summary>
  760. /// Gets or sets Maximum.
  761. /// </summary>
  762. public double Maximum
  763. {
  764. get
  765. {
  766. return GetValue(MaximumProperty);
  767. }
  768. set
  769. {
  770. SetValue(MaximumProperty, value);
  771. }
  772. }
  773. /// <summary>
  774. /// Gets or sets MaximumPadding.
  775. /// </summary>
  776. public double MaximumPadding
  777. {
  778. get
  779. {
  780. return GetValue(MaximumPaddingProperty);
  781. }
  782. set
  783. {
  784. SetValue(MaximumPaddingProperty, value);
  785. }
  786. }
  787. /// <summary>
  788. /// Gets or sets Margin.
  789. /// </summary>
  790. public double MaximumMargin
  791. {
  792. get
  793. {
  794. return GetValue(MaximumMarginProperty);
  795. }
  796. set
  797. {
  798. SetValue(MaximumMarginProperty, value);
  799. }
  800. }
  801. /// <summary>
  802. /// Gets or sets DataMargin.
  803. /// </summary>
  804. public double MaximumDataMargin
  805. {
  806. get
  807. {
  808. return GetValue(MaximumDataMarginProperty);
  809. }
  810. set
  811. {
  812. SetValue(MaximumDataMarginProperty, value);
  813. }
  814. }
  815. /// <summary>
  816. /// Gets or sets MaximumRange.
  817. /// </summary>
  818. public double MaximumRange
  819. {
  820. get
  821. {
  822. return GetValue(MaximumRangeProperty);
  823. }
  824. set
  825. {
  826. SetValue(MaximumRangeProperty, value);
  827. }
  828. }
  829. /// <summary>
  830. /// Gets or sets Minimum.
  831. /// </summary>
  832. public double Minimum
  833. {
  834. get
  835. {
  836. return GetValue(MinimumProperty);
  837. }
  838. set
  839. {
  840. SetValue(MinimumProperty, value);
  841. }
  842. }
  843. /// <summary>
  844. /// Gets or sets MinimumPadding.
  845. /// </summary>
  846. public double MinimumPadding
  847. {
  848. get
  849. {
  850. return GetValue(MinimumPaddingProperty);
  851. }
  852. set
  853. {
  854. SetValue(MinimumPaddingProperty, value);
  855. }
  856. }
  857. /// <summary>
  858. /// Gets or sets Margin.
  859. /// </summary>
  860. public double MinimumMargin
  861. {
  862. get
  863. {
  864. return GetValue(MinimumMarginProperty);
  865. }
  866. set
  867. {
  868. SetValue(MinimumMarginProperty, value);
  869. }
  870. }
  871. /// <summary>
  872. /// Gets or sets DataMargin.
  873. /// </summary>
  874. public double MinimumDataMargin
  875. {
  876. get
  877. {
  878. return GetValue(MinimumDataMarginProperty);
  879. }
  880. set
  881. {
  882. SetValue(MinimumDataMarginProperty, value);
  883. }
  884. }
  885. /// <summary>
  886. /// Gets or sets MinimumRange.
  887. /// </summary>
  888. public double MinimumRange
  889. {
  890. get
  891. {
  892. return GetValue(MinimumRangeProperty);
  893. }
  894. set
  895. {
  896. SetValue(MinimumRangeProperty, value);
  897. }
  898. }
  899. /// <summary>
  900. /// Gets or sets MinorGridlineColor.
  901. /// </summary>
  902. public Color MinorGridlineColor
  903. {
  904. get
  905. {
  906. return GetValue(MinorGridlineColorProperty);
  907. }
  908. set
  909. {
  910. SetValue(MinorGridlineColorProperty, value);
  911. }
  912. }
  913. /// <summary>
  914. /// Gets or sets MinorGridlineStyle.
  915. /// </summary>
  916. public LineStyle MinorGridlineStyle
  917. {
  918. get
  919. {
  920. return GetValue(MinorGridlineStyleProperty);
  921. }
  922. set
  923. {
  924. SetValue(MinorGridlineStyleProperty, value);
  925. }
  926. }
  927. /// <summary>
  928. /// Gets or sets MinorGridlineThickness.
  929. /// </summary>
  930. public double MinorGridlineThickness
  931. {
  932. get
  933. {
  934. return GetValue(MinorGridlineThicknessProperty);
  935. }
  936. set
  937. {
  938. SetValue(MinorGridlineThicknessProperty, value);
  939. }
  940. }
  941. /// <summary>
  942. /// Gets or sets MinorStep.
  943. /// </summary>
  944. public double MinorStep
  945. {
  946. get
  947. {
  948. return GetValue(MinorStepProperty);
  949. }
  950. set
  951. {
  952. SetValue(MinorStepProperty, value);
  953. }
  954. }
  955. /// <summary>
  956. /// Gets or sets MinorTickSize.
  957. /// </summary>
  958. public double MinorTickSize
  959. {
  960. get
  961. {
  962. return GetValue(MinorTickSizeProperty);
  963. }
  964. set
  965. {
  966. SetValue(MinorTickSizeProperty, value);
  967. }
  968. }
  969. /// <summary>
  970. /// Gets or sets Position.
  971. /// </summary>
  972. public Axes.AxisPosition Position
  973. {
  974. get
  975. {
  976. return GetValue(PositionProperty);
  977. }
  978. set
  979. {
  980. SetValue(PositionProperty, value);
  981. }
  982. }
  983. /// <summary>
  984. /// Gets or sets a value indicating whether PositionAtZeroCrossing.
  985. /// </summary>
  986. public bool PositionAtZeroCrossing
  987. {
  988. get
  989. {
  990. return GetValue(PositionAtZeroCrossingProperty);
  991. }
  992. set
  993. {
  994. SetValue(PositionAtZeroCrossingProperty, value);
  995. }
  996. }
  997. /// <summary>
  998. /// Gets or sets the position tier which defines in which tier the axis is displayed.
  999. /// </summary>
  1000. /// <remarks>The bigger the value the further afar is the axis from the graph.</remarks>
  1001. public int PositionTier
  1002. {
  1003. get
  1004. {
  1005. return GetValue(PositionTierProperty);
  1006. }
  1007. set
  1008. {
  1009. SetValue(PositionTierProperty, value);
  1010. }
  1011. }
  1012. /// <summary>
  1013. /// Gets or sets the start position.
  1014. /// </summary>
  1015. public double StartPosition
  1016. {
  1017. get
  1018. {
  1019. return GetValue(StartPositionProperty);
  1020. }
  1021. set
  1022. {
  1023. SetValue(StartPositionProperty, value);
  1024. }
  1025. }
  1026. /// <summary>
  1027. /// Gets or sets the string format.
  1028. /// </summary>
  1029. public string StringFormat
  1030. {
  1031. get
  1032. {
  1033. return GetValue(StringFormatProperty);
  1034. }
  1035. set
  1036. {
  1037. SetValue(StringFormatProperty, value);
  1038. }
  1039. }
  1040. /// <summary>
  1041. /// Gets or sets the text color
  1042. /// </summary>
  1043. public Color TextColor
  1044. {
  1045. get
  1046. {
  1047. return GetValue(TextColorProperty);
  1048. }
  1049. set
  1050. {
  1051. SetValue(TextColorProperty, value);
  1052. }
  1053. }
  1054. /// <summary>
  1055. /// Gets or sets the tick style.
  1056. /// </summary>
  1057. public Axes.TickStyle TickStyle
  1058. {
  1059. get
  1060. {
  1061. return GetValue(TickStyleProperty);
  1062. }
  1063. set
  1064. {
  1065. SetValue(TickStyleProperty, value);
  1066. }
  1067. }
  1068. /// <summary>
  1069. /// Gets or sets the tick line color.
  1070. /// </summary>
  1071. public Color TicklineColor
  1072. {
  1073. get
  1074. {
  1075. return GetValue(TicklineColorProperty);
  1076. }
  1077. set
  1078. {
  1079. SetValue(TicklineColorProperty, value);
  1080. }
  1081. }
  1082. /// <summary>
  1083. /// Gets or sets the title.
  1084. /// </summary>
  1085. public string Title
  1086. {
  1087. get
  1088. {
  1089. return GetValue(TitleProperty);
  1090. }
  1091. set
  1092. {
  1093. SetValue(TitleProperty, value);
  1094. }
  1095. }
  1096. /// <summary>
  1097. /// Gets or sets the length of the title clipping.
  1098. /// </summary>
  1099. /// <value>The length of the title clipping.</value>
  1100. public double TitleClippingLength
  1101. {
  1102. get
  1103. {
  1104. return GetValue(TitleClippingLengthProperty);
  1105. }
  1106. set
  1107. {
  1108. SetValue(TitleClippingLengthProperty, value);
  1109. }
  1110. }
  1111. /// <summary>
  1112. /// Gets or sets the color of the title.
  1113. /// </summary>
  1114. /// <value>The color of the title.</value>
  1115. public Color TitleColor
  1116. {
  1117. get
  1118. {
  1119. return GetValue(TitleColorProperty);
  1120. }
  1121. set
  1122. {
  1123. SetValue(TitleColorProperty, value);
  1124. }
  1125. }
  1126. /// <summary>
  1127. /// Gets or sets the title font.
  1128. /// </summary>
  1129. /// <value>The title font.</value>
  1130. public string TitleFont
  1131. {
  1132. get
  1133. {
  1134. return GetValue(TitleFontProperty);
  1135. }
  1136. set
  1137. {
  1138. SetValue(TitleFontProperty, value);
  1139. }
  1140. }
  1141. /// <summary>
  1142. /// Gets or sets the size of the title font.
  1143. /// </summary>
  1144. /// <value>The size of the title font.</value>
  1145. public double TitleFontSize
  1146. {
  1147. get
  1148. {
  1149. return GetValue(TitleFontSizeProperty);
  1150. }
  1151. set
  1152. {
  1153. SetValue(TitleFontSizeProperty, value);
  1154. }
  1155. }
  1156. /// <summary>
  1157. /// Gets or sets the title font weight.
  1158. /// </summary>
  1159. /// <value>The title font weight.</value>
  1160. public FontWeight TitleFontWeight
  1161. {
  1162. get
  1163. {
  1164. return GetValue(TitleFontWeightProperty);
  1165. }
  1166. set
  1167. {
  1168. SetValue(TitleFontWeightProperty, value);
  1169. }
  1170. }
  1171. /// <summary>
  1172. /// Gets or sets TitleFormatString.
  1173. /// </summary>
  1174. public string TitleFormatString
  1175. {
  1176. get
  1177. {
  1178. return GetValue(TitleFormatStringProperty);
  1179. }
  1180. set
  1181. {
  1182. SetValue(TitleFormatStringProperty, value);
  1183. }
  1184. }
  1185. /// <summary>
  1186. /// Gets or sets TitlePosition.
  1187. /// </summary>
  1188. public double TitlePosition
  1189. {
  1190. get
  1191. {
  1192. return GetValue(TitlePositionProperty);
  1193. }
  1194. set
  1195. {
  1196. SetValue(TitlePositionProperty, value);
  1197. }
  1198. }
  1199. /// <summary>
  1200. /// Gets or sets Unit.
  1201. /// </summary>
  1202. public string Unit
  1203. {
  1204. get
  1205. {
  1206. return GetValue(UnitProperty);
  1207. }
  1208. set
  1209. {
  1210. SetValue(UnitProperty, value);
  1211. }
  1212. }
  1213. /// <summary>
  1214. /// Gets or sets a value indicating whether UseSuperExponentialFormat.
  1215. /// </summary>
  1216. public bool UseSuperExponentialFormat
  1217. {
  1218. get
  1219. {
  1220. return GetValue(UseSuperExponentialFormatProperty);
  1221. }
  1222. set
  1223. {
  1224. SetValue(UseSuperExponentialFormatProperty, value);
  1225. }
  1226. }
  1227. /// <summary>
  1228. /// Gets or sets the <see cref="OxyPlot.EdgeRenderingMode"/> for the axis.
  1229. /// </summary>
  1230. public EdgeRenderingMode EdgeRenderingMode
  1231. {
  1232. get
  1233. {
  1234. return GetValue(EdgeRenderingModeProperty);
  1235. }
  1236. set
  1237. {
  1238. SetValue(EdgeRenderingModeProperty, value);
  1239. }
  1240. }
  1241. /// <summary>
  1242. /// Creates the model.
  1243. /// </summary>
  1244. /// <returns>An axis object.</returns>
  1245. public abstract Axes.Axis CreateModel();
  1246. /// <summary>
  1247. /// The visual appearance changed.
  1248. /// </summary>
  1249. /// <param name="d">The sender.</param>
  1250. /// <param name="e">The event args.</param>
  1251. protected static void AppearanceChanged(AvaloniaObject d, AvaloniaPropertyChangedEventArgs e)
  1252. {
  1253. ((Axis)d).OnVisualChanged();
  1254. }
  1255. /// <summary>
  1256. /// The on visual changed handler.
  1257. /// </summary>
  1258. protected void OnVisualChanged()
  1259. {
  1260. (this.Parent as IPlot)?.ElementAppearanceChanged(this);
  1261. }
  1262. /// <summary>
  1263. /// The data changed.
  1264. /// </summary>
  1265. /// <param name="d">The sender.</param>
  1266. /// <param name="e">The event args.</param>
  1267. protected static void DataChanged(AvaloniaObject d, AvaloniaPropertyChangedEventArgs e)
  1268. {
  1269. ((Axis)d).OnDataChanged();
  1270. }
  1271. /// <summary>
  1272. /// The on data changed handler.
  1273. /// </summary>
  1274. protected void OnDataChanged()
  1275. {
  1276. (this.Parent as IPlot)?.ElementDataChanged(this);
  1277. }
  1278. /// <summary>
  1279. /// The on property changed handler.
  1280. /// </summary>
  1281. /// <param name="e">The event args.</param>
  1282. protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
  1283. {
  1284. base.OnPropertyChanged(e);
  1285. if (e.Property.OwnerType == GetType() && Parent is IPlotView plot)
  1286. {
  1287. plot.InvalidatePlot();
  1288. }
  1289. }
  1290. /// <summary>
  1291. /// Synchronizes the properties.
  1292. /// </summary>
  1293. protected virtual void SynchronizeProperties()
  1294. {
  1295. var a = InternalAxis;
  1296. a.AbsoluteMaximum = AbsoluteMaximum;
  1297. a.AbsoluteMinimum = AbsoluteMinimum;
  1298. a.Angle = Angle;
  1299. a.AxisDistance = AxisDistance;
  1300. a.AxislineColor = AxislineColor.ToOxyColor();
  1301. a.AxislineStyle = AxislineStyle;
  1302. a.AxislineThickness = AxislineThickness;
  1303. a.AxisTitleDistance = AxisTitleDistance;
  1304. a.AxisTickToLabelDistance = AxisTickToLabelDistance;
  1305. a.ClipTitle = ClipTitle;
  1306. a.EndPosition = EndPosition;
  1307. a.ExtraGridlineColor = ExtraGridlineColor.ToOxyColor();
  1308. a.ExtraGridlineStyle = ExtraGridlineStyle;
  1309. a.ExtraGridlineThickness = ExtraGridlineThickness;
  1310. a.ExtraGridlines = ExtraGridlines;
  1311. a.FilterFunction = FilterFunction;
  1312. a.FilterMaxValue = FilterMaxValue;
  1313. a.FilterMinValue = FilterMinValue;
  1314. a.Font = Font;
  1315. a.FontSize = FontSize;
  1316. a.FontWeight = (int)FontWeight;
  1317. a.IntervalLength = IntervalLength;
  1318. a.IsPanEnabled = IsPanEnabled;
  1319. a.IsAxisVisible = IsAxisVisible;
  1320. a.IsZoomEnabled = IsZoomEnabled;
  1321. a.Key = Key;
  1322. a.Layer = Layer;
  1323. a.MajorGridlineColor = MajorGridlineColor.ToOxyColor();
  1324. a.MinorGridlineColor = MinorGridlineColor.ToOxyColor();
  1325. a.MajorGridlineStyle = MajorGridlineStyle;
  1326. a.MinorGridlineStyle = MinorGridlineStyle;
  1327. a.MajorGridlineThickness = MajorGridlineThickness;
  1328. a.MinorGridlineThickness = MinorGridlineThickness;
  1329. a.MajorStep = MajorStep;
  1330. a.MajorTickSize = MajorTickSize;
  1331. a.MinorStep = MinorStep;
  1332. a.MinorTickSize = MinorTickSize;
  1333. a.Minimum = Minimum;
  1334. a.Maximum = Maximum;
  1335. a.MinimumRange = MinimumRange;
  1336. a.MaximumRange = MaximumRange;
  1337. a.MinimumPadding = MinimumPadding;
  1338. a.MaximumPadding = MaximumPadding;
  1339. a.MinimumMargin = MinimumMargin;
  1340. a.MaximumMargin = MinimumMargin;
  1341. a.MinimumDataMargin = MinimumDataMargin;
  1342. a.MaximumDataMargin = MaximumDataMargin;
  1343. a.Position = Position;
  1344. a.PositionTier = PositionTier;
  1345. a.PositionAtZeroCrossing = PositionAtZeroCrossing;
  1346. a.StartPosition = StartPosition;
  1347. a.StringFormat = StringFormat;
  1348. a.TextColor = TextColor.ToOxyColor();
  1349. a.TicklineColor = TicklineColor.ToOxyColor();
  1350. a.TitleClippingLength = TitleClippingLength;
  1351. a.TitleColor = TitleColor.ToOxyColor();
  1352. a.TitleFont = TitleFont;
  1353. a.TitleFontSize = TitleFontSize;
  1354. a.TitleFontWeight = (int)TitleFontWeight;
  1355. a.TitleFormatString = TitleFormatString;
  1356. a.Title = Title;
  1357. a.ToolTip = (ToolTip.GetTip(this)?.ToString());
  1358. a.TickStyle = TickStyle;
  1359. a.TitlePosition = TitlePosition;
  1360. a.Unit = Unit;
  1361. a.UseSuperExponentialFormat = UseSuperExponentialFormat;
  1362. a.LabelFormatter = LabelFormatter;
  1363. a.EdgeRenderingMode = EdgeRenderingMode;
  1364. }
  1365. static Axis()
  1366. {
  1367. AbsoluteMaximumProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1368. AbsoluteMinimumProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1369. AngleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1370. AxisTickToLabelDistanceProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1371. AxisTitleDistanceProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1372. AxisDistanceProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1373. AxislineColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1374. AxislineStyleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1375. AxislineThicknessProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1376. ClipTitleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1377. EndPositionProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1378. ExtraGridlineColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1379. ExtraGridlineStyleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1380. ExtraGridlineThicknessProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1381. ExtraGridlinesProperty.Changed.AddClassHandler<Axis>(DataChanged);
  1382. FilterFunctionProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1383. FilterMaxValueProperty.Changed.AddClassHandler<Axis>(DataChanged);
  1384. FilterMinValueProperty.Changed.AddClassHandler<Axis>(DataChanged);
  1385. FontProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1386. FontSizeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1387. FontWeightProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1388. IntervalLengthProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1389. IsAxisVisibleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1390. KeyProperty.Changed.AddClassHandler<Axis>(DataChanged);
  1391. LabelFormatterProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1392. LayerProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1393. MajorGridlineColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1394. MajorGridlineStyleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1395. MajorGridlineThicknessProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1396. MajorStepProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1397. MajorTickSizeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1398. MaximumPaddingProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1399. MaximumMarginProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1400. MaximumDataMarginProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1401. MaximumProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1402. MaximumRangeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1403. MinimumPaddingProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1404. MinimumMarginProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1405. MinimumDataMarginProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1406. MinimumProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1407. MinimumRangeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1408. MinorGridlineColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1409. MinorGridlineStyleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1410. MinorGridlineThicknessProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1411. MinorStepProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1412. MinorTickSizeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1413. PositionAtZeroCrossingProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1414. PositionProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1415. PositionTierProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1416. StartPositionProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1417. StringFormatProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1418. TextColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1419. TickStyleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1420. TicklineColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1421. TitleClippingLengthProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1422. TitleColorProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1423. TitleFontProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1424. TitleFontSizeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1425. TitleFontWeightProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1426. TitleFormatStringProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1427. TitlePositionProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1428. TitleProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1429. UnitProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1430. UseSuperExponentialFormatProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1431. EdgeRenderingModeProperty.Changed.AddClassHandler<Axis>(AppearanceChanged);
  1432. }
  1433. }
  1434. }