Add shortcut menu support

The last item in the tutorial is, perhaps, the easiest, and still one of the coolest. CPlot has built in shortcut menu support. First thing to do is add a member function for WM_RBUTTONDOWN in your view class using the Class Wizard.

Then just call the ShowPopupMenu member function of CXYChart. It takes care of ALL of the work for you except for updating the chart. If you're so inclined, you can also pass it a pointer to a CMenu to add itself to if you already have a shortcut menu for your program.

void CTestProjectView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	ClientToScreen( &point );
	if( m_Chart.ShowPopupMenu( this, nFlags, point ) == kPopupUpdate )
		Invalidate();
}
That's all that is needed. Play around with the contextual menu. I was able to make all the changes to the below plot using the contextual menu.


Tutorial:


CPlot Reference