|
AddMark |
Posted by Roger on Jan-09-2014 12:16 |
|
Hi
I've been trying to add add a vertical mark from an added xychart.addaxis
eg Dim anchorAxis As ChartDirector.Axis = _c.addAxis(Chart.Bottom, -100)
VB.NET 4.5, latest Chart Director, VS 2012
where _c is the xychart.
The label ("Here") get displayed at the correct place (ie displaced by -100), but the
added vertical mark always gets displayed from the original x-axis. Is there something I'm
missing?
This is the code to display the mark
anchorAxis.addMark(63346924800, 0, "Here")
where 63346924800 is a hard-coded date value from the x-axis. This works ok apart from
the line getting drawn from the original x-axis.
Hope you can help?
thanks
Roger |
Re: AddMark |
Posted by Peter Kwan on Jan-10-2014 04:18 |
|
Hi Roger,
The ChartDirector mark lines always draw across the plot area, regardless of where are the axes. For example, for a 4 quadrant chart (see attached image), even if the x-axis is at the center of the chart, if you add a mark line, the mark line will still be from the bottom of the plot area to the top of the plot area.
If you would like the mark line to start or terminate at some point outside the plot area, you would need to draw it as a custom line (BaseChart.addLine). An example is like:
'Add a mark label and tick myAxis, but without the corresponding mark line
myAxis.addMark(myMarkValue, &Hff0000, "AAA").setLineWidth(0)
...... create chart as usual .......
'auto-scale axis after entering all data
c.layoutAxes()
'can now use getYCoor to convert data value into pixel coordinates
Dim yCoor As Integer = c.getYCoor(myMarkValue, myAxis))
'draw a custom line at the mark position
c.addLine(startXCoor, yCoor, endXCoor, yCoor, &Hff0000, 1)
Hope this can help.
Regards
Peter Kwan
|
Re: AddMark |
Posted by Roger on Jan-11-2014 04:41 |
|
Peter,
many thanks
Roger |
|