staticinlineboolfillPoint_Gray(QImage&image,QPointp,ucharlow,ucharhigh,ucharnewVal,QStack
{
intx=p.rx();
inty=p.ry();
uchar*line=image.scanLine(y);
if(line[x]
{
returnfalse;
}
line[x]=newVal;
if(y>0)
{
uchar*last=image.scanLine(y-1);
if(last[x]>=low&&last[x]<=high)
{
stack.push(QPoint(x,y-1));
}
扩展资料
C#中以时间作为chart的X坐标轴间隔
privatevoidinitChart()
{
Seriesseries=chart1.Series[0];
series.ChartType=SeriesChartType.Line;
series.XValueType=ChartValueType.DateTime;
chart1.ChartAreas[0].AxisX.LabelStyle.Format="HH:mm:ss";//毫秒格式:hh:mm:ss.fff,后面几个f则保留几位毫秒小数,此时要注意轴的最大值和最小值不要差太大
chart1.ChartAreas[0].AxisX.LabelStyle.IntervalType=DateTimeIntervalType.Milliseconds;
chart1.ChartAreas[0].AxisX.MajorGrid.IntervalType=DateTimeIntervalType.Milliseconds;
chart1.ChartAreas[0].AxisX.ScrollBar.Enabled=true;
chart1.ChartAreas[0].AxisY.ScaleView.Size=5;
chart1.ChartAreas[0].AxisY.ScrollBar.Enabled=true;
chart1.ChartAreas[0].AxisX.Minimum=DateTime.Now.ToOADate();
chart1.ChartAreas[0].AxisX.Maximum=DateTime.Now.AddSeconds(1).ToOADate();
series.Points.AddXY(DateTime.Now.ToOADate(),0);
}
///
///刷新波形图曲线
///
///
privatevoidSet_ZGraph_steadyTest(objectobj)
{
List
List
DataSetds=(DataSet)obj;
listX.Clear();
listY.Clear();
for(inti=0;i { listX.Add(DateTime.Parse((string)ds.Tables[0].Rows[i][0])); listY.Add(Convert.ToDouble(ds.Tables[0].Rows[i][1])); } chart1.Series[0].Points.DataBindXY(listX,listY); chart1.ChartAreas[0].AxisX.Minimum=listX[0].ToOADate(); chart1.ChartAreas[0].AxisX.Maximum=listX[ds.Tables[0].Rows.Count-1].AddSeconds(1).ToOADate(); chart1.ChartAreas[0].AxisY.ScaleView.Size=listY.Max()+listY.Min()+1; }
可以手动调整数据为时间格式的数据
series.XValueType = ChartValueType.Time;
series.ToolTip = "时间:#VALX 值#VALY";
series.Points.AddXY(DateTime.Parse(item.time.ToString("H:mm:ss")).ToOADate(),
ConvertToDoubleFromString(obj.传输数据));
chart.Series.Add(series);