chartjs-ror 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
- data/README.md +71 -136
- data/lib/chartjs/chart_helpers.rb +23 -39
- data/lib/chartjs/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.js +160 -82
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6f2ebce780d9ca9649f2b1fcd39b5fa6fa09db3b
         | 
| 4 | 
            +
              data.tar.gz: 1363a9862e86500e3387284e7e43d95ba3cb91be
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 007b7d77f5c06bdd6c18cc782940073624d469e8e4ec00c582d156702c5fee413412baae7f7091e660305aac22a77f8a00ed254eace2ea128d507287954ec06a
         | 
| 7 | 
            +
              data.tar.gz: 9030000d33387b7259a27cb871df2d7906867f7f2d9f31b6a6cf636444f7797fed42371f3d0577564f0d70a99077be465b094dd412d174b6e3b051f8bad28737
         | 
    
        data/README.md
    CHANGED
    
    | @@ -33,36 +33,44 @@ You only need [excanvas][ExplorerCanvas] for IE7 and IE8.  Add [Modernizr][] if | |
| 33 33 |  | 
| 34 34 | 
             
            Each chart type has a corresponding helper for your views.  The helper methods take the same arguments as their Javascript counterparts.  The `options` are always optional.
         | 
| 35 35 |  | 
| 36 | 
            -
            ### Charts with multiple datasets
         | 
| 37 36 |  | 
| 38 37 | 
             
            ```erb
         | 
| 39 | 
            -
            <%= line_chart | 
| 40 | 
            -
            <%= bar_chart | 
| 41 | 
            -
            <%= radar_chart | 
| 38 | 
            +
            <%= line_chart     data, options %>
         | 
| 39 | 
            +
            <%= bar_chart      data, options %>
         | 
| 40 | 
            +
            <%= radar_chart    data, options %>
         | 
| 41 | 
            +
            <%= polar_chart    data, options %>
         | 
| 42 | 
            +
            <%= pie_chart      data, options %>
         | 
| 43 | 
            +
            <%= doughnut_chart data, options %>
         | 
| 42 44 | 
             
            ```
         | 
| 43 45 |  | 
| 44 46 | 
             
            For example, to render a [line chart][linechart] in Javascript:
         | 
| 45 47 |  | 
| 46 48 | 
             
            ```javascript
         | 
| 47 49 | 
             
            var data = {
         | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 50 | 
            +
                labels: ["January", "February", "March", "April", "May", "June", "July"],
         | 
| 51 | 
            +
                datasets: [
         | 
| 52 | 
            +
                    {
         | 
| 53 | 
            +
                        label: "My First dataset",
         | 
| 54 | 
            +
                        fillColor: "rgba(220,220,220,0.2)",
         | 
| 55 | 
            +
                        strokeColor: "rgba(220,220,220,1)",
         | 
| 56 | 
            +
                        pointColor: "rgba(220,220,220,1)",
         | 
| 57 | 
            +
                        pointStrokeColor: "#fff",
         | 
| 58 | 
            +
                        pointHighlightFill: "#fff",
         | 
| 59 | 
            +
                        pointHighlightStroke: "rgba(220,220,220,1)",
         | 
| 60 | 
            +
                        data: [65, 59, 80, 81, 56, 55, 40]
         | 
| 61 | 
            +
                    },
         | 
| 62 | 
            +
                    {
         | 
| 63 | 
            +
                        label: "My Second dataset",
         | 
| 64 | 
            +
                        fillColor: "rgba(151,187,205,0.2)",
         | 
| 65 | 
            +
                        strokeColor: "rgba(151,187,205,1)",
         | 
| 66 | 
            +
                        pointColor: "rgba(151,187,205,1)",
         | 
| 67 | 
            +
                        pointStrokeColor: "#fff",
         | 
| 68 | 
            +
                        pointHighlightFill: "#fff",
         | 
| 69 | 
            +
                        pointHighlightStroke: "rgba(151,187,205,1)",
         | 
| 70 | 
            +
                        data: [28, 48, 40, 19, 86, 27, 90]
         | 
| 71 | 
            +
                    }
         | 
| 72 | 
            +
                ]
         | 
| 73 | 
            +
            };
         | 
| 66 74 | 
             
            var options = {};
         | 
| 67 75 | 
             
            new Chart(ctx).Line(data,options);
         | 
| 68 76 | 
             
            ```
         | 
| @@ -70,109 +78,44 @@ new Chart(ctx).Line(data,options); | |
| 70 78 | 
             
            The Ruby equivalent is:
         | 
| 71 79 |  | 
| 72 80 | 
             
            ```ruby
         | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 81 | 
            +
            data = {
         | 
| 82 | 
            +
                labels: ["January", "February", "March", "April", "May", "June", "July"],
         | 
| 83 | 
            +
                datasets: [
         | 
| 84 | 
            +
                    {
         | 
| 85 | 
            +
                        label: "My First dataset",
         | 
| 86 | 
            +
                        fillColor: "rgba(220,220,220,0.2)",
         | 
| 87 | 
            +
                        strokeColor: "rgba(220,220,220,1)",
         | 
| 88 | 
            +
                        pointColor: "rgba(220,220,220,1)",
         | 
| 89 | 
            +
                        pointStrokeColor: "#fff",
         | 
| 90 | 
            +
                        pointHighlightFill: "#fff",
         | 
| 91 | 
            +
                        pointHighlightStroke: "rgba(220,220,220,1)",
         | 
| 92 | 
            +
                        data: [65, 59, 80, 81, 56, 55, 40]
         | 
| 93 | 
            +
                    },
         | 
| 94 | 
            +
                    {
         | 
| 95 | 
            +
                        label: "My Second dataset",
         | 
| 96 | 
            +
                        fillColor: "rgba(151,187,205,0.2)",
         | 
| 97 | 
            +
                        strokeColor: "rgba(151,187,205,1)",
         | 
| 98 | 
            +
                        pointColor: "rgba(151,187,205,1)",
         | 
| 99 | 
            +
                        pointStrokeColor: "#fff",
         | 
| 100 | 
            +
                        pointHighlightFill: "#fff",
         | 
| 101 | 
            +
                        pointHighlightStroke: "rgba(151,187,205,1)",
         | 
| 102 | 
            +
                        data: [28, 48, 40, 19, 86, 27, 90]
         | 
| 103 | 
            +
                    }
         | 
| 104 | 
            +
                ]
         | 
| 91 105 | 
             
            }
         | 
| 92 | 
            -
             | 
| 93 | 
            -
            <%= line_chart  | 
| 94 | 
            -
            ```
         | 
