When doing multiple plots on an image, some default settings are being applied to subsequent plots, rather than being recalculated for each plot. Some of these are documented in the manual and are the expected behavior (axis positions, data scaling, and plot area). Other settings should not behave this way and are not documented to work this way. These should be fixed.
Test case: Horizontal plot pair with X tick labels and X data value labels. (Plot 1) SetXLabelAngle(90). (Plot 1) SetXLabelAngle(0).
Expected result: First plot has both X axis and X data value labels at 90 degrees; second plot has both X axis and X data value labels at 0 degrees. Actual result: second plot has X axis labels at 0 degrees, and X data value labels at 90 degrees.
Test case: A vertical bar chart, then a horizontal bar chart, on the same image, not using SetDrawXGrid() or SetDrawYGrid().
Expected result: The vertical plot has Y grid lines only, and the horizontal plot has X grid lines only. Actual result: Both plots have Y grid lines only. The horizontal plot is wrong.
X and Y tick and data label positions - defaults depend which labels are on, and whether the data array contains labels, but the result is kept after the first plot.
X Data Label Format and Y Data Label Format default to the corresponding X and Y label formats if not set, but don't change if the X and Y label formats change after the first plot.
This is happening because PHPlot is calculating a default value if the variable isn't set, then storing the result back into the variable. On subsequent plots, there is no way to know that the value was calculated, and not specifically set, so it is used as-is.
This can be fixed by using 2 class variables: 1 for the user-set parameter (
Set*()
function), and one for the effective value - which is recalculated before each plot. In other cases, an easier fix is to make an internal Get*() function to get the effective value without storing it into a class variable.The "grid setting" case has been fixed and committed to SVN (on the /Rel6 branch). A new internal function GetGridSetting() returns True to draw the grid, without storing the calculated default back into the class variables.
Last edit: lbayuk 2012-09-22
On 2012-08-20 a change was committed to Subversion on the Rel6 branch that fixes the issue for X Data Label Angle. Two variables are now used - one for the user-set value and one for the effective value.
The "label format" case has been fixed and committed to SVN (on the /Rel6 branch). If the 'xd' ('yd') format settings for data labels is empty, the 'x' ('y') setting is used instead, but the values are not stored back into the array. This lets PHPlot re-evaluate if a default is needed for each plot in an image.
PHPlot-6.0.0 will contain fixes to all the known cases above except for the X and Y tick label and data label position settings. Opened [bugs:#168] to cover that case, which is more complex that the ones already fixed.
Related
Bugs: #168
Fixed in 6.0.0, except for the part moved to [bugs:#168]
Related
Bugs: #168