write_xlsx 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +3 -0
- data/examples/sparklines1.rb +62 -0
- data/examples/sparklines2.rb +391 -0
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/worksheet.rb +760 -48
- data/test/perl_output/sparklines1.xlsx +0 -0
- data/test/perl_output/sparklines2.xlsx +0 -0
- data/test/test_example_match.rb +425 -0
- data/test/worksheet/test_cond_format_20.rb +119 -0
- data/test/worksheet/test_sparkline_01.rb +65 -0
- data/test/worksheet/test_sparkline_02.rb +92 -0
- data/test/worksheet/test_sparkline_03.rb +133 -0
- data/test/worksheet/test_sparkline_04.rb +93 -0
- data/test/worksheet/test_sparkline_05.rb +93 -0
- data/test/worksheet/test_sparkline_06.rb +114 -0
- data/test/worksheet/test_sparkline_07.rb +357 -0
- data/test/worksheet/test_sparkline_08.rb +177 -0
- data/test/worksheet/test_sparkline_09.rb +1250 -0
- data/test/worksheet/test_sparkline_10.rb +107 -0
- data/test/worksheet/test_sparkline_11.rb +218 -0
- metadata +32 -8
- data/test/worksheet/test_write_ext.rb +0 -18
- data/test/worksheet/test_write_ext_lst.rb +0 -18
- data/test/worksheet/test_write_mx_plv.rb +0 -19
    
        data/README.rdoc
    CHANGED
    
    
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            #######################################################################
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # Example of how to add sparklines to an Excel::Writer::XLSX file.
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # Sparklines are small charts that fit in a single cell and are
         | 
| 9 | 
            +
            # used to show trends in data. See sparklines2.pl for examples
         | 
| 10 | 
            +
            # of more complex sparkline formatting.
         | 
| 11 | 
            +
            #
         | 
| 12 | 
            +
            # reverse ('(c)'), November 2011, John McNamara, jmcnamara@cpan.org
         | 
| 13 | 
            +
            # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
         | 
| 14 | 
            +
            #
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            require 'rubygems'
         | 
| 17 | 
            +
            require 'write_xlsx'
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            workbook  = WriteXLSX.new('sparklines1.xlsx')
         | 
| 20 | 
            +
            worksheet = workbook.add_worksheet
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            # Some sample data to plot.
         | 
| 23 | 
            +
            data = [
         | 
| 24 | 
            +
                    [ -2, 2,  3,  -1, 0 ],
         | 
| 25 | 
            +
                    [ 30, 20, 33, 20, 15 ],
         | 
| 26 | 
            +
                    [ 1,  -1, -1, 1,  -1 ]
         | 
| 27 | 
            +
                   ]
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            # Write the sample data to the worksheet.
         | 
| 30 | 
            +
            worksheet.write_col('A1', data)
         | 
| 31 | 
            +
             | 
| 32 | 
            +
             | 
| 33 | 
            +
            # Add a line sparkline (the default) with markers.
         | 
| 34 | 
            +
            worksheet.add_sparkline(
         | 
| 35 | 
            +
                                    {
         | 
| 36 | 
            +
                                      :location => 'F1',
         | 
| 37 | 
            +
                                      :range    => 'Sheet1!A1:E1',
         | 
| 38 | 
            +
                                      :markers  => 1
         | 
| 39 | 
            +
                }
         | 
| 40 | 
            +
            )
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            # Add a column sparkline with non-default style.
         | 
| 43 | 
            +
            worksheet.add_sparkline(
         | 
| 44 | 
            +
                                    {
         | 
| 45 | 
            +
                                      :location => 'F2',
         | 
| 46 | 
            +
                                      :range    => 'Sheet1!A2:E2',
         | 
| 47 | 
            +
                                      :type     => 'column',
         | 
| 48 | 
            +
                                      :style    => 12
         | 
| 49 | 
            +
                                    }
         | 
| 50 | 
            +
                                    )
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # Add a win/loss sparkline with negative values highlighted.
         | 
