Custom week labels with unordered result

61 views Asked by At

I am using Core Plot to draw a graph with custom labels.

It has 7 labels with week such as "Sun", "Mon" and "Tue". And the label may start with each day.

I have ordered the sequence in a NSMutableSet or NSMutableOrderedSet and then assign to x.axisLabels.

However, the axisLables is an unordered NSSet so my labels get unordered, too.

For example, I set the sequence with string:

"Mon", "Thu", "Wed", "Thu", "Fri", "Sat", "Sun".

But the graph shows the sequence:

"Sat", "Sun", "Mon", "Thu", "Wed", "Thu", "Fri".

Definition of axisLabels in core plot.

@property (nonatomic, readwrite, retain) NSSet *axisLabels;

Any suggestions for me? Thanks.

1

There are 1 answers

0
Eric Skroch On BEST ANSWER

Sets have no defined order. Core Plot uses the tickLocation of each label to position them along the axis.