Opened 3 years ago

Last modified 3 days ago

#1987 assigned enhancement

Add the ability for NVDA to read charts in Excel

Reported by: elliott94 Owned by: mdcurran
Priority: minor Milestone:
Component: Microsoft Office support Version: master
Keywords: needsCodeReview Cc:
Operating system: Blocked by:
Blocking:
Changes document entry (for developers):

Description

When working with data in worksheets, it sometimes becomes necessary to create charts out of several cells in a worksheet.

Unfortunately, NVDA doesn't currently support these. The attached example shows a Bar Chart, with the labeled cells A1, B1, and C1. It would be great to add support for these, if at all possible.

Attachments (1)

Test_Chart_1.xls (16.0 KB) - added by elliott94 3 years ago.
A test Bar Chart.

Download all attachments as: .zip

Change History (16)

Changed 3 years ago by elliott94

A test Bar Chart.

comment:1 Changed 9 months ago by deependra230

Hello,
I am working on this ticket. I understand the basic functioning of 'excel.py' but i couldn't find anything related to charts' interface on the web. Moreover, there is no default way to navigate inside the chart/graph. Can someone please suggest where to start and how to proceed ?
I know its quite a vague question but i am stuck at the start.

comment:2 Changed 2 weeks ago by dineshkaushal

Please review the branch in_t1987_f7

https://manish_agrawal@bitbucket.org/manish_agrawal/nvda.git

The problem of excel chart elements being announced multiple times after every alt tab is solved. Thanks to Jamie, the problem is solved using weakref.

comment:3 Changed 2 weeks ago by jteh

  • Component changed from Core to Microsoft Office support
  • Keywords needsCodeReview added
  • Owner set to mdcurran

comment:4 Changed 2 weeks ago by jteh

  • Status changed from new to assigned

comment:5 Changed 2 weeks ago by mdcurran

Great work again so far.

Some things to change:

  1. When object navigating next or previous from a chartElement, you end up on another window outside the chart. At a minimum you should set previous and next properties to None on ExcelchartElementBase. If possible though, it would be cool to implement next and previous properties that actually fetched the next and previous chart element. However this may be impossible to do.
  2. I don't think there is a need to provide all those redirect scripts on ExcelChartElementBase. Instead, on the scripts of the chart, set canPropagate to True. As the chart is the parent, NVDA will automatically allow matching on these. For example:
    script_reportTitle.canPropagate=True
    
  3. Provide translator comments for all your translation strings.
  4. the _select method on ExcelChartElementBase and subclasses should be renamed to something like _getLabel. _select really suggests that it will do something, rather than get something.
  5. We have a role_chart in controlTypes. This can be used for the chart's role.

comment:6 Changed 2 weeks ago by mdcurran

Also, this branch is still based on the work for the NVDA+f7 list in Excel. We should have a discussion soon around how that code can be rewritten to make use of the browse mode abstraction work in #2975, so that Excel can have quick nav to comments and formulas and such, and how that elements list can also list charts. But for now, only the points in my last comment are important.

comment:7 follow-up: Changed 13 days ago by dineshkaushal

Thank you Mike.

I have made the changes as per your recommendation.

  1. previous and next properties for ExcelChartElement are now set to None. Since these elements get focus from excel events, I don't know how to set actual previous and next element.
  2. removed the redirect scripts and added canPropogate for those scripts.
  3. added translators comments
  4. _select renamed to _getChartElementText
  5. changed role to ROLE_CHART for ExcelChart
  6. added classes for the objects that do some processing. ExcelChartElementBase handles default prompts for other elements.

I need your help for reporting color for the series. I have provided the similar implementation that is found in excel for color reporting, but NVDA announces rgb(red=x,green = y , blue = z).
Please check def script_reportCurrentChartElementColor(self,gesture) in ExcelChartElementBase

the branch is at in_t1987_f7
https://manish_agrawal@bitbucket.org/manish_agrawal/nvda.git

comment:8 follow-up: Changed 13 days ago by dineshkaushal

Forgot to ask:

where can I find the code for element list for browse mode? I tried, but I didn't find it in excel.py in branch next and t2975.

comment:9 in reply to: ↑ 7 ; follow-up: Changed 12 days ago by mdcurran

Replying to dineshkaushal:
Great.
For colors, you need to use the RGB object's name property.

ui.message ( _( "Series color: {} ").format(colors.RGB.fromCOLORREF(int( self.excelChartObject.SeriesCollection( self.arg1 ).Interior.Color ) ).name  ) )

comment:10 in reply to: ↑ 8 ; follow-up: Changed 12 days ago by mdcurran

Replying to dineshkaushal:
New abstracted browse mode and elements list is part of #2975. Branch t2975.
However, its only been added to Microsoft Word so far. No work has been done on Excel.
Most of the abstraction is in browseMode.py, but you can see a real implementation in NVDAObjects/window/winword.py.

comment:11 in reply to: ↑ 9 Changed 12 days ago by dineshkaushal

Fixed the reporting of colors using the name property.
Thank you very much

comment:12 in reply to: ↑ 10 Changed 3 days ago by dineshkaushal

I have started working on integrating browseMode. I am seeking a clarification.

Do we need to implement TextInfo? as per the following code, it looks that we need to implement TextInfo.

class TextInfoQuickNavItem(QuickNavItem):

def activate(self):

self.textInfo.activate()

Should we discuss these issues on this ticket or on #2975?
Replying to mdcurran:

Replying to dineshkaushal:
New abstracted browse mode and elements list is part of #2975. Branch t2975.
However, its only been added to Microsoft Word so far. No work has been done on Excel.
Most of the abstraction is in browseMode.py, but you can see a real implementation in NVDAObjects/window/winword.py.

comment:13 follow-up: Changed 3 days ago by jteh

No, you shouldn't implement a TextInfo. TextInfoQuickNavItem provides a base implementation of several QuickNavItem methods to avoid duplication if you do have a TextInfo. If you don't, you inherit from QuickNavItem directly and implement those methods (such as {{{lt_}} (less than comparison), label, activate, isChild, moveTo, etc.) yourself. See the QuickNavItem class for details.

comment:14 in reply to: ↑ 13 Changed 3 days ago by dineshkaushal

Then will I also implement

class BrowseModeTreeInterceptor(treeInterceptorHandler.TreeInterceptor):

Because script BrowseModeTreeInterceptor.activatePosition calls self._activatePosition(info)

comment:15 Changed 3 days ago by jteh

Hmm. We'll need to discuss that. For now, just subclass BrowseModeTreeInterceptor. If you want enter to work, just override script_activatePosition. If we change anything related to this, it won't have a significant impact on your code.

Note: See TracTickets for help on using tickets.