| 53 | 
            +
            worksheet.add_sparkline(
         | 
| 54 | 
            +
                                    {
         | 
| 55 | 
            +
                                      :location        => 'F3',
         | 
| 56 | 
            +
                                      :range           => 'Sheet1!A3:E3',
         | 
| 57 | 
            +
                                      :type            => 'win_loss',
         | 
| 58 | 
            +
                                      :negative_points => 1
         | 
| 59 | 
            +
                                    }
         | 
| 60 | 
            +
                                    )
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            workbook.close
         | 
| @@ -0,0 +1,391 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            #######################################################################
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # Example of how to add sparklines to an Excel::Writer::XLSX file.
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # Sparklines are small charts that fit in a single cell and are
         | 
| 9 | 
            +
            # used to show trends in data. This example shows the majority of
         | 
| 10 | 
            +
            # options that can be applied to sparklines.
         | 
| 11 | 
            +
            #
         | 
| 12 | 
            +
            # reverse ('(c)'), November 2011, John McNamara, jmcnamara@cpan.org
         | 
| 13 | 
            +
            # convert to ruby by Hideo NAKAMURA, cxn03651@msj.biglobe.ne.jp
         | 
| 14 | 
            +
            #
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            require 'rubygems'
         | 
| 17 | 
            +
            require 'write_xlsx'
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            workbook   = WriteXLSX.new('sparklines2.xlsx')
         | 
| 20 | 
            +
            worksheet1 = workbook.add_worksheet
         | 
| 21 | 
            +
            worksheet2 = workbook.add_worksheet
         | 
| 22 | 
            +
            bold       = workbook.add_format(:bold => 1)
         | 
| 23 | 
            +
            row = 1
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            # Set the columns widths to make the output clearer.
         | 
| 26 | 
            +
            worksheet1.set_column('A:A', 14)
         | 
| 27 | 
            +
            worksheet1.set_column('B:B', 50)
         | 
| 28 | 
            +
            worksheet1.set_zoom(150)
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            # Headings.
         | 
| 31 | 
            +
            worksheet1.write('A1', 'Sparkline',   bold)
         | 
| 32 | 
            +
            worksheet1.write('B1', 'Description', bold)
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            ###############################################################################
         | 
| 35 | 
            +
            #
         | 
| 36 | 
            +
            str = 'A default "line" sparkline.'
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            worksheet1.add_sparkline(
         | 
| 39 | 
            +
                                     {
         | 
| 40 | 
            +
                                       :location => 'A2',
         | 
| 41 | 
            +
                                       :range    => 'Sheet2!A1:J1'
         | 
| 42 | 
            +
                                     }
         | 
| 43 | 
            +
                                     )
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 46 | 
            +
            row += 1
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            ###############################################################################
         | 
| 49 | 
            +
            #
         | 
| 50 | 
            +
            str = 'A default "column" sparkline.'
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            worksheet1.add_sparkline(
         | 
| 53 | 
            +
                                     {
         | 
| 54 | 
            +
                                       :location => 'A3',
         | 
| 55 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 56 | 
            +
                                       :type     => 'column'
         | 
| 57 | 
            +
                                     }
         | 
| 58 | 
            +
                                     )
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 61 | 
            +
            row += 1
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            ###############################################################################
         | 
| 64 | 
            +
            #
         | 
| 65 | 
            +
            str = 'A default "win/loss" sparkline.'
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            worksheet1.add_sparkline(
         | 
| 68 | 
            +
                                     {
         | 
| 69 | 
            +
                                       :location => 'A4',
         | 
| 70 | 
            +
                                       :range    => 'Sheet2!A3:J3',
         | 
| 71 | 
            +
                                       :type     => 'win_loss'
         | 
| 72 | 
            +
                                     }
         | 
| 73 | 
            +
                                     )
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 76 | 
            +
            row += 2
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            ###############################################################################
         | 
| 79 | 
            +
            #
         | 
