question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Conditional Formatting Data Bar Formatting

See original GitHub issue

Hello,

My company is currently using XlsxWriter to write complex excel spreadsheets programmatically. Almost every feature we have wanted has been included already which has been really useful. The only thing missing for our use case is formatting Conditional Formatting when they are Data Bars.

The specific formatting options of interest can be seen in this image (note: Mac 2011 version of UI): screen shot 2014-10-02 at 2 12 51 pm What we are interested in:

  • Have a choice for setting the fill to either solid or gradient which currently defaults to gradient in your current implementation
  • Have the ability to choose positive and negative color values for the bar which is currently just one color by default
  • Have the ability to set Borders with positive and negative color values which is currently set to None by default
  • Be able to set Axis Position to Automatic, Midpoint, None which is currently set to None by default

We would not mind helping implement these features on a fork as described in CONTRIBUTING.md and submit a pull request. I just wanted to discuss this with you before we started this so we can discuss:

  • Do you want to include this feature into XlsxWriter
  • How best would it be to add this to the conditional formatting api without breaking current implementation
  • Is there anything else we need to consider before we attempt this

Proposal for how this would work:

worksheet.conditional_format(
    'A1:A12', 
    {'type': 'data_bar',
     'bar_color': 'pink' # also represents positive bar color,
     'bar_fill': 'solid', # 'gradient' if not specified, options are 'gradient' and 'solid'
     'negative_bar_color': 'blue', # set to bar_color by default
     'border': 'solid', # None by default but can be set to 'solid'
     'border_color': 'red', # Positive color value, also negative if negative is not set
     'border_negative_color': 'black', # border_color by default
     'axis_position': 'midpoint', # Can be 'midpoint', 'automatic' or None with None by default
     'axis_color': 'orange' #color of axis if automatic or midpoint})

I haven’t looked through all the other conditional formatting code but if any of those names would cause conflict then add data_bar to the name when appropriate.

Please let me know what you think. Also if any of these features are already implemented but I missed them in documentation and source code then please let me know.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lexlintoncommented, Oct 10, 2014

Hi John,

I finished up my initial implementation yesterday(without required documents/test cases so not ready for pull request by any means). I based it off a file generated by Excel 2013, but will finalize my implementation when I get a 2010 version of Excel. I extended the use of ExtList at the end of worksheet xml creation and actually hid the feature under the workbook.excel_version = ‘2010’ so that when it is set to ‘2007’ the extra xml is not generated otherwise. I will be touching up my code next week and hopefully I can get it tested and ready for pull request and then we can discuss my implementation. I have a windows computer so I will get Excel 2010 on it to do this testing.

Alex

Alex

0reactions
jmcnamaracommented, Apr 10, 2018

Full support for Excel 2010 style data bars has been added in XlsxWriter version 1.0.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel Conditional Formatting Data Bars - Contextures
Select the cells that contain the data bars. · On the Ribbon, click the Home tab · In the Styles group, click Conditional...
Read more >
Improve performance for apply conditional formatting (data bar) for ...
Check out the feature request in JavaScript - Spreadsheet - Improve performance for apply conditional formatting (data bar) for large data sets.
Read more >
Use data bars, color scales, and icon sets to highlight data
Data bars, color scales, and icon sets are conditional formats that create visual effects in your data. These conditional formats make it easier...
Read more >
Use conditional formatting rules in Looker Studio
Select a table or pivot table. On the right, click STYLE. At the top, in the Conditional formatting section, click + Add. Under...
Read more >
Conditional formatting of a cell - data bars &amp ... - Aspose Forums
Hello: For a cell that uses conditional formatting data bar or color scale how can I access ... We will evaluate your feature...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found