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

Message ListMessage List     Post MessagePost Message

  Adjust y Scale to visible chart
Posted by BRUNO VOISIN on Oct-16-2024 15:49
Hi,
Please bear with me as this probably is a silly question.
When I plot a chart using auto size (Y scale), it takes into account the full data range, and not just the visible chart in ViewPort.  How can I make sure that the Y scale max is linked to the visible range only?
Thank you.
Bruno

  Re: Adjust y Scale to visible chart
Posted by Peter Kwan on Oct-17-2024 02:11
Attachments:
Hi BRUNO VOISIN,

I have attached some screenshot from the ChartDirector sample code:

https://www.advsofteng.com/doc/cdnet.htm#viewportcontroldemo.htm

You can see in the big chart, the y-axis would auto-scale based on the visible data. The y-axis scale and increase or decrease depending on the data. The bottom chart (the viewport control) shows all the data, so it is normal it is scaled based on all the data.

In brief, the y-axis will auto-scale based on the data you pass to ChartDirector. In our sample code, we pass only the visible data to ChartDirector. (The first thing the code does is to set up the viewPortTimeStamps and viewPortDataSeries that contains only the visible data). As the chart does not have all the data, the chart cannot auto-scale based on all the data.

Best Regards
Peter Kwan
mfcdemo_20241017012944.png
mfcdemo_20241017012952.png
mfcdemo_20241017012941.png

  Re: Adjust y Scale to visible chart
Posted by BRUNO VOISIN on Oct-17-2024 23:34
Thank you Peter,
I don't use the lower control window as per your provided demo, but I can see it would serve my purpose.  Maybe worth looking into adding a feature in a later version whereby auto-scaling is optionally limited to viewport boundaries.
Kind regards
Bruno

  Re: Adjust y Scale to visible chart
Posted by Peter Kwan on Oct-18-2024 17:40
Attachments:
Hi Bruno,

Note that even with just the upper window, the chart will auto-scale based on the visible data if the code only passes the visible data to the chart. I have attached the screenshots from the "Zooming and Scrolling with Track Line (2)" for your reference. The ChartDirector sample code always use this method for axis that is auto-scaled.

Best Regards
Peter Kwan
CSharpWinCharts_20241018172601.png
CSharpWinCharts_20241018172553.png