Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
namespace VistaBalanceAlgorithms
{
    public class VerticalForce
    {
        public static float SteadyStateTotalForce = 1;
        public static bool SteadyState = false;

        public VerticalForce(float[] frameValues)
        {
            Left = 0;
            Right = 0;
            Total = 0;

            if (frameValues != null)
            {
                float leftForce = frameValues.Take(frameValues.Length / 2).Sum();
                float rightForce = frameValues.Skip(frameValues.Length / 2).Sum();
                Left = (int)((leftForce / SteadyStateTotalForce) * 100);
                Right = (int)((rightForce / SteadyStateTotalForce) * 100);

                Left = Left < 0 ? 0 : Left;
                Right = Right < 0 ? 0 : Right;

                Total = Left + Right;
            }
        }

        public int Left { get; protected set; }
        public int Right { get; protected set; }
        public int Total { get; protected set; }
    }

    public class VerticalForceGraph
    {
        private List<VerticalForce> vtfList = new List<VerticalForce>();

        public int BufferSize { get; set; }

        public void Add(VerticalForce vtf)
        {
            vtfList.Add(vtf);
        }

        public void Reset() { vtfList.Clear(); }

        public int Count {get{return vtfList.Count;} }

        public float[] GetLeftVTF()
        {
            return vtfList.Select(x => (float)x.Left).ToArray();
        }

        public float[] GetLeftVTF(int startPoint, int count)
        {
            return vtfList.GetRange(startPoint, count).Select(x => (float)x.Left).ToArray();
        }

        public float[] GetRightVTF()
        {
            return vtfList.Select(x => (float)x.Right).ToArray();
        }

        public float[] GetRightVTF(int startPoint, int count)
        {
            return vtfList.GetRange(startPoint, count).Select(x => (float)x.Right).ToArray();
        }

        public float[] GetTotalVTF()
        {
            return vtfList.Select(x => (float)x.Total).ToArray();
        }

        public float[] GetTotalVTF(int startPoint, int count)
        {
            return vtfList.GetRange(startPoint, count).Select(x => (float)x.Total).ToArray();
        }
    }
}





I want to call these methods and draw line chart for each

What I have tried:

This is my mainform.cs

C#

private void toolStripMenuItemVtfGraphicalView_Click(object sender, EventArgs e)
       {
           m_viewMode = viewModes.VTF_GRAPHICAL_VIEW;
           panelHeatMap.viewMode = m_viewMode;

           toolStripDropDownViewMode.Text = toolStripMenuItemVtfGraphicalView.Text;
           chart1.Visible = true;
           for (int i = 10; i < 100; i += 50)
           {
               chart1.Series["Left Vtf"].Points.AddXY(vtfGraph.GetLeftVTF(),i);
               chart1.Series["Right Vtf"].Points.AddXY(vtfGraph.GetRightVTF(),i);
               chart1.Series["Total Vtf"].Points.AddXY(vtfGraph.GetTotalVTF(),i);
           }


       }
Posted
Updated 22-Aug-17 15:57pm
Comments
BillWoodruff 23-Aug-17 4:25am    
And what's happening now that you want to change ?

1 solution

MSDN provides a basic tutorials using System.Windows.Forms.DataVisualization.Charting, the below links refer to Visual Studio 2012;
MSDN - Tutorial: Creating a Basic Chart
[^]
More detailed version;
MSDN: Chart Controls[^]

I am using the .Net Framework 4.5 equivalent in an MVC site & it works for what I need

Kind Regards
 
Share this answer
 
Comments
Member 13210933 23-Aug-17 10:35am    
thanks dear.,but i wanna cal these GetLeftVTF() function and it should b working like live...on data connect...but its not working.
an0ther1 23-Aug-17 19:53pm    
What Chart component are you using?
If you are using the one I identified then you need to read the documentation & debug it. If not then refer to the documentation of the control you are using.
One thing I can tell you from the documentation, the method AddXY does not accept an array for your X value - refer; https://msdn.microsoft.com/en-us/library/dd456289(d=hv.2,v=vs.110).aspx
Happy to help but we can only see the information you have provided

Kind Regards
Member 13210933 24-Aug-17 11:51am    
thanks dear...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900