c# - Chart set Vertical Bar Marker -


on chart, want put obvious red vertical bar goes specific point on plot down x-axis. there way this? based on documentation, doesn't seem option available or perhaps i'm looking in wrong area.

the obvious way add verticallineannotation.

here example: enter image description here

first set few things:

int yourpointindex = 635; series s1 = chart1.series[0]; chartarea ca1 = chart1.chartareas[0]; 

now create annotation , style little:

verticallineannotation la = new verticallineannotation(); la.linecolor = color.red; la.linewidth = 9; la.isinfinitive = false; la.anchordatapoint = s1.points[yourpointindex]; ; 

now position point in question:

la.x = s1.points[yourpointindex].xvalue; la.y = s1.points[yourpointindex].yvalues[0];  // makes bar go down 0 axis la.height = la.y; // makes go down way x-axis: la.height = la.y - ca1.axisy.minimum; // should clip our chartarea: la.cliptochartarea = ca1.name; 

finally added annotations collection of chart.

chart1.annotations.add(la); 

note annotations can adorned , made moveable..

note: code above written , tested winforms ms chart control rather similar in versions..


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -