/NerdSharp.Net_Studio/NerdSharp_UberNet/Science/Math/TypeLibrary/Graphs_ChartsWidgets/Utils.cs
C# | 45 lines | 36 code | 1 blank | 8 comment | 2 complexity | 68217f1a4a68a73336d27f9b94fa4aac MD5 | raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Shapes;
- using M = System.Math;
-
- namespace NerdSharp.Net_Studio.NerdSharp_UberNet.Science.Math.TypeLibrary.Graphs_ChartsWidgets
- {
- public static class Utils
- {
- /// <summary>
- ///
- /// </summary>
- /// <param name="gridObj"></param>
- /// <param name="graphPoint"></param>
- /// <returns></returns>
- public static Point FromGraphToScreen(double width, double height, Point graphPoint)
- {
- Point pt = new Point(width / 2, height / 2);
- //MessageBox.Show(pt.ToString());
- //takes care of the x coordinate conversion
- if (graphPoint.Y < 0)
- {
- pt.Y += M.Abs(graphPoint.Y);
- }
- else
- {
- pt.Y -= graphPoint.Y;
- }
- if (graphPoint.X < 0)
- {
- pt.X -= M.Abs(graphPoint.X);
- }
- else
- {
- pt.X += graphPoint.X;
- }
- return pt;
- }
- }
- }