// Constructor function public Plotter(Canvas c) { // set properties CanvasToDrawOn = c; /* * Here needs an explanation. * * First motivation to give user control over whether or not show pointmarks and polyline was processing power. * * Since polyline does not require me to re iterate over every single point to be drawn on canvas, (idk if it happens at the background :p) * I thought that it would be a better practise to give user the chance to disable that for loop to get a better performance * * Before: * if visibility for pointmarks is set to false, it doesnt get drawn for performance considerations * Now: * ifvisibility for pointmarks is set to false, it does get drawn, however now its opacity is 0% * * this is because we need to show "tooltip" for polyliner also * * */ PointMarksVisible = false; PolylineVisible = true; PointMarks = new PointMarks(MarkerType.Triangle); Polyliner = new Polyliner(); AutoIncrementedDataPoints = new List <DataPoint>(); CurrentDataPoints = AutoIncrementedDataPoints; //CanvasToDrawOn.Width = CanvasToDrawOn.Width; //CanvasToDrawOn.Height = CanvasToDrawOn.Height; AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height); // Instead of "AxesWithOrigin(double width, double height)" one can prefer "AxesWithOrigin(double width, double height, Tuple origin)" as default action like shown down below // AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height, new System.Tuple<double, double>(CanvasToDrawOn.Width / 2, CanvasToDrawOn.Height)); CanvasToDrawOn.Background = new SolidColorBrush(Colors.WhiteSmoke); NotReadyToRefresh = false; // Events CanvasToDrawOn.MouseLeave += CanvasToDrawOn_MouseLeave; CanvasToDrawOn.MouseEnter += CanvasToDrawOn_MouseEnter; CanvasToDrawOn.MouseWheel += CanvasToDrawOn_MouseWheel; }
// Constructor function public Plotter(Canvas c) { // set properties CanvasToDrawOn = c; PointMarksVisible = false; PolylineVisible = true; PointMarks = new PointMarks(MarkerType.Triangle); Polyliner = new Polyliner(); AutoIncrementedDataPoints = new List <DataPoint>(); CanvasToDrawOn.Width = 650; CanvasToDrawOn.Height = 300; AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height); // Instead of "AxesWithOrigin(double width, double height)" one can prefer "AxesWithOrigin(double width, double height, Tuple origin)" as default action like shown down below // AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height, new System.Tuple<double, double>(CanvasToDrawOn.Width / 2, CanvasToDrawOn.Height)); CanvasToDrawOn.Background = new SolidColorBrush(Colors.WhiteSmoke); }