| 80 | 
            +
            str = 'Line with markers.'
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            worksheet1.add_sparkline(
         | 
| 83 | 
            +
                                     {
         | 
| 84 | 
            +
                                       :location => 'A6',
         | 
| 85 | 
            +
                                       :range    => 'Sheet2!A1:J1',
         | 
| 86 | 
            +
                                       :markers  => 1
         | 
| 87 | 
            +
                                     }
         | 
| 88 | 
            +
                                     )
         | 
| 89 | 
            +
             | 
| 90 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 91 | 
            +
            row += 1
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            ###############################################################################
         | 
| 94 | 
            +
            #
         | 
| 95 | 
            +
            str = 'Line with high and low points.'
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            worksheet1.add_sparkline(
         | 
| 98 | 
            +
                                     {
         | 
| 99 | 
            +
                                       :location   => 'A7',
         | 
| 100 | 
            +
                                       :range      => 'Sheet2!A1:J1',
         | 
| 101 | 
            +
                                       :high_point => 1,
         | 
| 102 | 
            +
                                       :low_point  => 1
         | 
| 103 | 
            +
                                     }
         | 
| 104 | 
            +
                                     )
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 107 | 
            +
            row += 1
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            ###############################################################################
         | 
| 110 | 
            +
            #
         | 
| 111 | 
            +
            str = 'Line with first and last point markers.'
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            worksheet1.add_sparkline(
         | 
| 114 | 
            +
                                     {
         | 
| 115 | 
            +
                                       :location    => 'A8',
         | 
| 116 | 
            +
                                       :range       => 'Sheet2!A1:J1',
         | 
| 117 | 
            +
                                       :first_point => 1,
         | 
| 118 | 
            +
                                       :last_point  => 1
         | 
| 119 | 
            +
                                     }
         | 
| 120 | 
            +
                                     )
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 123 | 
            +
            row += 1
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            ###############################################################################
         | 
| 126 | 
            +
            #
         | 
| 127 | 
            +
            str = 'Line with negative point markers.'
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            worksheet1.add_sparkline(
         | 
| 130 | 
            +
                                     {
         | 
| 131 | 
            +
                                       :location        => 'A9',
         | 
| 132 | 
            +
                                       :range           => 'Sheet2!A1:J1',
         | 
| 133 | 
            +
                                       :negative_points => 1
         | 
| 134 | 
            +
                                     }
         | 
| 135 | 
            +
                                     )
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 138 | 
            +
            row += 1
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            ###############################################################################
         | 
| 141 | 
            +
            #
         | 
| 142 | 
            +
            str = 'Line with axis.'
         | 
| 143 | 
            +
             | 
| 144 | 
            +
            worksheet1.add_sparkline(
         | 
| 145 | 
            +
                                     {
         | 
| 146 | 
            +
                                       :location => 'A10',
         | 
| 147 | 
            +
                                       :range    => 'Sheet2!A1:J1',
         | 
| 148 | 
            +
                                       :axis     => 1
         | 
| 149 | 
            +
                                     }
         | 
| 150 | 
            +
                                     )
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 153 | 
            +
            row += 2
         | 
| 154 | 
            +
             | 
| 155 | 
            +
            ###############################################################################
         | 
| 156 | 
            +
            #
         | 
| 157 | 
            +
            str = 'Column with default style (1).'
         | 
| 158 | 
            +
             | 
| 159 | 
            +
            worksheet1.add_sparkline(
         | 
| 160 | 
            +
                                     {
         | 
| 161 | 
            +
                                       :location => 'A12',
         | 
| 162 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 163 | 
            +
                                       :type     => 'column'
         | 
| 164 | 
            +
                                     }
         | 
| 165 | 
            +
                                     )
         | 
| 166 | 
            +
             | 
| 167 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 168 | 
            +
            row += 1
         | 
| 169 | 
            +
             | 
| 170 | 
            +
            ###############################################################################
         | 
| 171 | 
            +
            #
         | 
