|
How to provide keyboard navigation support |
Posted by Kuldip on Feb-17-2012 20:42 |
|
We have a C++ Win32 application. We were able to implement mouse navigation (hot
spots). However, if we wanted to provide support for navigation by keyboard, such that we
can, for example, press the left and right arrow keys to highlight a particular bar in a bar
graph, and press enter to open the associated details with it, what should be our way of
doing it? We can handle the keyboard messages, however, how to indicate a selection
(cursor) on the bars?
Does the component provide any such options using which I can highlight a specific part of
the graph. Specific 'Bar' in a bar graph, 'Slice' in a pie graph, 'Point' in a line graph or a
Legend.
Thanks,
Kuldip |
Re: How to provide keyboard navigation support |
Posted by Peter Kwan on Feb-18-2012 01:09 |
|
Hi Kuldip,
For XY chart objects, you may ask ChartDirector to tell you to position of a the data points (using XYChart.getXCoor and XYChart.getYCoor). Then you would need to use your own code to somewhat highlight the object. For bars, you may put a rectangle over the bar to highlight it (note: this is not to change the chart, but to put another rectangular control(s) over the CChartViewer control), or to put a "dot" at the top of the bar. In practice, this method works well for points, bars or symbols (such as scatter symbols, candlesticks, box-whisker symbols, etc). For line and area charts, you may consider just to highlight the data points (and not the line segments or area regions).
However, highlighting non-rectangular non-point objects (such as slices in a pie chart) is much more difficult without redrawing the chart. For a pie chart, I probably would redraw the entire pie chart with the selected pie in a different color or style. Since ChartDirector can redraw very fast, such user interface should be smooth. In general, you can always highlight a specific part of the graph by simply redraw the chart with that part highlighted (using a different color or style).
Regards
Peter Kwan |
|