/// <summary> /// This method adjusts the ui view, so that only the values, that correspond to the particular view, can be seen /// </summary> public bool SetView(StatisticsView.View view) { if (originalStats == null) { return(false); } float viewHours = StatisticsView.GetHours(view); // the date time of the last point of the original statstics converted to hours float lastTotalHours = visualizer.DateToHours(System.Convert.ToDateTime(originalStats.GetLastPoint().GetX())); // the date time of the first point of the original statstics converted to hours float firstTotalHours = visualizer.DateToHours(System.Convert.ToDateTime(originalStats.GetPoints()[0].GetX())); // If the current view includes points that the statistics cannot provide, ... if (lastTotalHours - viewHours < firstTotalHours && viewHours != -1) { // ... do not change the view. return(false); } // set xMax that correspond to the view int xMax = (int)viewHours; if (xMax < 0) { xMax = originalXMax; } visualizer.SetXMax(xMax); // set the amount of x ledger lines that correspond to the view int xLedgerLineAmount = StatisticsView.GetXLedgerLineAmount(view); if (xLedgerLineAmount < 0) { xLedgerLineAmount = originalXLedgerLines; } visualizer.SetXLedgerLineAmount(xLedgerLineAmount); // set the x unit that correspond to the view xUnit.Units unit = StatisticsView.GetUnit(view); if (unit == xUnit.Units.NUMBER) { unit = originalUnit; } visualizer.SetUnit(unit); // draw all circles and lines that correspond to the new statistics visualizer.Repaint(); return(true); }
public void SetUnit(xUnit.Units unit) { this.unit = unit; }
private void Start() { originalXLedgerLines = visualizer.GetXLedgerLineAmount(); originalUnit = visualizer.GetUnit(); originalXMax = visualizer.GetXMax(); }