Closed GoogleCodeExporter closed 8 years ago
Is this on a device (which one?) or the simulator? Can you post your legend
setup code to help duplicate the issue?
Original comment by eskr...@mac.com
on 16 Oct 2013 at 12:30
The problem occurs on both: I've tried on a device (iPhone 4S) and the
simulator (3.5-inch and 4-inch).
Here is my code (with some comments).
CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
textStyle.color = [CPTColor lightGrayColor];
textStyle.fontSize = 11.0;
// It also happends with System font.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0)
textStyle.fontName = @"Bradley Hand";
graph.legend = [CPTLegend legendWithGraph:graph];
graph.legend.textStyle = textStyle;
graph.legend.swatchSize = CGSizeMake(20.0, 5.0);
// I had to setup number of Rows. Otherwise, on iOS7 CorePlot adds two rows.
However, with two rows the titles are also cut-off.
graph.legend.numberOfRows = 1;
-----
If I setup rows with manually with:
graph.legend.columnWidths = [NSArray arrayWithObjects:[NSNumber
numberWithInt:45], [NSNumber numberWithInt:50], [NSNumber numberWithInt:45],
nil];
I can see the entire title. However, I can't distribute that way because titles
change for each language.
Original comment by dur...@gmail.com
on 16 Oct 2013 at 5:19
Do you need any additional information? Can I test anything else?
Original comment by dur...@gmail.com
on 20 Oct 2013 at 7:04
iOS 7 required us to switch to a new method of calculating the text size. It
looks like there are slight differences between the calculated size and the
size required to actually draw the text.
If you could provide one or more examples of labels that don't draw correctly
in the default text style font, that would be helpful. We only need the string,
not screenshots.
Original comment by eskr...@mac.com
on 20 Oct 2013 at 12:24
Some examples in the default text style font:
Systolic -> Cuts to "Systoli".
Diastolic -> Cuts to "Diastoli".
Pulse -> Cuts to "Puls".
Sistólica -> Cuts to "Sistólic".
Pulso -> Cuts to "Puls".
Sistòlica -> Cuts to "Sistòlic".
Pulsacions -> Cuts to "Pulsacion".
Original comment by dur...@gmail.com
on 20 Oct 2013 at 5:38
I cannot reproduce this problem in the Plot Gallery example app using the
settings you provided. I tried it with bar plots and pie charts, using the
system font, the text style default (Helvetica), and "Bradley Hand". All them
rendered the text you provided correctly in the iOS 7 simulator (iPhone and
iPad).
Please post the rest of the text style and legend setup code (if any). I want
to make sure I'm testing with the exact same legend configuration.
Original comment by eskr...@mac.com
on 21 Oct 2013 at 1:11
There are no additional code to setup the legend or the text style. It cut-off
titles on bar plots and line plots.
CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
textStyle.color = [CPTColor lightGrayColor];
textStyle.fontSize = 11.0;
//if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0)
textStyle.fontName = @"Bradley Hand";
graph.legend = [CPTLegend legendWithGraph:graph];
graph.legend.textStyle = textStyle;
graph.legend.swatchSize = CGSizeMake(20.0, 5.0);
// graph.legend.columnWidths = [NSArray arrayWithObjects:[NSNumber
numberWithInt:45], [NSNumber numberWithInt:50], [NSNumber numberWithInt:45],
nil];
graph.legend.numberOfRows = 1;
---
That's how I setup the graph:
// Create graph from theme
graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
CPTTheme *theme = [CPTTheme themeNamed:kCPTPlainBlackTheme];
[graph applyTheme:theme];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.collapsesLayers = NO; // Setting to YES reduces GPU memory usage,
but can slow drawing/scrolling
hostingView.hostedGraph = graph;
// Add plot space for bar charts
CPTXYPlotSpace *barPlotSpace = [[CPTXYPlotSpace alloc] init];
barPlotSpace.allowsUserInteraction = NO;
Original comment by dur...@gmail.com
on 21 Oct 2013 at 4:55
I still cannot reproduce this problem. Are you seeing similar issues anywhere
else?
Original comment by eskr...@mac.com
on 25 Oct 2013 at 12:35
It only happens on legends. I will gather more info to reproduce the problem.
Original comment by dur...@gmail.com
on 2 Nov 2013 at 9:36
Setting constant column width solved my similar issue (I put
graph.legend.columnWidths = @[@300]; for 1 column legend).
Original comment by fp.mobil...@gmail.com
on 20 Nov 2013 at 2:15
I too have been tearing what little hair I have left out trying to get the
legend captions to fit inside the frame of the legend. Many thanks for the
suggestion about setting the column width. That works for me too.
In the future, perhaps there should be an additional attribute for the size of
the legend box.
Original comment by myoung...@gmail.com
on 21 Nov 2013 at 5:05
This issue was closed by revision c33fe46f7873.
Original comment by eskr...@mac.com
on 23 Nov 2013 at 12:47
Original issue reported on code.google.com by
dur...@gmail.com
on 15 Oct 2013 at 7:13Attachments: