Page 1 of 1

Events in wxFreeChart

Posted: Thu Oct 08, 2015 2:54 am
by RichardW
What I've done is built a simple Gantt chart. What I'd like to do is be able to handle mouse clicks on the Gantt bars. Ideally, I'd like the user to be able to drag the bar back and forth on the horizontal axis but... baby steps for now.

It's trivial get the mouse coordinates from the click event, but is there a way to get GanttPlot to report where the bars are located, so I could get the dataset index, or something?

AxisPlot.ToDataCoords() looks promising, but I have no idea how to how to return my AxisPlots from the plot. Is there a GanttPlot.GetAxis(AXIS_LEFT) that I missed?

Thanks for reading this. I did a search and I didn't find anything but I apologize in advance if this has been answered elsewhere.

Sincerely,
Richard W.

Re: Events in wxFreeChart

Posted: Thu Oct 08, 2015 4:29 pm
by doublemax
I don't know wxFreeChart, but looking at the class hierarchy, GanttPlot derives from AxisPlot and there you find several GetDatasetAxis methods. Maybe these help?

http://wxcode.sourceforge.net/docs/free ... sPlot.html

Re: Events in wxFreeChart

Posted: Fri Oct 09, 2015 3:51 am
by RichardW
I did see those but I couldn't understand why they need a Dataset as a parameter as one has already been passed to the plot. But maybe I don't understand something yet. I'll continue to work on this.

Re: Events in wxFreeChart

Posted: Wed Oct 21, 2015 4:15 pm
by RichardW
Just to give an update, I completely chickened out. Instead of using wxFreeChart, I rolled my own Gantt chart using a grid bag sizer. It's not as pretty, but grabbing events is much easier. It looks like events are on the original developer's todo list, but the last update was some time ago so they might not happen.

I hope somebody else has better luck than me.

Richard