ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Mark Line
Posted by Alejandro on Apr-25-2022 10:11
Attachments:
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.

I'm adding the screenshot:


Thank you in advance.
Screenshot 2022-04-24 220609.png

  Re: Mark Line
Posted by Peter Kwan on Apr-25-2022 18:32
Hi Alejandro,

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.

Best Regards
Peter Kwan

  Re: Mark Line
Posted by Alejandro on Apr-25-2022 19:59
Thank you very much!!!