| 95 | 
            -
             | 
| 96 | 
            -
            ### Charts with one dataset
         | 
| 97 | 
            -
             | 
| 98 | 
            -
            ```erb
         | 
| 99 | 
            -
            <%= polar_chart data, options %>
         | 
| 100 | 
            -
            <%= pie_chart data, options %>
         | 
| 101 | 
            -
            <%= doughnut_chart data, options %>
         | 
| 102 | 
            -
            ```
         | 
| 103 | 
            -
             | 
| 104 | 
            -
            For example, to render a [pie chart][piechart] in Javascript:
         | 
| 105 | 
            -
             | 
| 106 | 
            -
            ```javascript
         | 
| 107 | 
            -
            var data = [
         | 
| 108 | 
            -
            	{
         | 
| 109 | 
            -
            		value : 30,
         | 
| 110 | 
            -
            		color: "#D97041"
         | 
| 111 | 
            -
            	},
         | 
| 112 | 
            -
            	{
         | 
| 113 | 
            -
            		value : 90,
         | 
| 114 | 
            -
            		color: "#C7604C"
         | 
| 115 | 
            -
            	},
         | 
| 116 | 
            -
            	{
         | 
| 117 | 
            -
            		value : 24,
         | 
| 118 | 
            -
            		color: "#21323D"
         | 
| 119 | 
            -
            	},
         | 
| 120 | 
            -
            	{
         | 
| 121 | 
            -
            		value : 58,
         | 
| 122 | 
            -
            		color: "#9D9B7F"
         | 
| 123 | 
            -
            	},
         | 
| 124 | 
            -
            	{
         | 
| 125 | 
            -
            		value : 82,
         | 
| 126 | 
            -
            		color: "#7D4F6D"
         | 
| 127 | 
            -
            	},
         | 
| 128 | 
            -
            	{
         | 
| 129 | 
            -
            		value : 8,
         | 
| 130 | 
            -
            		color: "#584A5E"
         | 
| 131 | 
            -
            	}
         | 
| 132 | 
            -
            ]
         | 
| 133 | 
            -
            new Chart(ctx).Pie(data,options);
         | 
| 134 | 
            -
            ```
         | 
| 135 | 
            -
             | 
| 136 | 
            -
            And in Ruby:
         | 
| 137 | 
            -
             | 
| 138 | 
            -
            ```ruby
         | 
| 139 | 
            -
            @data = [
         | 
| 140 | 
            -
            	{
         | 
| 141 | 
            -
            		value: 30,
         | 
| 142 | 
            -
            		color: "#D97041"
         | 
| 143 | 
            -
            	},
         | 
| 144 | 
            -
            	{
         | 
| 145 | 
            -
            		value: 90,
         | 
| 146 | 
            -
            		color: "#C7604C"
         | 
| 147 | 
            -
            	},
         | 
| 148 | 
            -
            	{
         | 
| 149 | 
            -
            		value: 24,
         | 
| 150 | 
            -
            		color: "#21323D"
         | 
| 151 | 
            -
            	},
         | 
| 152 | 
            -
            	{
         | 
| 153 | 
            -
            		value: 58,
         | 
| 154 | 
            -
            		color: "#9D9B7F"
         | 
| 155 | 
            -
            	},
         | 
| 156 | 
            -
            	{
         | 
| 157 | 
            -
            		value: 82,
         | 
| 158 | 
            -
            		color: "#7D4F6D"
         | 
| 159 | 
            -
            	},
         | 
| 160 | 
            -
            	{
         | 
| 161 | 
            -
            		value: 8,
         | 
| 162 | 
            -
            		color: "#584A5E"
         | 
| 163 | 
            -
            	}
         | 
| 164 | 
            -
            ]
         | 
| 165 | 
            -
            <%= pie_chart @data %>
         | 
| 106 | 
            +
            options = {}
         | 
| 107 | 
            +
            <%= line_chart data, options %>
         | 
| 166 108 | 
             
            ```
         | 
| 167 109 |  | 
| 168 110 | 
             
            ### Options
         | 
| 169 111 |  | 
| 170 112 | 
             
            You can put anything in the `options` hash that Chart.js recognises.  It also supports these non-Chart.js settings:
         | 
| 171 113 |  | 
| 172 | 
            -
            * `:class` | 
| 173 | 
            -
            * `:element_id` | 
| 174 | 
            -
            * `:width` | 
| 175 | 
            -
            * `:height` | 
| 114 | 
            +
            * `:class`          - class of the enclosing `<figure/>` - default is `chart`.
         | 
| 115 | 
            +
            * `:element_id`     - id of the `<canvas/>` - default is `chart-n` where `n` is the 0-based index of the chart on the page.
         | 
| 116 | 
            +
            * `:width`          - width of the canvas in px - default is `400`.
         | 
| 117 | 
            +
            * `:height`         - height of the canvas in px - default is `400`.
         | 
| 118 | 
            +
            * `:generateLegend` - whether or not to generate a legend - default is `false`.
         | 
| 176 119 |  | 
| 177 120 | 
             
            ### Sample output:
         | 
| 178 121 |  | 
| @@ -195,17 +138,17 @@ You can put anything in the `options` hash that Chart.js recognises.  It also su | |
| 195 138 | 
             
                  window.Chart["chart-0"] = chart;
         | 
| 196 139 |  | 
| 197 140 | 
             
                  var legend = chart.generateLegend();
         | 
| 198 | 
            -
                   | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 201 | 
            -
                    canvas.parentNode.insertBefore(legendHolder.firstChild, canvas.nextSibling);
         | 
| 202 | 
            -
                  }
         | 
| 141 | 
            +
                  var legendHolder = document.createElement("div");
         | 
| 142 | 
            +
                  legendHolder.innerHTML = legend;
         | 
| 143 | 
            +
                  canvas.parentNode.insertBefore(legendHolder.firstChild, canvas.nextSibling);
         | 
| 203 144 | 
             
                };
         | 
