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

Message ListMessage List     Post MessagePost Message

  Y axis Title Overlapping
Posted by abhishek.mr on May-16-2018 21:51
Attachments:
Hello,

I have created sample chart with Zoom and Pan functionality but when i zoom more the y axis label digit will increase in that scenario the  y axis title is collapsing. Is there any solution to auto fit y axis width.

Same scenario in multiple y axis.Please find the attached images for more information.



Regards,
Abhishek
Y axis Titile.PNG
Multiple Yaxis.PNG

  Re: Y axis Title Overlapping
Posted by Peter Kwan on May-17-2018 02:09
Hi abhishek,

Yes, you can auto-fit y-axis width. Note that this will change the plot area width so as to leave space for the y-axis.

I assume your axis scale is dynamic, that is, it can change when you zoom or pan, or when new data comes in. In this case, if you auto-fit the y-axis, the plot area width will also be dynamic. That means the plot area can "squeeze" or "stretch" or oscillate when you zoom or pan, or when new data comes in. So for real-time chart that can zoom or pan, it is usually better to simply reserve sufficient y-axis width for the worse case. This keeps the plot area size stable.

Anyway, if you prefer to have a dynamic plot area size, you can use the following method:

(a) Create chart as usual

(b) Call XYChart.layoutAxes. After that, you can use Axis.getThickness to determine the thickness of the "additional axes" (the axes other than the primary y-axis that is attached to the plot area). You can therefore determine the space avaiable for the plot area and the primary y-axis. You can use XYChart.packPlotArea to pack the plot area and the primary y-axis to the that space.

Hope this can help.

Regards
Peter Kwan

  Re: Y axis Title Overlapping
Posted by abhishek.mr on May-24-2018 16:23
Hello,


Could you please share sample so that i can implement in my code.


Regards,
Abhishek

  Re: Y axis Title Overlapping
Posted by Peter Kwan on May-25-2018 02:30
Hi Abhishek,

We do not have sample code that is exactly the same as what you need. There are a number of sample code that comes with ChartDirector that uses XYChart.packPlotArea to automatically adjusts the plot area so that the plot area and the primary y-axis labels will stay within a given bounding box. One of the examples is:

http://www.advsofteng.com/doc/cdnet.htm#multisymbolline.htm

You can use this method to avoid the primary y-axis title to overflow to outside the chart or to extend beyond a certain position.

Regards
Peter Kwan