| 172 | 
            +
            str = 'Column with style 2.'
         | 
| 173 | 
            +
             | 
| 174 | 
            +
            worksheet1.add_sparkline(
         | 
| 175 | 
            +
                                     {
         | 
| 176 | 
            +
                                       :location => 'A13',
         | 
| 177 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 178 | 
            +
                                       :type     => 'column',
         | 
| 179 | 
            +
                                       :style    => 2
         | 
| 180 | 
            +
                                     }
         | 
| 181 | 
            +
                                     )
         | 
| 182 | 
            +
             | 
| 183 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 184 | 
            +
            row += 1
         | 
| 185 | 
            +
             | 
| 186 | 
            +
            ###############################################################################
         | 
| 187 | 
            +
            #
         | 
| 188 | 
            +
            str = 'Column with style 3.'
         | 
| 189 | 
            +
             | 
| 190 | 
            +
            worksheet1.add_sparkline(
         | 
| 191 | 
            +
                                     {
         | 
| 192 | 
            +
                                       :location => 'A14',
         | 
| 193 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 194 | 
            +
                                       :type     => 'column',
         | 
| 195 | 
            +
                                       :style    => 3
         | 
| 196 | 
            +
                                     }
         | 
| 197 | 
            +
                                     )
         | 
| 198 | 
            +
             | 
| 199 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 200 | 
            +
            row += 1
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            ###############################################################################
         | 
| 203 | 
            +
            #
         | 
| 204 | 
            +
            str = 'Column with style 4.'
         | 
| 205 | 
            +
             | 
| 206 | 
            +
            worksheet1.add_sparkline(
         | 
| 207 | 
            +
                                     {
         | 
| 208 | 
            +
                                       :location => 'A15',
         | 
| 209 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 210 | 
            +
                                       :type     => 'column',
         | 
| 211 | 
            +
                                       :style    => 4
         | 
| 212 | 
            +
                                     }
         | 
| 213 | 
            +
                                     )
         | 
| 214 | 
            +
             | 
| 215 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 216 | 
            +
            row += 1
         | 
| 217 | 
            +
             | 
| 218 | 
            +
            ###############################################################################
         | 
| 219 | 
            +
            #
         | 
| 220 | 
            +
            str = 'Column with style 5.'
         | 
| 221 | 
            +
             | 
| 222 | 
            +
            worksheet1.add_sparkline(
         | 
| 223 | 
            +
                                     {
         | 
| 224 | 
            +
                                       :location => 'A16',
         | 
| 225 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 226 | 
            +
                                       :type     => 'column',
         | 
| 227 | 
            +
                                       :style    => 5
         | 
| 228 | 
            +
                                     }
         | 
| 229 | 
            +
                                     )
         | 
| 230 | 
            +
             | 
| 231 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 232 | 
            +
            row += 1
         | 
| 233 | 
            +
             | 
| 234 | 
            +
            ###############################################################################
         | 
| 235 | 
            +
            #
         | 
| 236 | 
            +
            str = 'Column with style 6.'
         | 
| 237 | 
            +
             | 
| 238 | 
            +
            worksheet1.add_sparkline(
         | 
| 239 | 
            +
                                     {
         | 
| 240 | 
            +
                                       :location => 'A17',
         | 
| 241 | 
            +
                                       :range    => 'Sheet2!A2:J2',
         | 
| 242 | 
            +
                                       :type     => 'column',
         | 
| 243 | 
            +
                                       :style    => 6
         | 
| 244 | 
            +
                                     }
         | 
| 245 | 
            +
                                     )
         | 
| 246 | 
            +
             | 
| 247 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 248 | 
            +
            row += 1
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            ###############################################################################
         | 
| 251 | 
            +
            #
         | 
| 252 | 
            +
            str = 'Column with a user defined colour.'
         | 
| 253 | 
            +
             | 
