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

Message ListMessage List     Post MessagePost Message

  Limit Mark-Lines on Linechart
Posted by Peter Schilling on Sep-04-2019 21:07
Attachments:
Hey there,

is there any way of limit the mark-line drawn on a Linechart ?

At the Moment the mark line is drawn all the way to the top and crosses my legend.
I would like to draw the mark-line only 80% of the chart height.

Is this possible?

Greetings, Peter
ChartDirector - Mark.png

  Re: Limit Mark-Lines on Linechart
Posted by Peter Kwan on Sep-04-2019 22:49
Hi Peter,

Yes, you can use a yZoneColor to limit the mark to y = 100. It is like:

# dash line color below 100, transparent above 100
$markColor = $c->yZoneColor(100, $c->dashLineColor(0xcccccc, DotDashLine), Transparent);

$c->xAxis->addMark($xMarkValue, $markColor);

Hope this can help.

Regards
Peter Kwan

  Re: Limit Mark-Lines on Linechart
Posted by Peter Schilling on Sep-04-2019 23:13
Hello Peter,

yeah, it works! Thanks, but if I do so the Label of the marker is not longer visible :(

I set the position with:
$stepMark->setAlignment(Left );


Any suggestion for that ?

Greetings,

Peter

  Re: Limit Mark-Lines on Linechart
Posted by Peter Kwan on Sep-05-2019 19:20
Hi Peter,

You can use different colors for the mark line and for the label. It is like:

$markColor = $c->yZoneColor(350, $c->dashLineColor(0xcccccc, DotDashLine), Transparent);

$m = $c->addMark($xMarkValue, -1, $myLabel);
$m->setMarkColor($markColor, 0xcccccc);

See:
https://www.advsofteng.com/doc/cdphp.htm#Mark.setMarkColor.htm

If you want the mark line to reach "80%" vertically, but do not know what is the axis scale, you can create an extra y-axis yourself (or use yAxis2 if you are not using it at the moment), set the scale to 0 to 100 (using Axis.setLinearScale). Then you can define a zone color using that extra y-axis with a known scale. The extra y-axis can be made invisible by setting its color to transparent, or by putting it outside the chart image. See:

https://www.advsofteng.com/doc/cdphp.htm#XYChart.addAxis.htm
https://www.advsofteng.com/doc/cdphp.htm#Axis.setLinearScale.htm
https://www.advsofteng.com/doc/cdphp.htm#XYChart.yZoneColor.htm

Regards
Peter Kwan