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();
}
private VerticalForceGraph vtfGraph = new VerticalForceGraph();
public void setVTFData(float[] frameValues)
{
if (vtfGraph != null)
{
vtfGraph.Add(new VerticalForce(frameValues));
}
}
//this is a panel in which i want to display line chart
private void VtfGraphicalViewMode(Graphics graphics)
{
Pen yellowPen = new Pen(Color.Yellow, 2);
Pen bluePen = new Pen(Color.Blue, 2);
Pen redPen = new Pen(Color.Red, 2);
int hOffset = heatmapWidth / 2;
int vOffset = heatmapHeight / 2;
using (Font title_font = new Font("Times New Roman", 20))
{
using (StringFormat string_format = new StringFormat())
{
string_format.Alignment = StringAlignment.Center;
string_format.LineAlignment = StringAlignment.Center;
Point title_center = new Point(this.heatmapWidth / 2, 20);
Point titleleft = new Point(this.heatmapHeight / 4, heatmapWidth / 10);
Font leftfornt = new Font("Times New Roman", 10);
Font totalfont = new Font("Times New Roman", 10);
Font rightfont = new Font("Times New Roman", 10);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawRectangle(outline, new Rectangle(heatmapCoord_X, heatmapCoord_Y, heatmapWidth, heatmapHeight));
Rectangle graph_area = new Rectangle(heatmapCoord_X, heatmapCoord_Y, heatmapWidth, heatmapHeight);
graphics.FillRectangle(Brushes.LightBlue, graph_area);
Label label = new Label();
graphics.DrawString("VTF Grahical View",
title_font, Brushes.Red,
title_center, string_format);
int xOffset = 50;
int yOffset = 20;
graphics.DrawLine(redPen,
heatmapCoord_X + xOffset, heatmapCoord_Y + (heatmapHeight - 50), heatmapCoord_X + xOffset, heatmapCoord_Y + yOffset
);
graphics.DrawLine(redPen,
heatmapCoord_X + (heatmapWidth - 10), heatmapCoord_Y + (heatmapHeight - 50), heatmapCoord_X + xOffset, heatmapCoord_Y + (heatmapHeight - 50)
);
if (vtfGraph.Count > 0)
{
float[] left = vtfGraph.GetLeftVTF(0, (vtfGraph.Count > 100 ? 100 : vtfGraph.Count - 1));
for (int i = 0; i < 100; i++)
{
}
}
}
}
What I have tried:
//left has array of values
//i want to plot these values in line graph
//i already defines x and y axis
float[] left = vtfGraph.GetLeftVTF(0, (vtfGraph.Count > 100 ? 100 : vtfGraph.Count - 1));