void onUpdateAnimateAddPoint(Vector2 newEnd, Vector2 oldEnd, Vector2 newStart, Vector2 oldStart) { series1.pointValues[series1.pointValues.Count - 1] = WMG_Util.RemapVec2(addPointAnimTimeline, 0, 1, oldEnd, newEnd); float previousAxisMax = graph.xAxis.AxisMaxValue; float previousAxisMin = graph.xAxis.AxisMinValue; graph.xAxis.AxisMaxValue = WMG_Util.RemapFloat(addPointAnimTimeline, 0, 1, oldEnd.x, newEnd.x); updateIndicator(); if (moveXaxisMinimum) { series1.pointValues[0] = WMG_Util.RemapVec2(addPointAnimTimeline, 0, 1, oldStart, newStart); graph.xAxis.AxisMinValue = WMG_Util.RemapFloat(addPointAnimTimeline, 0, 1, oldStart.x, newStart.x); if (moveVerticalGridLines) { float totalXaxisValue = previousAxisMax - previousAxisMin; float axisValuePerGridLine = totalXaxisValue / (graph.xAxis.AxisNumTicks - 1); float axisPixelsPerLength = graph.xAxis.AxisLength / totalXaxisValue; float axisPixelsPerGridLine = axisPixelsPerLength * axisValuePerGridLine; float axisValueMoveAmt = graph.xAxis.AxisMinValue - previousAxisMin; currentXaxisGridOffset += axisPixelsPerLength * axisValueMoveAmt; // reset the grid offset by the amount of space between two gridlines, otherwise would need to increase # of grid lines if (currentXaxisGridOffset > axisPixelsPerGridLine) { currentXaxisGridOffset -= axisPixelsPerGridLine; } // get the first grid line and hide if position is offset, otherwise will see a a grid line outside of the graph boundaries graph.xAxis.GridLines.GetComponent <WMG_Grid>().getColumn(0)[0].links[0].gameObject.SetActive(currentXaxisGridOffset == 0); graph.changeSpritePositionToX(graph.xAxis.GridLines, -currentXaxisGridOffset); } } }
void onUpdateAnimateAddPoint(Vector2 newEnd, Vector2 oldEnd, Vector2 newStart, Vector2 oldStart) { series1.pointValues[series1.pointValues.Count - 1] = WMG_Util.RemapVec2(addPointAnimTimeline, 0, 1, oldEnd, newEnd); graph.xAxis.AxisMaxValue = WMG_Util.RemapFloat(addPointAnimTimeline, 0, 1, oldEnd.x, newEnd.x); updateIndicator(); if (moveXaxisMinimum) { series1.pointValues[0] = WMG_Util.RemapVec2(addPointAnimTimeline, 0, 1, oldStart, newStart); graph.xAxis.AxisMinValue = WMG_Util.RemapFloat(addPointAnimTimeline, 0, 1, oldStart.x, newStart.x); } }
private void onAutoAnimUpdate(WMG_Series aSeries) { List <Vector2> newPositions = new List <Vector2>(); List <int> newWidths = new List <int>(); List <int> newHeights = new List <int>(); for (int i = 0; i < aSeries.AfterPositions.Count; i++) { newPositions.Add(WMG_Util.RemapVec2(aSeries.autoAnimationTimeline, 0, 1, aSeries.OrigPositions[i], aSeries.AfterPositions[i])); newWidths.Add(Mathf.RoundToInt(WMG_Util.RemapFloat(aSeries.autoAnimationTimeline, 0, 1, aSeries.OrigWidths[i], aSeries.AfterWidths[i]))); newHeights.Add(Mathf.RoundToInt(WMG_Util.RemapFloat(aSeries.autoAnimationTimeline, 0, 1, aSeries.OrigHeights[i], aSeries.AfterHeights[i]))); } aSeries.UpdateVisuals(newPositions, newWidths, newHeights); }
void onUpdateAnimateAddPoint(Vector2 newEnd, Vector2 oldEnd, Vector2 newStart, Vector2 oldStart) { series1.pointValues[series1.pointValues.Count - 1] = WMG_Util.RemapVec2(addPointAnimTimeline, 0, 1, oldEnd, newEnd); graph.xAxis.AxisMaxValue = WMG_Util.RemapFloat(addPointAnimTimeline, 0, 1, oldEnd.x, newEnd.x); }