I'm not to expert programming, I'm i currently writing a program for my personal use and I need to add a Mark Line but I dont know how to do it.
I have my plot values between 3000, 5000 in 5 by 5 steps, but I need to add a Mark Line not in an exact point, for example I need a Mark Line in the point 4271.8 and this point can change anytime to any value between 3000 and 5000.
You can add the mark line at any place you like by simply specifying the x-coordinates.
The x-coordinates to use depending on your x-axis scale. If your chart is using the values 3000 to 5000 as the x-coordinates of the data points (that is, you use layer->setXData(myXDataArray) to provide x-coordinates for the data points), then you just need to add the mark at the position you want:
c->xAxis()->addMark(4271.8, myColor, "XXXX");
If you do not provide x-coordinates for your data points (setXData is not used), and the x-axis are just labels (configured using Axis.setLabels or Axis.setLabels2), then the labels are just names for display and have no meaning to ChartDirector. In this case, ChartDirector will use the array index as the x-coordinates. That means the first label is 0, the second label is 1, and so on. You can put a mark line in between two labels by using a fractional number. For example, a mark line at 1.5 will be in between the second and third label.
If your first label is 3900, and the last label is 5000, and there are N labels, then the 4271.8 must be at:
double xCoor = (4271.8 - 3900) / (N - 1);
You can then add the mark line using the xCoor computed above.