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

Message ListMessage List     Post MessagePost Message

  How to synchronize XYChart dimensions with setPlotArea dimensions
Posted by Daniel on Sep-19-2018 19:26
Attachments:
Hi Peter,
I have some issues with dimensions of a XY chart that should have the width adjusted somehow automatically. The language used is VB6. The chart above has a table where data are in a time format hh:mm:ss. The main issue with this charts is the bars within it are variable. If we have 8 bars the chart width is Set c = cd.XYChart(760, 480) and it look properly as you see below. But once the bars are multiplied that 760 becomes insufficient and the width requires to be increased proportionally. The height of chart is stable and convenient but how to keep under control the width variation? So what I need is to find a dynamical adjustment of the width pixels considering the count of the bars. According with this requirement I should have a parameter both in XYChart and setPlotArea method. Any idea how to calculate this parameter considering that is preferable to keep 760 as a minimum (default) value (even for 1-3 cases bars are bloated...) ? Thank you.
13_bars.JPG
8_bars.JPG
21_bars.JPG

  Re: How to synchronize XYChart dimensions with setPlotArea dimensions
Posted by Peter Kwan on Sep-20-2018 11:07
Hi Daniel,

Assuming you prefer at least 55 pixels of width per bar, and the left and right margins (the region outside the plot area) are both 70 pixels, the chart width must be:

Dim chartWidth As Long
chartWidth = 55 * barCount + 140
If chartWidth < 760 Then chartWidth = 760

Set c = cd.XYChart(chartWidth, 480)
Call c.setPlotArea(70, chartWidth - 140, ........)

Hope this can help.

Regards
Peter Kwan

  Re: How to synchronize XYChart dimensions with setPlotArea dimensions
Posted by Daniel on Sep-21-2018 04:19
It worked satisfactory with 58 pixels. Thank you very much for your suggestion, Peter.
Kind Regards,
Daniel