fdh
fdh

Reputation: 5344

Change size of legend in core plot?

I have a pie graph with a corresponding legend. How do I change the size of the legend box? (make everything including the text, colour boxes and frame smaller).

Note I am building an application for OSX not iOS.

Upvotes: 1

Views: 1756

Answers (1)

El Developer
El Developer

Reputation: 3346

If you just set a smaller text style of the CPTLegend, everything will be resized as requested. So for your CPTGraph you are going to want to do:

CPMutableTTextStyle *mySmallerTextStyle = [[[CPTMutableTextStyle alloc] init] autorelease];
[textStyle setFontName:fontName];
[textStyle setColor:color];

//This is the important property for your needs
[textStyle setFontSize:5];

//Set this up with your graph
[graph setLegend:[CPTLegend legendWithGraph:graph]];
[[graph legend] setTextStyle:(CPTTextStyle *)mySmallerTextStyle];

There is a discussion regarding this on the CorePlot forum.

Upvotes: 3

Related Questions