| 204 145 | 
             
                if (window.addEventListener) {
         | 
| 205 | 
            -
                  window.addEventListener( | 
| 146 | 
            +
                  window.addEventListener("load", initChart, false);
         | 
| 147 | 
            +
                  document.addEventListener("page:load", initChart, false);
         | 
| 206 148 | 
             
                }
         | 
| 207 149 | 
             
                else if (window.attachEvent) {
         | 
| 208 | 
            -
                  window.attachEvent( | 
| 150 | 
            +
                  window.attachEvent("onload", initChart);
         | 
| 151 | 
            +
                  document.attachEvent("page:load", initChart);
         | 
| 209 152 | 
             
                }
         | 
| 210 153 | 
             
              })();
         | 
| 211 154 | 
             
            </script>
         | 
| @@ -214,11 +157,11 @@ You can put anything in the `options` hash that Chart.js recognises.  It also su | |
| 214 157 | 
             
            The Javascript is actually written out on a single line but you get the idea.
         | 
| 215 158 |  | 
| 216 159 |  | 
| 217 | 
            -
            ### Templates (tooltips and legends)
         | 
| 160 | 
            +
            ### Templates (tooltips and legends) and Rails views
         | 
| 218 161 |  | 
| 219 162 | 
             
            If you specify a custom template, e.g. in `legendTemplate` or `tooltipTemplate`, you must escape opening tags in the Javascript-template string, i.e. use `<%%= value %>` instead of `<%= value %>`.
         | 
| 220 163 |  | 
| 221 | 
            -
            You need to add an escape `%` character for each level of rendering.  For  | 
| 164 | 
            +
            You need to add an escape `%` character for each level of rendering.  For example:
         | 
| 222 165 |  | 
| 223 166 | 
             
            - If your view calls the chart helper directly, use `<%%= value %>`.
         | 
| 224 167 | 
             
            - If your view renders a partial which calls the chart helper, use `<%%%= value %>`.
         | 
| @@ -226,9 +169,7 @@ You need to add an escape `%` character for each level of rendering.  For exampe | |
| 226 169 |  | 
| 227 170 | 
             
            ### Legend
         | 
| 228 171 |  | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
            If you don't want a legend, supply `legendTemplate: " "` in the options for your chart.  For some reason an empty string causes an exception inside Chart.js so use a single space.
         | 
| 172 | 
            +
            If you pass the option `generateLegend: true`, a legend will be rendered using `chart.generateLegend()` ([docs][advanced]).
         | 
| 232 173 |  | 
| 233 174 |  | 
| 234 175 | 
             
            ### Scale calculations
         | 
| @@ -236,12 +177,6 @@ If you don't want a legend, supply `legendTemplate: " "` in the options for your | |
| 236 177 | 
             
            The plugin implements its own abscissa scale calculations which I prefer to Chart.js's (see [Chart.js#132][calculations]).  You can opt-in to these calculations by passing `scaleOverride: true` in the `options` hash, without any of the other scale override keys (`scaleSteps`, `scaleStepWidth`, `scaleStartValue`).
         | 
| 237 178 |  | 
| 238 179 |  | 
| 239 | 
            -
            ## Inspiration
         | 
| 240 | 
            -
             | 
| 241 | 
            -
            * [Chart.js][] (obviously)
         | 
| 242 | 
            -
            * [Chartkick][]
         | 
| 243 | 
            -
             | 
| 244 | 
            -
             | 
| 245 180 | 
             
            ## Intellectual Property
         | 
| 246 181 |  | 
| 247 182 | 
             
            Copyright Andrew Stewart, AirBlade Software.  Released under the MIT licence.
         | 
| @@ -1,33 +1,16 @@ | |
| 1 1 | 
             
            module Chartjs
         | 
| 2 2 | 
             
              module ChartHelpers
         | 
| 3 3 |  | 
| 4 | 
            -
                 | 
| 5 | 
            -
                   | 
| 6 | 
            -
                 | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
                  chart 'Bar', labels, datasets, options
         | 
| 10 | 
            -
                end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                def radar_chart(labels, datasets, options = {})
         | 
| 13 | 
            -
                  chart 'Radar', labels, datasets, options
         | 
| 14 | 
            -
                end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                def polar_area_chart(data, options = {})
         | 
| 17 | 
            -
                  chart 'PolarArea', nil, data, options
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                def pie_chart(data, options = {})
         | 
| 21 | 
            -
                  chart 'Pie', nil, data, options
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                def doughnut_chart(data, options = {})
         | 
| 25 | 
            -
                  chart 'Doughnut', nil, data, options
         | 
| 4 | 
            +
                %w[ Line Bar Radar PolarArea Pie Doughnut ].each do |type|
         | 
| 5 | 
            +
                  camel_type = type.gsub(/(\w)([A-Z])/, '\1_\2').downcase
         | 
| 6 | 
            +
                  define_method "#{camel_type}_chart" do |data, options = {}|    # def polar_area_chart(data, options = {})
         | 
| 7 | 
            +
                    chart type, data, options                                    #   chart 'PolarArea', data, options
         | 
| 8 | 
            +
                  end                                                            # end
         | 
| 26 9 | 
             
                end
         | 
| 27 10 |  | 
| 28 11 | 
             
                private
         | 
