/// <summary> /// add 'new' bar with new value and remove oldest bar /// </summary> /// <param name="value">height of new bar</param> /// <returns>discarded value</returns> public float Queue(float value) { // we move all shapes by 1 left ILPoint3Df offset = new ILPoint3Df(-1f, 0, 0); for (int i = 0; i < m_quads.Length; i++) { m_quads[i].Translate(offset); // FADE OUt old barsss .... m_quads[(i + m_oldestBarIndex) % (m_quads.Length - 1)].Opacity = (byte)(m_oldestOpacity + i * (255 - m_oldestOpacity) / m_quads.Length); // tell the scene to update its size m_quads[i].Invalidate(); } // configure oldest graph ILQuad newestQuad = m_quads[m_oldestBarIndex]; offset.X = m_quads.Length; newestQuad.Translate(offset); float ret = newestQuad.Vertices[2].YPosition; newestQuad.Vertices[2].YPosition = value; newestQuad.Vertices[3].YPosition = value; newestQuad.Opacity = 255; if (++m_oldestBarIndex >= m_quads.Length) { m_oldestBarIndex = 0; } return(ret); }
protected void createQuads(ILBaseArray data) { if (data == null || data.Length == 0) { Clear(); m_quads = new ILQuad[0]; } else { Clear(); m_quads = new ILQuad[data.Length]; ILColorEnumerator colors = new ILColorEnumerator(); ILArray <float> fData = null; if (data is ILArray <float> ) { fData = (ILArray <float>)data; } else { fData = ILMath.tosingle(data); } for (int i = 0; i < m_quads.Length; i++) { m_quads[i] = new ILQuad(m_panel); m_quads[i].Border.Visible = true; m_quads[i].FillColor = colors.NextColor(); ILPoint3Df pos = new ILPoint3Df(); pos.X = i - m_barWidth / 2; pos.Y = 0; pos.Z = -0.5f; m_quads[i].Vertices[0].Position = pos; pos.X += m_barWidth; m_quads[i].Vertices[1].Position = pos; pos.Y += fData.GetValue(i); m_quads[i].Vertices[2].Position = pos; pos.X -= m_barWidth; m_quads[i].Vertices[3].Position = pos; // label the bar m_quads[i].Label.Text = i.ToString(); m_quads[i].Label.Anchor = new PointF(.5f, -1); // bars will be transparent, oldest fading to OpacityOldest m_quads[i].Opacity = (byte)(m_oldestOpacity + i * (255 - m_oldestOpacity) / m_quads.Length); // add the bar to the scene graph node (base) Add(m_quads[i]); } } }
protected void createQuads(ILBaseArray data) { if (data == null || data.Length == 0) { Clear(); m_quads = new ILQuad[0]; } else { Clear(); m_quads = new ILQuad[data.Length]; ILColorEnumerator colors = new ILColorEnumerator(); ILArray<float> fData = null; if (data is ILArray<float>) { fData = (ILArray<float>)data; } else { fData = ILMath.tosingle(data); } for (int i = 0; i < m_quads.Length; i++) { m_quads[i] = new ILQuad(m_panel); m_quads[i].Border.Visible = true; m_quads[i].FillColor = colors.NextColor(); ILPoint3Df pos = new ILPoint3Df(); pos.X = i - m_barWidth / 2; pos.Y = 0; pos.Z = -0.5f; m_quads[i].Vertices[0].Position = pos; pos.X += m_barWidth; m_quads[i].Vertices[1].Position = pos; pos.Y += fData.GetValue(i); m_quads[i].Vertices[2].Position = pos; pos.X -= m_barWidth; m_quads[i].Vertices[3].Position = pos; // label the bar m_quads[i].Label.Text = i.ToString(); m_quads[i].Label.Anchor = new PointF(.5f,-1); // bars will be transparent, oldest fading to OpacityOldest m_quads[i].Opacity = (byte)(m_oldestOpacity + i * (255 - m_oldestOpacity) / m_quads.Length); // add the bar to the scene graph node (base) Add(m_quads[i]); } } }