Dear sir , i am using the zedgraph to plot a graph between load and time , I want to remove the the line which is running from origin to the current point ,
Please sir , suggest me how to proceed , i want to plot the real time load vs time , but no connecting line.
Please find the attached file....for reference
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
The code reads data from serial port "COM7" ,
1st byte = '$'
2nd byte =MSB from load cell data.
3rd byte = LSB from load cell data.
merges the data in temp1
plots the temp1 vs every reading as i .
Here is the code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using ZedGraph;
namespace zedgraph3
{
public partial class Form1 : Form
{
// Open the port for communications
byte[] serdata = new byte[10];
double[] x = new double[10000];
double[] y = new double[10000];
//double[] z = new double[10000];
//double[] temp = new double[200];
int i=0 , l=0,m=0,n=0;
int temp1 = 0;
byte data_act = 0,data0=0,data1=0,data2=0;
byte match_flag = 0,attempt = 0;
//SerialPort port = new SerialPort("COM7", 9600, Parity.None, 8, StopBits.One);
int hours, mins, seconds=0;
public Form1()
{
InitializeComponent();
foreach (string s in SerialPort.GetPortNames())
MessageBox.Show(s.ToString());
}
System.IO.Ports.SerialPort port;
static public double voltage;
static public string portname;
static public Parity parity;
static public int BaudRate;
static public StopBits stopbits;
public int databits;
private void Form1_Load(object sender, EventArgs e)
{
portname = "COM7";
parity = Parity.None;
BaudRate = 9600;
stopbits = StopBits.Two;
databits = 8;
port = new System.IO.Ports.SerialPort(portname);
port.Parity = parity;
port.BaudRate = BaudRate;
port.StopBits = stopbits;
port.DataBits = databits;
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
port.Open();
}
void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
// read one byte data into bt
port.Read(serdata , 0 ,1);
data_act = serdata[0];
i++;
if (i > 9999)
{ i = 0; }
if ((data_act == '$') && (match_flag == 0))
{ match_flag = 1;}
if ((match_flag == 1) && (data_act != '$'))
{ data1 = data_act; m = data1; match_flag = 2; }
if ((match_flag == 2) && (data_act != '$'))
{
if (attempt == 1)
{
data2 = data_act; n = data2;
temp1 = data1;
temp1 = temp1 << 8;
temp1 = temp1 | data2;
match_flag = 0; attempt = 0;
}
else
{ attempt = 1; }
}
//label4.Text = temp1.ToString() + " counts";
x[i] = Convert.ToDouble(i);
y[i] = Convert.ToDouble(temp1);
// y[i] = Convert.ToDouble(serdata[0]);
zedGraphControl1.GraphPane.CurveList.Clear();
// GraphPane object holds one or more Curve objects (or plots)
GraphPane myPane = zedGraphControl1.GraphPane;
myPane.Title.Text = "Load cell data plotting";
myPane.XAxis.Title.Text = "Time(ms)";
myPane.YAxis.Title.Text = "Weight(gms)";
// myPane.YAxis.Scale.MagAuto = false;
// PointPairList holds the data for plotting, X and Y arrays
PointPairList spl1 = new PointPairList(x, y);
// RollingPointPairList aaa = new RollingPointPairList(i);
// Add curves to myPane object
LineItem myCurve = myPane.AddCurve("ADC", spl1, Color.Red, SymbolType.None);
//myCurve.Line.IsVisible = false;
myCurve.Line.Width = 1.0F;
// LineItem myCurve = myPane.AddCurve("ADC", aaa, Color.Blue, SymbolType.None);
// BarItem mybar = myPane.AddBar("plotting", x , y, Color.Red);
// I add all three functions just to be sure it refeshes the plot.
zedGraphControl1.AxisChange();
//zedGraphControl1.Refresh();
zedGraphControl1.Invalidate();
}
Please suggest how to remove that line .......