Couple newbie questions: interaction & animation

183 views
Skip to first unread message

Jérôme Cordiez

unread,
Oct 29, 2010, 10:07:13 AM10/29/10
to coreplot-discuss
Hi everyone,

first, thanks to all contributors for providing this framework,
definitely most handy !
Being new to both iOS development, and obviously coreplot dev, I'd
have a couple questions I hope someone could find the time to answer:

1. Animation. I'd like to animate my charts when the data changes,
interpolating values smoothly. I remember seeing a comment somewhere
saying this wasn't implemented yet, advising to calculate intermediary
values and refreshing the chart, so that's what I did. It's working
fine, but I figured I'd use the opportunity of my second question to
ask if it was still the recommended way of tweening charts?

2. Interaction. I can't seem to make the symbol selection work in my
code, ie plotSymbolWasSelectedAtRecordIndex never gets called. I've
defined the plot (scatterplot) delegate, and implemented:

-(void)scatterPlot:(CPScatterPlot *)plot
plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index{
NSLog(@"index: %u",index);
self.selectedIndex = index;
}

But that never gets called.
I've tried toggling allowUserInteractions on the chart instance, but
this didn't change anything, plus I'm not sure this is related. I've
also set a delegate for the plotSpace, implementing
shouldHandlePointingDeviceDownEvent, and that works fine.
I've spent the last hours looking at the testApp example, but can't
find much any difference that'd explain my problem.

Thanks a lot in advance for your attention and any light you could
shed on this :)

Eric

unread,
Oct 29, 2010, 6:05:41 PM10/29/10
to coreplot-discuss
#1. Animation is not supported yet, other than scrolling the graph.
You've got the right idea for a workaround.

#2. Did you set the delegate property on your plot to your delegate
object?

Eric

Jérôme Cordiez

unread,
Oct 30, 2010, 3:21:31 PM10/30/10
to coreplot-discuss
Hi Eric,
thx for your reply !

Yes, I did set my plot's delegate property, as per the CPTestApp
example project:

plot.delegate = self;

Is there a chance plotSymbolWasSelectedAtRecordIndex could only be
supported for osx projects?

Cheers,
J.

Eric

unread,
Oct 30, 2010, 3:37:51 PM10/30/10
to coreplot-discuss
Hit detection should work on both iOS and MacOS.

What value are you using for the plotSymbolMarginForHitDetection
property? The default is 0.0 so you have to hit the center of the
symbol exactly for it to register.

Eric

Jérôme Cordiez

unread,
Oct 30, 2010, 4:41:46 PM10/30/10
to coreplot-discuss
Oh, excellent, I think we're getting there!

I've actually commented out plotSymbolMarginForHitDetection, as it was
giving me a compile error:

error: request for member 'plotSymbolMarginForHitDetection' in
something not a structure or union

As I said I'm very very new to this so I haven't really worried about
it yet, just commented it out... One thing at the time :)

Thanks a lot for your help!
Jerome.

Jérôme Cordiez

unread,
Oct 30, 2010, 5:32:03 PM10/30/10
to coreplot-discuss
Just to clarify: I'm still unable to compile my app if I leave that
line, which is probably why I'm not getting
plotSymbolWasSelectedAtRecordIndex to be called... Any idea why that
property is causing an error?

Cheers,
J.

Eric

unread,
Oct 30, 2010, 5:49:35 PM10/30/10
to coreplot-discuss
What type is the variable you're using for your plot? That property is
only in CPScatterPlot, so your variable needs to be that type. You can
also use a typecast if you have to.

Eric

Jérôme Cordiez

unread,
Oct 31, 2010, 8:26:25 AM10/31/10
to coreplot-discuss
Eric, thanks a lot for taking the time to help me figure this out.

The plot is a CPScatterPlot, here's what I have:

CPScatterPlot *plot = [[[CPScatterPlot alloc]
initWithFrame:chartView.bounds ] autorelease];
plot.delegate = self;

// This line causes the build to fail. The property doesn't show up in
the editor's autocomplete either:
plot.plotSymbolMarginForHitDetection = 5.0;


I'm using 0.2.1, if this makes any difference.

Cheers,
J.
Reply all
Reply to author
Forward
0 new messages