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

Message ListMessage List     Post MessagePost Message

  XYChart, Y axis placement of values. Can it be done automatically?
Posted by Tony on Oct-27-2021 22:28
Attachments:
I don't know in advance what the values to be plotted on the Y axis are. I've got a simple XY chart which I size based on the title and label font sizes. This works well for most charts, it places the plot area to fill the remaining window space. The problem is if I have some very large values on the Y axis, these overwrite the Y axis labels.

So my question is, is there a way to specify a plot area, and that plot area includes the X and Y axes? This seems like a more logical way to do things rather than the current way as you need to know the size of the labels.

Thanks in advance,

Tony.



XYChart* c = new XYChart(nBaseWidth, nBaseHeight);

int nApproxTitleSize = m_pfont_Title->GetPointSize() * scale;
int nAxisTitleSize = m_pfont_AxisLabels->GetPointSize() * scale;

int nPlotAreaX = nAxisTitleSize * 5;
int nPlotAreaY = nApproxTitleSize * 3;
int nPlotAreaW = nBaseWidth - nPlotAreaX * 2;
int nPlotAreaH = (int)(0.6 * (float)nBaseHeight);

c->setPlotArea(nPlotAreaX, nPlotAreaY , nPlotAreaW , nPlotAreaH , backgroundColour, -1, 0xc0c0c0, 0xc0c0c0, -1);
graph2.jpg

  Re: XYChart, Y axis placement of values. Can it be done automatically?
Posted by Tony on Oct-27-2021 22:33
Ignore me again, I've just found the packPlotArea function.

Tony.