| 29 12 |  | 
| 30 | 
            -
                def chart(klass,  | 
| 13 | 
            +
                def chart(klass, data, options)
         | 
| 31 14 | 
             
                  @chart_id ||= -1
         | 
| 32 15 | 
             
                  element_id = options.delete(:id)     || "chart-#{@chart_id += 1}"
         | 
| 33 16 | 
             
                  css_class  = options.delete(:class)  || 'chart'
         | 
| @@ -39,14 +22,22 @@ module Chartjs | |
| 39 22 |  | 
| 40 23 | 
             
                  # Alternative scale calculations.
         | 
| 41 24 | 
             
                  if options[:scaleOverride] && !options.has_key?(:scaleSteps)
         | 
| 42 | 
            -
                    options.merge! ordinate_scale(combined_data( | 
| 25 | 
            +
                    options.merge! ordinate_scale(combined_data(data))
         | 
| 43 26 | 
             
                  end
         | 
| 44 27 |  | 
| 28 | 
            +
                  generate_legend = options.delete :generateLegend
         | 
| 29 | 
            +
                  legend = <<-END
         | 
| 30 | 
            +
                    var legend = chart.generateLegend();
         | 
| 31 | 
            +
                    var legendHolder = document.createElement("div");
         | 
| 32 | 
            +
                    legendHolder.innerHTML = legend;
         | 
| 33 | 
            +
                    canvas.parentNode.insertBefore(legendHolder.firstChild, canvas.nextSibling);
         | 
| 34 | 
            +
                  END
         | 
| 35 | 
            +
             | 
| 45 36 | 
             
                  script = javascript_tag do
         | 
| 46 37 | 
             
                    <<-END.squish.html_safe
         | 
| 47 38 | 
             
                    (function() {
         | 
| 48 39 | 
             
                      var initChart = function() {
         | 
| 49 | 
            -
                        var data = #{ | 
| 40 | 
            +
                        var data = #{data.to_json};
         | 
| 50 41 | 
             
                        var opts = #{options.to_json};
         | 
| 51 42 | 
             
                        if (!("animation" in opts)) {
         | 
| 52 43 | 
             
                          opts["animation"] = (typeof Modernizr == "undefined") || Modernizr.canvas;
         | 
| @@ -56,20 +47,17 @@ module Chartjs | |
| 56 47 | 
             
                        var chart = new Chart(ctx).#{klass}(data, opts);
         | 
| 57 48 | 
             
                        window.Chart[#{element_id.to_json}] = chart;
         | 
| 58 49 |  | 
| 59 | 
            -
                         | 
| 60 | 
            -
                        if (legend.trim().length > 0) {
         | 
| 61 | 
            -
                          var legendHolder = document.createElement("div");
         | 
| 62 | 
            -
                          legendHolder.innerHTML = legend;
         | 
| 63 | 
            -
                          canvas.parentNode.insertBefore(legendHolder.firstChild, canvas.nextSibling);
         | 
| 64 | 
            -
                        }
         | 
| 50 | 
            +
                        #{legend if generate_legend}
         | 
| 65 51 | 
             
                      };
         | 
| 66 52 | 
             
                      /* W3C standard */
         | 
| 67 53 | 
             
                      if (window.addEventListener) {
         | 
| 68 54 | 
             
                        window.addEventListener("load", initChart, false);
         | 
| 55 | 
            +
                        document.addEventListener("page:load", initChart, false);
         | 
| 69 56 | 
             
                      }
         | 
| 70 57 | 
             
                      /* IE */
         | 
| 71 58 | 
             
                      else if (window.attachEvent) {
         | 
| 72 59 | 
             
                        window.attachEvent("onload", initChart);
         | 
| 60 | 
            +
                        document.attachEvent("page:load", initChart);
         | 
| 73 61 | 
             
                      }
         | 
| 74 62 | 
             
                    })();
         | 
| 75 63 | 
             
                    END
         | 
| @@ -78,17 +66,13 @@ module Chartjs | |
| 78 66 | 
             
                  content_tag(:figure, canvas, class: css_class) + script
         | 
| 79 67 | 
             
                end
         | 
| 80 68 |  | 
| 81 | 
            -
                def  | 
| 82 | 
            -
                  if  | 
| 83 | 
            -
                     | 
| 69 | 
            +
                def combined_data(data)
         | 
| 70 | 
            +
                  if data.is_a? Array
         | 
| 71 | 
            +
                    data.map { |datum| datum[:value] }
         | 
| 84 72 | 
             
                  else
         | 
| 85 | 
            -
                    datasets. | 
| 73 | 
            +
                    data[:datasets].flat_map { |dataset| dataset[:data] }
         | 
| 86 74 | 
             
                  end
         | 
| 87 75 | 
             
                end
         | 
| 88 76 |  | 
| 89 | 
            -
                def combined_data(datasets)
         | 
| 90 | 
            -
                  datasets.map { |d| d[:data] || d[:value] }.flatten
         | 
| 91 | 
            -
                end
         | 
| 92 | 
            -
             | 
| 93 77 | 
             
              end
         | 
| 94 78 | 
             
            end
         | 
    
        data/lib/chartjs/version.rb
    CHANGED
    
    
| @@ -1,9 +1,9 @@ | |
| 1 1 | 
             
            /*!
         | 
| 2 2 | 
             
             * Chart.js
         | 
| 3 3 | 
             
             * http://chartjs.org/
         | 
| 4 | 
            -
             * Version: 1.0.1 | 
| 4 | 
            +
             * Version: 1.0.1
         | 
| 5 5 | 
             
             *
         | 
| 6 | 
            -
             * Copyright  | 
| 6 | 
            +
             * Copyright 2015 Nick Downie
         | 
| 7 7 | 
             
             * Released under the MIT license
         | 
| 8 8 | 
             
             * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
         | 
| 9 9 | 
             
             */
         | 
| @@ -92,12 +92,15 @@ | |
| 92 92 | 
             
            			// Boolean - whether or not the chart should be responsive and resize when the browser does.
         | 
| 93 93 | 
             
            			responsive: false,
         | 
| 94 94 |  | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 95 | 
            +
            			// Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
         | 
| 96 | 
            +
            			maintainAspectRatio: true,
         | 
| 97 97 |  | 
| 98 98 | 
             
            			// Boolean - Determines whether to draw tooltips on the canvas or not - attaches events to touchmove & mousemove
         | 
| 99 99 | 
             
            			showTooltips: true,
         | 
| 100 100 |  | 
| 101 | 
            +
            			// Boolean - Determines whether to draw built-in tooltip or call custom tooltip function
         | 
| 102 | 
            +
            			customTooltips: false,
         | 
| 103 | 
            +
             | 
| 101 104 | 
             
            			// Array - Array of string names to attach tooltip events
         | 
| 102 105 | 
             
            			tooltipEvents: ["mousemove", "touchstart", "touchmove", "mouseout"],
         | 
| 103 106 |  | 
| @@ -238,7 +241,7 @@ | |
| 238 241 | 
             
            				if (filterCallback(currentItem)){
         | 
| 239 242 | 
             
            					return currentItem;
         | 
| 240 243 | 
             
            				}
         | 
| 241 | 
            -
            			} | 
| 244 | 
            +
            			}
         | 
| 242 245 | 
             
            		},
         | 
| 243 246 | 
             
            		findPreviousWhere = helpers.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex){
         | 
| 244 247 | 
             
            			// Default to end of the array
         | 
| @@ -250,7 +253,7 @@ | |
| 250 253 | 
             
            				if (filterCallback(currentItem)){
         | 
| 251 254 | 
             
            					return currentItem;
         | 
| 252 255 | 
             
            				}
         | 
| 253 | 
            -
            			} | 
| 256 | 
            +
            			}
         | 
| 254 257 | 
             
            		},
         | 
