Hi All. I'm writing application which uses ChartDirector for wxWidgets and I have a problem with ViewPortControl. I am able to display full chart in ChartViewer but the chart in ViewPortControl is cut off. You can see on attached image that the upper chart is displayed fine but the bottom one doesn't show lower values. Both, the ChartViewer and ViewPortControl, have the same data passed. Thank you in advance for any tips.
I suspect it is due to the y-axis scale configuration of the chart in the ViewPortControl. For example, if the y-axis scale is set to 37500 to 50000, then the part below y = 37500 will fall outside the chart.
I noticed in the ViewPortControl, the y-axis has no labels, so we cannot see what is the y-axis scale. If the y-axis is not configured at all, ChartDirector should automatically generate a scale that allows all data to be displayed and include labels on the y-axis. Would mind to inform me how the y-axis is configured in your code that draws the chart in the ViewPortControl?
I don't see any specific configuration of y-axis scale of ViewPortControl in my code, however I'm basing on a code that initially was an example so I could be not aware that it is somewhere.
Initially I was thinking the same as you, that y-axis of ViewPortControl is not set correctly but honestly speaking I can't find any functions I could use on ViewPortControl to set it as it should be. So my question is: Could you possibly tell me the applicable function(s) to set y-axis scale of ViewPortControl, please?
And my second question is: Does setting y-axis scale of ChartViewer has impact on ViewPortControl y-axis scale? (In my code I set ChartViewer's y-axis scale and ChartViewer is bound to ViewPortControl by using setViewer() method)
Sorry for the misinformation. I checked our C++ sample code and found that our own code would hide the y-axis by setting its color to Chart::Transparent. So it is normal for having no visible y-axis labels.
In your chart, I cannot see the x-axis labels too. I am thinking, is it possible the chart is resized smaller after "layout" or being drawn, so that the bottom part is cropped out?
Please try to comment out the line c->yAxis()->setColors(Chart::Transparent, Chart::Transparent); so the y-axis becomes visible. Then add the line:
c->yAxis()->setLinearScale(0, 10, 1);
This would put the labels (0, 1, 2, ... 10) on the y-axis. If the bottom part is cropped out, the first few labels may fall outside the visible region.