summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/pivot_table.rb
AgeCommit message (Collapse)Author
2023-10-19Merge pull request #273 from tagliala/chore/fix-unused-block-argumentZsolt Kozaroczy
Fix Lint/UnusedBlockArgument offenses
2023-06-15Fix Lint/UnusedBlockArgument offensesGeremia Taglialatela
Use `each_value` instead of `each` where possible. The performance gain is minimal (3%). ``` Comparison: each_value: 4105733.4 i/s each: 3998011.4 i/s - 1.03x (± 0.00) slower ```
2023-06-10Fix safe Style/ColonMethodCall offensesGeremia Taglialatela
Caxlsx is using both `.` and `::`, 220 occurrences vs 280 to invoke methods on `Axlsx` module. This commit standardizes the approach towards `.`, which will also allow shorter lines. Performance is not affected ``` Comparison: Axlsx.validate: 8515252.3 i/s Axlsx::validate: 8512863.7 i/s - same-ish: difference falls within error ```
2023-06-05Prefer `Kernel#format` to `String#%`Geremia Taglialatela
This commit fixes cases that cannot be detected by RuboCop Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
2023-06-05Fix Style/RedundantInterpolation offensesGeremia Taglialatela
`%` is an operation on `String` that will return a new `String`, so the interpolation is redundant Also adds a missing spec on PivotTable#rels_pn ``` IPS: uninterpolated: 4045715.7 i/s interpolated: 2359775.6 i/s - 1.71x (± 0.00) slower Memory: uninterpolated: 160 allocated interpolated: 232 allocated - 1.45x more ```
2023-05-31Remove redundant parenthesesGeremia Taglialatela
- Style/ParenthesesAroundCondition - Style/RedundantParentheses - Style/TernaryParentheses `Style/ParenthesesAroundCondition` may be questionable, but a majority of comparison where not using parentheses, so offenses have been fixed for uniformity across the codebase
2023-05-31Use Ruby 1.9 hash syntaxGeremia Taglialatela
2023-05-20Fix Lint/Void offensesGeremia Taglialatela
Setter methods return the assigned value. Given: ```rb class MyClass def foo=(v) v = 10 42 end end ``` `my_object.foo = 5` will always return `5` This methods removes code that does not have effect
2023-05-05Pipe output directly to str and avoid additional memory allocationsPaul Kmiec
Currently, there are lots of examples of code like this, ``` str << ('<tag ' << foo << ' ' << bar << '/>') ``` which create the string for the tag in memory before piping to str. We can avoid creating all of these intermediate strings by dropping the paranthesis and piping directly to str. This relies on the `str` passed around to handle lots of small appends. This is a problem when using RubyZip, but that is solved in the next commit.
2023-05-04Fix tests / code to work with frozen string literalsPaul Kmiec
2023-05-04Enable Style/FrozenStringLiteralComment and autocorrectPaul Kmiec
2023-04-08Fix space-related offensesGeremia Taglialatela
- Layout/SpaceAfterComma - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceAroundOperators - Layout/SpaceBeforeBlockBraces - Layout/SpaceInsideBlockBraces - Layout/SpaceInsideHashLiteralBraces - Layout/SpaceInsideParens
2023-04-08Fix EmptyLines related offensesGeremia Taglialatela
2023-04-06Fix Layout/EmptyLines offensesGeremia Taglialatela
``` rubocop --only Layout/EmptyLines -a ```
2023-04-06Fix Style/Encoding offensesGeremia Taglialatela
``` rubocop --only Style/Encoding -a ```
2022-07-21Prevent Excel from crashing when multiple data columns are added to PivotTableKnut Stenmark
Excel will crash unless both `colFields` and `colItems` are declared in the PivotTable xml. First `field` of `colFields` needs to be set to -2 to tell Excel that the value columns comes from individual columns and not groups. I do not know why `colItems` are needed, but when set, the Excel document opens without crashing.
2022-07-09Add pivot table option to sort headers (#143)James Lam
2022-01-28Fix invalid xml when pivot table created with more than one column in data fieldWeston Ganger
2021-03-19Add support for format in pivot tables (#79)Knut I. Stenmark
2018-02-08chore(coverage) increase coverage and cleanuprandym
2016-11-07Added style_info field to pivot_table.rbEvan Hallmark
2016-11-07Updated pivot_table#pivot_field_for to use the axisPage attr for page fields ↵Evan Hallmark
instead of axisCol
2016-11-07Added pivot table option to pass in list of row fields to omit subtotals fromEvan Hallmark
2014-02-26Huge refactoringJurriaan Pruis
Do not create huge strings Let Row inherit from SimpleTypedList Optimized sanitizing Optimized validation And more..
2013-09-13initialize subtotal to remove warningsRandy Morgan
2013-09-13Bring documentation up to 100%Randy Morgan
2013-09-13repair pivot table data ref populate and bring coverage back up to 100%Randy Morgan
2013-07-24Merge branch 'master' of https://github.com/randym/axlsxJean Jacques Warmerdam
2013-07-08Make relationship ids more reliable.Stefan Daschek
Relationship instances now keep track of their own id – this should be much more reliable than the old way of more or less “guessing” the relationship id based on the position of some object in some array. Fixes https://github.com/randym/axlsx/issues/212, especially. Each relationship now has its own, unique id – except for the cases when it doesn’t: Some relationships need to share the same id, see `Relation#should_use_same_id_as?` for the gory details. All tests pass, and the full example.xlsx is generated without errors and looks fine in Excel for Mac 2011. The pivot table example still has the problems mentioned in https://github.com/randym/axlsx/issues/168 – but as far as I can tell I didn’t make it worse (Excel is still be able to “repair” the file, and the repaired file then contains the pivot table).
2013-06-13Allow a different subtotal function for each data field.Samuel de Framond
2013-06-13Modify pivot table caption according to subtotal function.Samuel de Framond
2013-06-12Add a subtotal option to PivotTable (dirty).Samuel de Framond
2013-02-25Allow other sheet as data source for pivot tables and fix hard coded sheet ↵Jean Jacques Warmerdam
name in Pivot Table Cache Definition
2013-02-04Completed missing docs and pre-release prepRandy Morgan
2012-12-19Removed unused relationships_index_of method in pivot_tableRandy Morgan
2012-12-15Added methods to simplify outlining with specsRandy Morgan
worksheet#outline_rows worksheet#outline_columns
2012-11-27Can configure a pivot table when creating itAlex Rothenberg
see examples/pivot_table.rb wb.add_worksheet(:name => "Data Sheet") do |sheet| sheet.add_row ['Month', 'Year', 'Type', 'Sales', 'Region'] 30.times { sheet.add_row [month, year, type, sales, region] } sheet.add_pivot_table 'G4:L17', "A1:E31" do |pivot_table| pivot_table.rows = ['Month', 'Year'] pivot_table.columns = ['Type'] pivot_table.data = ['Sales'] pivot_table.pages = ['Region'] end end
2012-11-27Create a simple Pivot TableAlex Rothenberg
* an example can be run with `ruby examples/pivot_table.rb` * right now you cannot set options on the pivot table to make it useful (coming soon...)