| 255 258 | 
             
            		inherits = helpers.inherits = function(extensions){
         | 
| 256 259 | 
             
            			//Basic javascript inheritance based on the model created in Backbone.js
         | 
| @@ -441,7 +444,9 @@ | |
| 441 444 | 
             
            		//Templating methods
         | 
| 442 445 | 
             
            		//Javascript micro templating by John Resig - source at http://ejohn.org/blog/javascript-micro-templating/
         | 
| 443 446 | 
             
            		template = helpers.template = function(templateString, valuesObject){
         | 
| 444 | 
            -
             | 
| 447 | 
            +
             | 
| 448 | 
            +
            			// If templateString is function rather than string-template - call the function for valuesObject
         | 
| 449 | 
            +
             | 
| 445 450 | 
             
            			if(templateString instanceof Function){
         | 
| 446 451 | 
             
            			 	return templateString(valuesObject);
         | 
| 447 452 | 
             
            		 	}
         | 
| @@ -830,7 +835,7 @@ | |
| 830 835 | 
             
            				newHeight = this.options.maintainAspectRatio ? newWidth / this.chart.aspectRatio : getMaximumHeight(this.chart.canvas);
         | 
| 831 836 |  | 
| 832 837 | 
             
            			canvas.width = this.chart.width = newWidth;
         | 
| 833 | 
            -
            			canvas.height = | 
| 838 | 
            +
            			canvas.height = this.chart.height = newHeight;
         | 
| 834 839 |  | 
| 835 840 | 
             
            			retinaScale(this.chart);
         | 
| 836 841 |  | 
| @@ -866,6 +871,21 @@ | |
| 866 871 | 
             
            		destroy : function(){
         | 
| 867 872 | 
             
            			this.clear();
         | 
| 868 873 | 
             
            			unbindEvents(this, this.events);
         | 
| 874 | 
            +
            			var canvas = this.chart.canvas;
         | 
| 875 | 
            +
             | 
| 876 | 
            +
            			// Reset canvas height/width attributes starts a fresh with the canvas context
         | 
| 877 | 
            +
            			canvas.width = this.chart.width;
         | 
| 878 | 
            +
            			canvas.height = this.chart.height;
         | 
| 879 | 
            +
             | 
| 880 | 
            +
            			// < IE9 doesn't support removeProperty
         | 
| 881 | 
            +
            			if (canvas.style.removeProperty) {
         | 
| 882 | 
            +
            				canvas.style.removeProperty('width');
         | 
| 883 | 
            +
            				canvas.style.removeProperty('height');
         | 
| 884 | 
            +
            			} else {
         | 
| 885 | 
            +
            				canvas.style.removeAttribute('width');
         | 
| 886 | 
            +
            				canvas.style.removeAttribute('height');
         | 
| 887 | 
            +
            			}
         | 
| 888 | 
            +
             | 
| 869 889 | 
             
            			delete Chart.instances[this.id];
         | 
| 870 890 | 
             
            		},
         | 
| 871 891 | 
             
            		showTooltip : function(ChartElements, forceRedraw){
         | 
| @@ -895,6 +915,9 @@ | |
| 895 915 | 
             
            				this.activeElements = ChartElements;
         | 
| 896 916 | 
             
            			}
         | 
| 897 917 | 
             
            			this.draw();
         | 
| 918 | 
            +
            			if(this.options.customTooltips){
         | 
| 919 | 
            +
            				this.options.customTooltips(false);
         | 
| 920 | 
            +
            			}
         | 
| 898 921 | 
             
            			if (ChartElements.length > 0){
         | 
| 899 922 | 
             
            				// If we have multiple datasets, show a MultiTooltip for all of the data points at that index
         | 
| 900 923 | 
             
            				if (this.datasets && this.datasets.length > 1) {
         | 
| @@ -975,7 +998,8 @@ | |
| 975 998 | 
             
            						legendColorBackground : this.options.multiTooltipKeyBackground,
         | 
| 976 999 | 
             
            						title: ChartElements[0].label,
         | 
| 977 1000 | 
             
            						chart: this.chart,
         | 
| 978 | 
            -
            						ctx: this.chart.ctx
         | 
| 1001 | 
            +
            						ctx: this.chart.ctx,
         | 
| 1002 | 
            +
            						custom: this.options.customTooltips
         | 
| 979 1003 | 
             
            					}).draw();
         | 
| 980 1004 |  | 
| 981 1005 | 
             
            				} else {
         | 
| @@ -994,7 +1018,8 @@ | |
| 994 1018 | 
             
            							caretHeight: this.options.tooltipCaretSize,
         | 
| 995 1019 | 
             
            							cornerRadius: this.options.tooltipCornerRadius,
         | 
| 996 1020 | 
             
            							text: template(this.options.tooltipTemplate, Element),
         | 
| 997 | 
            -
            							chart: this.chart
         | 
| 1021 | 
            +
            							chart: this.chart,
         | 
| 1022 | 
            +
            							custom: this.options.customTooltips
         | 
| 998 1023 | 
             
            						}).draw();
         | 
| 999 1024 | 
             
            					}, this);
         | 
| 1000 1025 | 
             
            				}
         | 
| @@ -1250,7 +1275,7 @@ | |
| 1250 1275 | 
             
            			this.yAlign = "above";
         | 
| 1251 1276 |  | 
| 1252 1277 | 
             
            			//Distance between the actual element.y position and the start of the tooltip caret
         | 
| 1253 | 
            -
            			var caretPadding = 2;
         | 
| 1278 | 
            +
            			var caretPadding = this.caretPadding = 2;
         | 
| 1254 1279 |  | 
| 1255 1280 | 
             
            			var tooltipWidth = ctx.measureText(this.text).width + 2*this.xPadding,
         | 
| 1256 1281 | 
             
            				tooltipRectHeight = this.fontSize + 2*this.yPadding,
         | 
| @@ -1272,47 +1297,53 @@ | |
| 1272 1297 |  | 
| 1273 1298 | 
             
            			ctx.fillStyle = this.fillColor;
         | 
| 1274 1299 |  | 
| 1275 | 
            -
            			 | 
