vb.net - VB - displaying chart from datagridview -
i willing show line chart based datagridview, able show not x values, showing each 5 or 10 values, example had record of temperature in room every hour in 10 days, got 24x10 = 240 data, able show value in each every 3 hour showed on chart. ex. have data 1-100 want show chart each data 5,10,15,20,... how possibly done ?
chart1.series(0).charttype = datavisualization.charting.seriescharttype.line chart1.series(0).points.clear() count integer = 0 datagridview1.rows.count - 1 chart1.series(0).points.addxy(datagridview1.item(0, count).value, datagridview1.item(2, count).value) next
the code above has showed normal line chart.
skip points don't want plot in loop using mod in vb.net
dim divisor = 3 chart1.series(0).charttype = datavisualization.charting.seriescharttype.line chart1.series(0).points.clear() count integer = 0 datagridview1.rows.count - 1 if (datagridview1.item(0, count).value mod divisor = 0) chart1.series(0).points.addxy(datagridview1.item(0, count).value, datagridview1.item(2, count).value) end if next count
this skips x values 3 not divide without remainder. can change dim divisor = 3
dim divisor = 5
skip x values 5 not divide without remainder, etc.
Comments
Post a Comment