| 254 | 
            +
            worksheet1.add_sparkline(
         | 
| 255 | 
            +
                                     {
         | 
| 256 | 
            +
                                       :location     => 'A18',
         | 
| 257 | 
            +
                                       :range        => 'Sheet2!A2:J2',
         | 
| 258 | 
            +
                                       :type         => 'column',
         | 
| 259 | 
            +
                                       :series_color => '#E965E0'
         | 
| 260 | 
            +
                                     }
         | 
| 261 | 
            +
                                     )
         | 
| 262 | 
            +
             | 
| 263 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 264 | 
            +
            row += 2
         | 
| 265 | 
            +
             | 
| 266 | 
            +
            ###############################################################################
         | 
| 267 | 
            +
            #
         | 
| 268 | 
            +
            str = 'A win/loss sparkline.'
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            worksheet1.add_sparkline(
         | 
| 271 | 
            +
                                     {
         | 
| 272 | 
            +
                                       :location => 'A20',
         | 
| 273 | 
            +
                                       :range    => 'Sheet2!A3:J3',
         | 
| 274 | 
            +
                                       :type     => 'win_loss'
         | 
| 275 | 
            +
                                     }
         | 
| 276 | 
            +
                                     )
         | 
| 277 | 
            +
             | 
| 278 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 279 | 
            +
            row += 1
         | 
| 280 | 
            +
             | 
| 281 | 
            +
            ###############################################################################
         | 
| 282 | 
            +
            #
         | 
| 283 | 
            +
            str = 'A win/loss sparkline with negative points highlighted.'
         | 
| 284 | 
            +
             | 
| 285 | 
            +
            worksheet1.add_sparkline(
         | 
| 286 | 
            +
                                     {
         | 
| 287 | 
            +
                                       :location        => 'A21',
         | 
| 288 | 
            +
                                       :range           => 'Sheet2!A3:J3',
         | 
| 289 | 
            +
                                       :type            => 'win_loss',
         | 
| 290 | 
            +
                                       :negative_points => 1
         | 
| 291 | 
            +
                                     }
         | 
| 292 | 
            +
                                     )
         | 
| 293 | 
            +
             | 
| 294 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 295 | 
            +
            row += 2
         | 
| 296 | 
            +
             | 
| 297 | 
            +
            ###############################################################################
         | 
| 298 | 
            +
            #
         | 
| 299 | 
            +
            str = 'A left to right column (the default).'
         | 
| 300 | 
            +
             | 
| 301 | 
            +
            worksheet1.add_sparkline(
         | 
| 302 | 
            +
                                     {
         | 
| 303 | 
            +
                                       :location => 'A23',
         | 
| 304 | 
            +
                                       :range    => 'Sheet2!A4:J4',
         | 
| 305 | 
            +
                                       :type     => 'column',
         | 
| 306 | 
            +
                                       :style    => 20
         | 
| 307 | 
            +
                                     }
         | 
| 308 | 
            +
                                     )
         | 
| 309 | 
            +
             | 
| 310 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 311 | 
            +
            row += 1
         | 
| 312 | 
            +
             | 
| 313 | 
            +
            ###############################################################################
         | 
| 314 | 
            +
            #
         | 
| 315 | 
            +
            str = 'A right to left column.'
         | 
| 316 | 
            +
             | 
| 317 | 
            +
            worksheet1.add_sparkline(
         | 
| 318 | 
            +
                                     {
         | 
| 319 | 
            +
                                       :location => 'A24',
         | 
| 320 | 
            +
                                       :range    => 'Sheet2!A4:J4',
         | 
| 321 | 
            +
                                       :type     => 'column',
         | 
| 322 | 
            +
                                       :style    => 20,
         | 
| 323 | 
            +
                                       :reverse  => 1
         | 
| 324 | 
            +
                                     }
         | 
| 325 | 
            +
                                     )
         | 
| 326 | 
            +
             | 
| 327 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 328 | 
            +
            row += 1
         | 
| 329 | 
            +
             | 
| 330 | 
            +
            ###############################################################################
         | 
| 331 | 
            +
            #
         | 