| 1276 | 
            -
            			{
         | 
| 1277 | 
            -
             | 
| 1278 | 
            -
            				//Draw a caret above the x/y
         | 
| 1279 | 
            -
            				ctx.beginPath();
         | 
| 1280 | 
            -
            				ctx.moveTo(this.x,this.y - caretPadding);
         | 
| 1281 | 
            -
            				ctx.lineTo(this.x + this.caretHeight, this.y - (caretPadding + this.caretHeight));
         | 
| 1282 | 
            -
            				ctx.lineTo(this.x - this.caretHeight, this.y - (caretPadding + this.caretHeight));
         | 
| 1283 | 
            -
            				ctx.closePath();
         | 
| 1284 | 
            -
            				ctx.fill();
         | 
| 1285 | 
            -
            				break;
         | 
| 1286 | 
            -
            			case "below":
         | 
| 1287 | 
            -
            				tooltipY = this.y + caretPadding + this.caretHeight;
         | 
| 1288 | 
            -
            				//Draw a caret below the x/y
         | 
| 1289 | 
            -
            				ctx.beginPath();
         | 
| 1290 | 
            -
            				ctx.moveTo(this.x, this.y + caretPadding);
         | 
| 1291 | 
            -
            				ctx.lineTo(this.x + this.caretHeight, this.y + caretPadding + this.caretHeight);
         | 
| 1292 | 
            -
            				ctx.lineTo(this.x - this.caretHeight, this.y + caretPadding + this.caretHeight);
         | 
| 1293 | 
            -
            				ctx.closePath();
         | 
| 1294 | 
            -
            				ctx.fill();
         | 
| 1295 | 
            -
            				break;
         | 
| 1300 | 
            +
            			// Custom Tooltips
         | 
| 1301 | 
            +
            			if(this.custom){
         | 
| 1302 | 
            +
            				this.custom(this);
         | 
| 1296 1303 | 
             
            			}
         | 
| 1304 | 
            +
            			else{
         | 
| 1305 | 
            +
            				switch(this.yAlign)
         | 
| 1306 | 
            +
            				{
         | 
| 1307 | 
            +
            				case "above":
         | 
| 1308 | 
            +
            					//Draw a caret above the x/y
         | 
| 1309 | 
            +
            					ctx.beginPath();
         | 
| 1310 | 
            +
            					ctx.moveTo(this.x,this.y - caretPadding);
         | 
| 1311 | 
            +
            					ctx.lineTo(this.x + this.caretHeight, this.y - (caretPadding + this.caretHeight));
         | 
| 1312 | 
            +
            					ctx.lineTo(this.x - this.caretHeight, this.y - (caretPadding + this.caretHeight));
         | 
| 1313 | 
            +
            					ctx.closePath();
         | 
| 1314 | 
            +
            					ctx.fill();
         | 
| 1315 | 
            +
            					break;
         | 
| 1316 | 
            +
            				case "below":
         | 
| 1317 | 
            +
            					tooltipY = this.y + caretPadding + this.caretHeight;
         | 
| 1318 | 
            +
            					//Draw a caret below the x/y
         | 
| 1319 | 
            +
            					ctx.beginPath();
         | 
| 1320 | 
            +
            					ctx.moveTo(this.x, this.y + caretPadding);
         | 
| 1321 | 
            +
            					ctx.lineTo(this.x + this.caretHeight, this.y + caretPadding + this.caretHeight);
         | 
| 1322 | 
            +
            					ctx.lineTo(this.x - this.caretHeight, this.y + caretPadding + this.caretHeight);
         | 
| 1323 | 
            +
            					ctx.closePath();
         | 
| 1324 | 
            +
            					ctx.fill();
         | 
| 1325 | 
            +
            					break;
         | 
| 1326 | 
            +
            				}
         | 
| 1297 1327 |  | 
| 1298 | 
            -
             | 
| 1299 | 
            -
             | 
| 1300 | 
            -
             | 
| 1301 | 
            -
             | 
| 1302 | 
            -
             | 
| 1303 | 
            -
             | 
| 1304 | 
            -
             | 
| 1305 | 
            -
             | 
| 1306 | 
            -
             | 
| 1328 | 
            +
            				switch(this.xAlign)
         | 
| 1329 | 
            +
            				{
         | 
| 1330 | 
            +
            				case "left":
         | 
| 1331 | 
            +
            					tooltipX = this.x - tooltipWidth + (this.cornerRadius + this.caretHeight);
         | 
| 1332 | 
            +
            					break;
         | 
| 1333 | 
            +
            				case "right":
         | 
| 1334 | 
            +
            					tooltipX = this.x - (this.cornerRadius + this.caretHeight);
         | 
| 1335 | 
            +
            					break;
         | 
| 1336 | 
            +
            				}
         | 
| 1307 1337 |  | 
| 1308 | 
            -
             | 
| 1338 | 
            +
            				drawRoundedRectangle(ctx,tooltipX,tooltipY,tooltipWidth,tooltipRectHeight,this.cornerRadius);
         | 
| 1309 1339 |  | 
| 1310 | 
            -
             | 
| 1340 | 
            +
            				ctx.fill();
         | 
| 1311 1341 |  | 
| 1312 | 
            -
             | 
| 1313 | 
            -
             | 
| 1314 | 
            -
             | 
| 1315 | 
            -
             | 
| 1342 | 
            +
            				ctx.fillStyle = this.textColor;
         | 
| 1343 | 
            +
            				ctx.textAlign = "center";
         | 
| 1344 | 
            +
            				ctx.textBaseline = "middle";
         | 
| 1345 | 
            +
            				ctx.fillText(this.text, tooltipX + tooltipWidth/2, tooltipY + tooltipRectHeight/2);
         | 
| 1346 | 
            +
            			}
         | 
| 1316 1347 | 
             
            		}
         | 
| 1317 1348 | 
             
            	});
         | 
| 1318 1349 |  | 
| @@ -1366,36 +1397,42 @@ | |
| 1366 1397 |  | 
| 1367 1398 | 
             
            		},
         | 
