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

Message ListMessage List     Post MessagePost Message

  Incorrect viewport when x-axis has margin
Posted by Xord on Jul-24-2020 09:38
I am using Chart Director C++.

I was drawing a finance chart with some margin set at the right side of the x-axis using Axis->setMargin(). I found out that when I use the zoom function, either click to zoom and drag to zoom, the new viewport is calculated incorrectly. I think the viewport may be calculated without accounting for the extra margin at the end, so it was off-centered. Please advise how to account for the margin change. Thanks.

  Re: Incorrect viewport when x-axis has margin
Posted by Xord on Jul-24-2020 11:26
I have found a solution to this problem.

In CChartViewer, before passing the x coordinates to zoomIn() and zoomAt(), modify the coordinates to "pretend" it was clicked on a chart without margin.

The calculation requires the left position, right position and the width of the plot area. Also the margin width.