| 332 | 
            +
            str = 'Sparkline and text in one cell.'
         | 
| 333 | 
            +
             | 
| 334 | 
            +
            worksheet1.add_sparkline(
         | 
| 335 | 
            +
                                     {
         | 
| 336 | 
            +
                                       :location => 'A25',
         | 
| 337 | 
            +
                                       :range    => 'Sheet2!A4:J4',
         | 
| 338 | 
            +
                                       :type     => 'column',
         | 
| 339 | 
            +
                                       :style    => 20
         | 
| 340 | 
            +
                                     }
         | 
| 341 | 
            +
                                     )
         | 
| 342 | 
            +
             | 
| 343 | 
            +
            worksheet1.write(row,   0, 'Growth')
         | 
| 344 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 345 | 
            +
            row += 2
         | 
| 346 | 
            +
             | 
| 347 | 
            +
            ###############################################################################
         | 
| 348 | 
            +
            #
         | 
| 349 | 
            +
            str = 'A grouped sparkline. Changes are applied to all three.'
         | 
| 350 | 
            +
             | 
| 351 | 
            +
            worksheet1.add_sparkline(
         | 
| 352 | 
            +
                                     {
         | 
| 353 | 
            +
                                       :location => [ 'A27',          'A28',          'A29' ],
         | 
| 354 | 
            +
                                       :range    => [ 'Sheet2!A5:J5', 'Sheet2!A6:J6', 'Sheet2!A7:J7' ],
         | 
| 355 | 
            +
                                       :markers  => 1
         | 
| 356 | 
            +
                                     }
         | 
| 357 | 
            +
                                     )
         | 
| 358 | 
            +
             | 
| 359 | 
            +
            worksheet1.write(row, 1, str)
         | 
| 360 | 
            +
            row += 1
         | 
| 361 | 
            +
             | 
| 362 | 
            +
            ###############################################################################
         | 
| 363 | 
            +
            #
         | 
| 364 | 
            +
            # Create a second worksheet with data to plot.
         | 
| 365 | 
            +
            #
         | 
| 366 | 
            +
             | 
| 367 | 
            +
            worksheet2.set_column('A:J', 11)
         | 
| 368 | 
            +
             | 
| 369 | 
            +
            data = [
         | 
| 370 | 
            +
                    # Simple line data.
         | 
| 371 | 
            +
                    [ -2, 2, 3, -1, 0, -2, 3, 2, 1, 0 ],
         | 
| 372 | 
            +
             | 
| 373 | 
            +
                    # Simple column data.
         | 
| 374 | 
            +
                    [ 30, 20, 33, 20, 15, 5, 5, 15, 10, 15 ],
         | 
| 375 | 
            +
             | 
| 376 | 
            +
                    # Simple win/loss data.
         | 
| 377 | 
            +
                    [ 1, 1, -1, -1, 1, -1, 1, 1, 1, -1 ],
         | 
| 378 | 
            +
             | 
| 379 | 
            +
                    # Unbalanced histogram.
         | 
| 380 | 
            +
                    [ 5, 6, 7, 10, 15, 20, 30, 50, 70, 100 ],
         | 
| 381 | 
            +
             | 
| 382 | 
            +
                    # Data for the grouped sparkline example.
         | 
| 383 | 
            +
                    [ -2, 2,  3, -1, 0, -2, 3, 2, 1, 0 ],
         | 
| 384 | 
            +
                    [ 3,  -1, 0, -2, 3, 2,  1, 0, 2, 1 ],
         | 
| 385 | 
            +
                    [ 0,  -2, 3, 2,  1, 0,  1, 2, 3, 1 ]
         | 
| 386 | 
            +
                   ]
         | 
| 387 | 
            +
             | 
| 388 | 
            +
            # Write the sample data to the worksheet.
         | 
| 389 | 
            +
            worksheet2.write_col('A1', data)
         | 
| 390 | 
            +
             | 
| 391 | 
            +
            workbook.close
         |