Home > Net >  Abscissa c # using the chart control, real time, while adding a rolling shaft scrollbar. The first r
Abscissa c # using the chart control, real time, while adding a rolling shaft scrollbar. The first r

Time:11-21

Background/requirements: VS application of control chart, the abscissa for real time, join the rolling shaft scrollbar at the same time, the data quantity exceeds a certain value, the rolling axis compression,

Abscissa question: is not the time format, can display properly, such as requiring a 20 data, scrolling axis and compression, but changed to time the Datetime format, abscissa program began to run time will show the scrollbar, and click to display the curve,





The chart control initialization code:

Chart1. ChartAreas [0]. AxisX. ScaleView. Size=xvalue;

Chart1. ChartAreas [0]. AxisX. ScaleView. SizeType=DateTimeIntervalType. Seconds;

Chart1. ChartAreas [0]. AxisX. ScaleView. MinSize=1;//15;

Chart1. ChartAreas [0]. AxisX. ScaleView. MinSizeType=DateTimeIntervalType. Seconds;

Chart1. ChartAreas [0]. AxisX. ScaleView. SmallScrollMinSize=1;

Chart1. ChartAreas [0]. AxisX. ScaleView. SmallScrollMinSizeType=DateTimeIntervalType. Seconds;



Chart1. ChartAreas [0]. AxisX. Interval=1;//this interval can be used to modify the display interval, because the above Settings unit for seconds, intervals of 0.5 seconds here

Chart1. ChartAreas [0]. AxisX. IntervalType=DateTimeIntervalType. Seconds;



Chart1. ChartAreas [0]. AxisX. LabelStyle. Format="HH: mm: ss";//x time display format too: minutes: seconds

X display time format, is 24-hour HH is capitalized, HH lowercase is 12 hours when



The default series

Chart1. Series. The Clear ();

The Series newSeries=new Series (" Series1 ");



NewSeries. ChartType=SeriesChartType. Line;//curve for the line

NewSeries. BorderWidth=2;//line width 2 pixels

NewSeries. Color=System. Drawing. Color. Black;//black line

NewSeries. IsVisibleInLegend=false;//do not display line navigation items

NewSeries. XValueType=ChartValueType. DateTime;

Chart1. Series. The Add (newSeries);



Add code line point:

DT=DateTime. Now;

Chart1. Series [0]. Points. AddXY (DT, IntResult);

CodePudding user response:

UPUPUP
  •  Tags:  
  • C#
  • Related