| 1368 1399 | 
             
            		draw : function(){
         | 
| 1369 | 
            -
            			 | 
| 1370 | 
            -
            			 | 
| 1371 | 
            -
             | 
| 1372 | 
            -
            			 | 
| 1373 | 
            -
            			 | 
| 1400 | 
            +
            			// Custom Tooltips
         | 
| 1401 | 
            +
            			if(this.custom){
         | 
| 1402 | 
            +
            				this.custom(this);
         | 
| 1403 | 
            +
            			}
         | 
| 1404 | 
            +
            			else{
         | 
| 1405 | 
            +
            				drawRoundedRectangle(this.ctx,this.x,this.y - this.height/2,this.width,this.height,this.cornerRadius);
         | 
| 1406 | 
            +
            				var ctx = this.ctx;
         | 
| 1407 | 
            +
            				ctx.fillStyle = this.fillColor;
         | 
| 1408 | 
            +
            				ctx.fill();
         | 
| 1409 | 
            +
            				ctx.closePath();
         | 
| 1374 1410 |  | 
| 1375 | 
            -
             | 
| 1376 | 
            -
             | 
| 1377 | 
            -
             | 
| 1378 | 
            -
             | 
| 1411 | 
            +
            				ctx.textAlign = "left";
         | 
| 1412 | 
            +
            				ctx.textBaseline = "middle";
         | 
| 1413 | 
            +
            				ctx.fillStyle = this.titleTextColor;
         | 
| 1414 | 
            +
            				ctx.font = this.titleFont;
         | 
| 1379 1415 |  | 
| 1380 | 
            -
             | 
| 1416 | 
            +
            				ctx.fillText(this.title,this.x + this.xPadding, this.getLineHeight(0));
         | 
| 1381 1417 |  | 
| 1382 | 
            -
             | 
| 1383 | 
            -
             | 
| 1384 | 
            -
             | 
| 1385 | 
            -
             | 
| 1418 | 
            +
            				ctx.font = this.font;
         | 
| 1419 | 
            +
            				helpers.each(this.labels,function(label,index){
         | 
| 1420 | 
            +
            					ctx.fillStyle = this.textColor;
         | 
| 1421 | 
            +
            					ctx.fillText(label,this.x + this.xPadding + this.fontSize + 3, this.getLineHeight(index + 1));
         | 
| 1386 1422 |  | 
| 1387 | 
            -
             | 
| 1388 | 
            -
             | 
| 1389 | 
            -
             | 
| 1423 | 
            +
            					//A bit gnarly, but clearing this rectangle breaks when using explorercanvas (clears whole canvas)
         | 
| 1424 | 
            +
            					//ctx.clearRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);
         | 
| 1425 | 
            +
            					//Instead we'll make a white filled block to put the legendColour palette over.
         | 
| 1390 1426 |  | 
| 1391 | 
            -
             | 
| 1392 | 
            -
             | 
| 1427 | 
            +
            					ctx.fillStyle = this.legendColorBackground;
         | 
| 1428 | 
            +
            					ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);
         | 
| 1393 1429 |  | 
| 1394 | 
            -
             | 
| 1395 | 
            -
             | 
| 1430 | 
            +
            					ctx.fillStyle = this.legendColors[index].fill;
         | 
| 1431 | 
            +
            					ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);
         | 
| 1396 1432 |  | 
| 1397 1433 |  | 
| 1398 | 
            -
             | 
| 1434 | 
            +
            				},this);
         | 
| 1435 | 
            +
            			}
         | 
| 1399 1436 | 
             
            		}
         | 
| 1400 1437 | 
             
            	});
         | 
| 1401 1438 |  | 
| @@ -1560,14 +1597,24 @@ | |
| 1560 1597 | 
             
            				ctx.font = this.font;
         | 
