Home > Mobile >  MPAndroidChart on at some point draw a vertical line
MPAndroidChart on at some point draw a vertical line

Time:09-26

Use MPAndroidChart API will a set of drawing a line chart, as shown in figure

Now I want to get to a point on the graph, marking up with vertical lines, as shown in figure

I know MPAndroidChart a touch similar straight line, but I don't need to touch, but for this point in your code, then use linear marked, is can implement

CodePudding user response:

SetDrawVerticalHighlightIndicator ();
SetDrawVerticalHighlightIndicator ();

CodePudding user response:

//set X
XAxis XAxis.=lineChart getXAxis ();
XAxis. SetPosition (xAxis. XAxisPosition. BOTTOM);//set the position of the X axis
//draw the limit line
LimitLine line=new LimitLine (x, "middle");
Line. EnableDashedLine (1 f, 4 f, 0 f);//dotted line
Line. SetLineColor (Color. ParseColor (" # d91111 "));
Line. SetLineWidth (1 f);
Line. SetTextColor (Color. ParseColor (" # d91111 "));
XAxis. AddLimitLine (line);
  • Related