Menu

#31 Control legend colorbox width

closed
lbayuk
None
3
2012-09-07
2010-11-18
lbayuk
No

This request came from Benno Schilling:
"I've searched for a method to modify the width of the color box in the legend (which is coloured with the data color). Actually there is none..."

Discussion

  • lbayuk

    lbayuk - 2010-11-18

    The request came with a patch to implement a new function SetLegendColorBoxWidth() to set the color box width in pixels. But the patch was not usable, as it only worked with 1 of 6 SetLegendStyle option combinations, and also resulted in some undefined variable warnings.

    Rather than setting an absolute width in pixels, it should use a scale factor. The default 1.0 would get the same colorbox width as current: the character width of the font (width of "E" for TTF). You can specify a factor > 1 to make the boxes wider, or < 1 for smaller, but they will still scale with the font.

    First implementation will just use a new member variable, and no function to set it. (There are several other places in PHPlot where this is the case, for example variables to tweak bar widths.) Side note: These need to be documented better. Future options: add more Set*() functions, or perhaps a more general "tune" function, or just leave it alone and you have to set the variables if you want to adjust them.

     
  • lbayuk

    lbayuk - 2010-11-22

    This has been implemented and committed to CVS. It will be in the next release.

    You can now control the legend color box width by setting the member variable legend_colorbox_width. This is a scale factor applied to the default width, so setting it to 2.0 makes the color boxes twice as wide, 0.5 makes them half as wide, etc.

    There is no function to set this, but it is now documented in the manual in a new section on tunable parameters. I don't think this (or several similar parameters) needs a new function.

     
  • lbayuk

    lbayuk - 2010-12-05

    Implemented in PHPlot-5.3.0

     

Log in to post a comment.