| 1561 1598 | 
             
            				each(this.yLabels,function(labelString,index){
         | 
| 1562 1599 | 
             
            					var yLabelCenter = this.endPoint - (yLabelGap * index),
         | 
| 1563 | 
            -
            						linePositionY = Math.round(yLabelCenter) | 
| 1600 | 
            +
            						linePositionY = Math.round(yLabelCenter),
         | 
| 1601 | 
            +
            						drawHorizontalLine = this.showHorizontalLines;
         | 
| 1564 1602 |  | 
| 1565 1603 | 
             
            					ctx.textAlign = "right";
         | 
| 1566 1604 | 
             
            					ctx.textBaseline = "middle";
         | 
| 1567 1605 | 
             
            					if (this.showLabels){
         | 
| 1568 1606 | 
             
            						ctx.fillText(labelString,xStart - 10,yLabelCenter);
         | 
| 1569 1607 | 
             
            					}
         | 
| 1570 | 
            -
             | 
| 1608 | 
            +
             | 
| 1609 | 
            +
            					// This is X axis, so draw it
         | 
| 1610 | 
            +
            					if (index === 0 && !drawHorizontalLine){
         | 
| 1611 | 
            +
            						drawHorizontalLine = true;
         | 
| 1612 | 
            +
            					}
         | 
| 1613 | 
            +
             | 
| 1614 | 
            +
            					if (drawHorizontalLine){
         | 
| 1615 | 
            +
            						ctx.beginPath();
         | 
| 1616 | 
            +
            					}
         | 
| 1617 | 
            +
             | 
| 1571 1618 | 
             
            					if (index > 0){
         | 
| 1572 1619 | 
             
            						// This is a grid line in the centre, so drop that
         | 
| 1573 1620 | 
             
            						ctx.lineWidth = this.gridLineWidth;
         | 
| @@ -1580,10 +1627,12 @@ | |
| 1580 1627 |  | 
| 1581 1628 | 
             
            					linePositionY += helpers.aliasPixel(ctx.lineWidth);
         | 
| 1582 1629 |  | 
| 1583 | 
            -
            					 | 
| 1584 | 
            -
             | 
| 1585 | 
            -
             | 
| 1586 | 
            -
             | 
| 1630 | 
            +
            					if(drawHorizontalLine){
         | 
| 1631 | 
            +
            						ctx.moveTo(xStart, linePositionY);
         | 
| 1632 | 
            +
            						ctx.lineTo(this.width, linePositionY);
         | 
| 1633 | 
            +
            						ctx.stroke();
         | 
| 1634 | 
            +
            						ctx.closePath();
         | 
| 1635 | 
            +
            					}
         | 
| 1587 1636 |  | 
| 1588 1637 | 
             
            					ctx.lineWidth = this.lineWidth;
         | 
| 1589 1638 | 
             
            					ctx.strokeStyle = this.lineColor;
         | 
| @@ -1599,9 +1648,17 @@ | |
| 1599 1648 | 
             
            					var xPos = this.calculateX(index) + aliasPixel(this.lineWidth),
         | 
| 1600 1649 | 
             
            						// Check to see if line/bar here and decide where to place the line
         | 
| 1601 1650 | 
             
            						linePos = this.calculateX(index - (this.offsetGridLines ? 0.5 : 0)) + aliasPixel(this.lineWidth),
         | 
| 1602 | 
            -
            						isRotated = (this.xLabelRotation > 0) | 
| 1651 | 
            +
            						isRotated = (this.xLabelRotation > 0),
         | 
| 1652 | 
            +
            						drawVerticalLine = this.showVerticalLines;
         | 
| 1603 1653 |  | 
| 1604 | 
            -
            					 | 
| 1654 | 
            +
            					// This is Y axis, so draw it
         | 
| 1655 | 
            +
            					if (index === 0 && !drawVerticalLine){
         | 
| 1656 | 
            +
            						drawVerticalLine = true;
         | 
| 1657 | 
            +
            					}
         | 
| 1658 | 
            +
             | 
| 1659 | 
            +
            					if (drawVerticalLine){
         | 
| 1660 | 
            +
            						ctx.beginPath();
         | 
| 1661 | 
            +
            					}
         | 
| 1605 1662 |  | 
| 1606 1663 | 
             
            					if (index > 0){
         | 
| 1607 1664 | 
             
            						// This is a grid line in the centre, so drop that
         | 
| @@ -1612,10 +1669,13 @@ | |
| 1612 1669 | 
             
            						ctx.lineWidth = this.lineWidth;
         | 
| 1613 1670 | 
             
            						ctx.strokeStyle = this.lineColor;
         | 
| 1614 1671 | 
             
            					}
         | 
| 1615 | 
            -
             | 
| 1616 | 
            -
            					 | 
| 1617 | 
            -
             | 
| 1618 | 
            -
             | 
| 1672 | 
            +
             | 
| 1673 | 
            +
            					if (drawVerticalLine){
         | 
| 1674 | 
            +
            						ctx.moveTo(linePos,this.endPoint);
         | 
| 1675 | 
            +
            						ctx.lineTo(linePos,this.startPoint - 3);
         | 
| 1676 | 
            +
            						ctx.stroke();
         | 
| 1677 | 
            +
            						ctx.closePath();
         | 
| 1678 | 
            +
            					}
         | 
| 1619 1679 |  | 
| 1620 1680 |  | 
| 1621 1681 | 
             
            					ctx.lineWidth = this.lineWidth;
         | 
| @@ -1963,6 +2023,12 @@ | |
| 1963 2023 | 
             
            		//Number - Width of the grid lines
         | 
| 1964 2024 | 
             
            		scaleGridLineWidth : 1,
         | 
| 1965 2025 |  | 
| 2026 | 
            +
            		//Boolean - Whether to show horizontal lines (except X axis)
         | 
| 2027 | 
            +
            		scaleShowHorizontalLines: true,
         | 
| 2028 | 
            +
             | 
| 2029 | 
            +
            		//Boolean - Whether to show vertical lines (except Y axis)
         | 
| 2030 | 
            +
            		scaleShowVerticalLines: true,
         | 
| 2031 | 
            +
             | 
| 1966 2032 | 
             
            		//Boolean - If there is a stroke on each bar
         | 
| 1967 2033 | 
             
            		barShowStroke : true,
         | 
| 1968 2034 |  | 
| @@ -2150,6 +2216,8 @@ | |
| 2150 2216 | 
             
            				font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
         | 
| 2151 2217 | 
             
            				lineWidth : this.options.scaleLineWidth,
         | 
| 2152 2218 | 
             
            				lineColor : this.options.scaleLineColor,
         | 
| 2219 | 
            +
            				showHorizontalLines : this.options.scaleShowHorizontalLines,
         | 
| 2220 | 
            +
            				showVerticalLines : this.options.scaleShowVerticalLines,
         | 
| 2153 2221 | 
             
            				gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
         | 
| 2154 2222 | 
             
            				gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
         | 
| 2155 2223 | 
             
            				padding : (this.options.showScale) ? 0 : (this.options.barShowStroke) ? this.options.barStrokeWidth : 0,
         | 
| @@ -2236,6 +2304,7 @@ | |
| 2236 2304 |  | 
| 2237 2305 |  | 
| 2238 2306 | 
             
            }).call(this);
         | 
| 2307 | 
            +
             | 
| 2239 2308 | 
             
            (function(){
         | 
| 2240 2309 | 
             
            	"use strict";
         | 
| 2241 2310 |  | 
| @@ -2438,6 +2507,12 @@ | |
| 2438 2507 | 
             
            		//Number - Width of the grid lines
         | 
| 2439 2508 | 
             
            		scaleGridLineWidth : 1,
         | 
| 2440 2509 |  | 
| 2510 | 
            +
            		//Boolean - Whether to show horizontal lines (except X axis)
         | 
| 2511 | 
            +
            		scaleShowHorizontalLines: true,
         | 
| 2512 | 
            +
             | 
| 2513 | 
            +
            		//Boolean - Whether to show vertical lines (except Y axis)
         | 
| 2514 | 
            +
            		scaleShowVerticalLines: true,
         | 
| 2515 | 
            +
             | 
| 2441 2516 | 
             
            		//Boolean - Whether the line is curved between points
         | 
| 2442 2517 | 
             
            		bezierCurve : true,
         | 
| 2443 2518 |  | 
| @@ -2612,6 +2687,8 @@ | |
| 2612 2687 | 
             
            				font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
         | 
| 2613 2688 | 
             
            				lineWidth : this.options.scaleLineWidth,
         | 
| 2614 2689 | 
             
            				lineColor : this.options.scaleLineColor,
         | 
| 2690 | 
            +
            				showHorizontalLines : this.options.scaleShowHorizontalLines,
         | 
| 2691 | 
            +
            				showVerticalLines : this.options.scaleShowVerticalLines,
         | 
| 2615 2692 | 
             
            				gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
         | 
| 2616 2693 | 
             
            				gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
         | 
| 2617 2694 | 
             
            				padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth,
         | 
| @@ -2786,6 +2863,7 @@ | |
| 2786 2863 |  | 
| 2787 2864 |  | 
| 2788 2865 | 
             
            }).call(this);
         | 
| 2866 | 
            +
             | 
| 2789 2867 | 
             
            (function(){
         | 
| 2790 2868 | 
             
            	"use strict";
         | 
| 2791 2869 |  | 
| @@ -3376,4 +3454,4 @@ | |
| 3376 3454 |  | 
| 3377 3455 |  | 
| 3378 3456 |  | 
| 3379 | 
            -
            }).call(this);
         | 
| 3457 | 
            +
            }).call(this);
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: chartjs-ror
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andy Stewart
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-01-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |