private void DrawSeries(Series series) { if (Mathf.Abs(series.width - graphRect.width) > 0.1f) { series.width = Mathf.Lerp(0, graphRect.width, series.deltaTime += Time.deltaTime * 0.5f); } GUI.BeginGroup(series.GetRect()); List <float> values = series.values; //Color color = (series.label == convergeManager.selected) ? Color.white : convergeManager.seriesColors [series.label]; Color color = convergeManager.seriesColors [series.label]; float thickness = (series.label == convergeManager.selected) ? thicknessLineSelected : thicknessLine; //jtc - new { // Draw First Point string text = ("<color=#" + convergeManager.seriesColorsHex [series.label] + ">" + series.label + "</color>" + '\n' + values [xMin].ToString("F2")); //DrawMarker(series.label, new Rect(hStart.x + xUnitLength - 7, hStart.y - (values[xMin] / yRange * yAxisLength) - 7, 14, 14), color, text); } for (int i = 1; i < Mathf.Min(series.values.Count, xNumMarkers); i++) { // Previous Point float xPos = hStart.x + xUnitLength * i; float yPos = hStart.y - (values [xMin + i - 1] / yRange * yAxisLength); // Current Point float xPosNext = hStart.x + xUnitLength * (i + 1); float yPosNext = hStart.y - (values [xMin + i] / yRange * yAxisLength); // Connect the Points by Drawing Line Drawing.DrawLine(new Vector2(xPos, yPos), new Vector2(xPosNext, yPosNext), color, thickness, true); // Draw End Point string text = ("<color=#" + convergeManager.seriesColorsHex [series.label] + ">" + series.label + "</color>" + '\n' + values [xMin + i].ToString("F2")); //DrawMarker(series.label, new Rect(xPosNext - 7, yPosNext - 7, 14, 14), color, text); } GUI.EndGroup(); }
private void DrawSeries(Series series) { if (Mathf.Abs (series.width - graphRect.width) > 0.1f) { series.width = Mathf.Lerp (0, graphRect.width, series.deltaTime += Time.deltaTime * 0.5f); } GUI.BeginGroup (series.GetRect ()); List<float> values = series.values; //Color color = (series.label == convergeManager.selected) ? Color.white : convergeManager.seriesColors [series.label]; Color color = convergeManager.seriesColors [series.label]; float thickness = (series.label == convergeManager.selected) ? thicknessLineSelected : thicknessLine; //jtc - new { // Draw First Point string text = ("<color=#" + convergeManager.seriesColorsHex [series.label] + ">" + series.label + "</color>" + '\n' + values [xMin].ToString ("F2")); //DrawMarker(series.label, new Rect(hStart.x + xUnitLength - 7, hStart.y - (values[xMin] / yRange * yAxisLength) - 7, 14, 14), color, text); } for (int i = 1; i < Mathf.Min(series.values.Count, xNumMarkers); i++) { // Previous Point float xPos = hStart.x + xUnitLength * i; float yPos = hStart.y - (values [xMin + i - 1] / yRange * yAxisLength); // Current Point float xPosNext = hStart.x + xUnitLength * (i + 1); float yPosNext = hStart.y - (values [xMin + i] / yRange * yAxisLength); // Connect the Points by Drawing Line Drawing.DrawLine (new Vector2 (xPos, yPos), new Vector2 (xPosNext, yPosNext), color, thickness, true); // Draw End Point string text = ("<color=#" + convergeManager.seriesColorsHex [series.label] + ">" + series.label + "</color>" + '\n' + values [xMin + i].ToString ("F2")); //DrawMarker(series.label, new Rect(xPosNext - 7, yPosNext - 7, 14, 14), color, text); } GUI.EndGroup (); }