divyavamsee / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Humongous legend size #348

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.It's random, the legend is extremely wide and doesn't render properly on pdf.

What is the expected output? What do you see instead?
Legend size big enough to contain the titles and the swatches

What version of the product are you using? On what operating system?
core plot 0.4 Mac OS 10.7.2

Please provide any additional information below.
in CPTLegend.m -(void)recalculateLayout

    CGFloat *maxTitleHeight = malloc(desiredRowCount * sizeof(CGFloat));
    CGFloat *maxTitleWidth = malloc(desiredColumnCount * sizeof(CGFloat));

those two array are used to calculate maximum height and width of legend box. 
but that are not initialized and some times they are not zero.

suggestion:
add zeroing code:

    memset(maxTitleHeight,0,desiredRowCount *sizeof(CGFloat));
    memset(maxTitleWidth,0,desiredColumnCount *sizeof(CGFloat));

Original issue reported on code.google.com by roberto....@sbcglobal.net on 24 Oct 2011 at 5:49

GoogleCodeExporter commented 9 years ago
This is fixed in later versions of Core Plot. Update to version 0.9 or later. 
Those lines now read:

    CGFloat *maxTitleHeight = calloc(rowCount, sizeof(CGFloat));
    CGFloat *maxTitleWidth = calloc(columnCount, sizeof(CGFloat));

Original comment by eskr...@mac.com on 25 Oct 2011 at 1:58