spout 0.10.2 → 0.11.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +3 -30
  4. data/lib/spout/commands/coverage.rb +2 -1
  5. data/lib/spout/commands/deploy.rb +82 -77
  6. data/lib/spout/commands/exporter.rb +2 -3
  7. data/lib/spout/commands/graphs.rb +68 -67
  8. data/lib/spout/commands/help.rb +155 -0
  9. data/lib/spout/helpers/array_statistics.rb +36 -30
  10. data/lib/spout/helpers/chart_types.rb +2 -2
  11. data/lib/spout/helpers/config_reader.rb +5 -5
  12. data/lib/spout/helpers/json_request.rb +1 -2
  13. data/lib/spout/helpers/json_request_generic.rb +87 -0
  14. data/lib/spout/helpers/quietly.rb +2 -4
  15. data/lib/spout/helpers/semantic.rb +7 -11
  16. data/lib/spout/helpers/send_file.rb +23 -25
  17. data/lib/spout/helpers/subject_loader.rb +41 -32
  18. data/lib/spout/helpers/table_formatting.rb +7 -6
  19. data/lib/spout/models/bucket.rb +5 -4
  20. data/lib/spout/models/coverage_result.rb +1 -1
  21. data/lib/spout/models/dictionary.rb +3 -1
  22. data/lib/spout/models/domain.rb +7 -6
  23. data/lib/spout/models/empty.rb +17 -0
  24. data/lib/spout/models/form.rb +8 -5
  25. data/lib/spout/models/graphables/default.rb +41 -18
  26. data/lib/spout/models/graphables/histogram.rb +6 -7
  27. data/lib/spout/models/graphables.rb +3 -5
  28. data/lib/spout/models/option.rb +6 -2
  29. data/lib/spout/models/outlier_result.rb +3 -3
  30. data/lib/spout/models/record.rb +21 -3
  31. data/lib/spout/models/subject.rb +4 -7
  32. data/lib/spout/models/tables/choices_vs_choices.rb +29 -17
  33. data/lib/spout/models/tables/choices_vs_numeric.rb +19 -12
  34. data/lib/spout/models/tables/default.rb +19 -32
  35. data/lib/spout/models/tables/numeric_vs_choices.rb +9 -13
  36. data/lib/spout/models/tables/numeric_vs_numeric.rb +9 -11
  37. data/lib/spout/models/tables.rb +4 -6
  38. data/lib/spout/models/variable.rb +51 -13
  39. data/lib/spout/tasks/engine.rake +1 -1
  40. data/lib/spout/templates/ruby-version +1 -1
  41. data/lib/spout/templates/travis.yml +1 -1
  42. data/lib/spout/tests/domain_format.rb +2 -2
  43. data/lib/spout/tests/domain_name_format.rb +15 -0
  44. data/lib/spout/tests/form_name_format.rb +14 -0
  45. data/lib/spout/tests/variable_name_format.rb +14 -0
  46. data/lib/spout/tests.rb +18 -13
  47. data/lib/spout/version.rb +3 -3
  48. data/lib/spout/views/index.html.erb +2 -2
  49. data/lib/spout/views/outliers.html.erb +1 -1
  50. data/lib/spout.rb +13 -58
  51. data/spout.gemspec +14 -15
  52. metadata +25 -25
  53. data/lib/spout/commands/images.rb +0 -199
  54. data/lib/spout/support/javascripts/data.js +0 -17
  55. data/lib/spout/support/javascripts/highcharts-convert.js +0 -583
  56. data/lib/spout/support/javascripts/highcharts-more.js +0 -50
  57. data/lib/spout/support/javascripts/highstock.js +0 -353
  58. data/lib/spout/support/javascripts/jquery.1.9.1.min.js +0 -5
@@ -1,583 +0,0 @@
1
- /**
2
- * @license Highcharts JS v3.0.1 (2012-11-02)
3
- *
4
- * (c) 20013-2014
5
- *
6
- * Author: Gert Vaartjes
7
- *
8
- * License: www.highcharts.com/license
9
- *
10
- * version: 2.0.1
11
- */
12
-
13
- /*jslint white: true */
14
- /*global window, require, phantom, console, $, document, Image, Highcharts, clearTimeout, clearInterval, options, cb, globalOptions, dataOptions, customCode */
15
-
16
-
17
- (function () {
18
- "use strict";
19
-
20
- var config = {
21
- /* define locations of mandatory javascript files */
22
- HIGHCHARTS: 'highstock.js',
23
- HIGHCHARTS_MORE: 'highcharts-more.js',
24
- HIGHCHARTS_DATA: 'data.js',
25
- JQUERY: 'jquery.1.9.1.min.js',
26
- TIMEOUT: 2000 /* 2 seconds timout for loading images */
27
- },
28
- mapCLArguments,
29
- render,
30
- startServer = false,
31
- args,
32
- pick,
33
- SVG_DOCTYPE = '<?xml version=\"1.0" standalone=\"no\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">',
34
- dpiCorrection = 1.4,
35
- system = require('system'),
36
- fs = require('fs'),
37
- serverMode = false;
38
-
39
- pick = function () {
40
- var args = arguments, i, arg, length = args.length;
41
- for (i = 0; i < length; i += 1) {
42
- arg = args[i];
43
- if (arg !== undefined && arg !== null && arg !== 'null' && arg != '0') {
44
- return arg;
45
- }
46
- }
47
- };
48
-
49
- mapCLArguments = function () {
50
- var map = {},
51
- i,
52
- key;
53
-
54
- if (system.args.length < 1) {
55
- console.log('Commandline Usage: highcharts-convert.js -infile URL -outfile filename -scale 2.5 -width 300 -constr Chart -callback callback.js');
56
- console.log(', or run PhantomJS as server: highcharts-convert.js -host 127.0.0.1 -port 1234');
57
- }
58
-
59
- for (i = 0; i < system.args.length; i += 1) {
60
- if (system.args[i].charAt(0) === '-') {
61
- key = system.args[i].substr(1, i.length);
62
- if (key === 'infile' || key === 'callback' || key === 'dataoptions' || key === 'globaloptions' || key === 'customcode') {
63
- // get string from file
64
- try {
65
- map[key] = fs.read(system.args[i + 1]);
66
- } catch (e) {
67
- console.log('Error: cannot find file, ' + system.args[i + 1]);
68
- phantom.exit();
69
- }
70
- } else {
71
- map[key] = system.args[i + 1];
72
- }
73
- }
74
- }
75
- return map;
76
- };
77
-
78
- render = function (params, exitCallback) {
79
-
80
- var page = require('webpage').create(),
81
- messages = {},
82
- scaleAndClipPage,
83
- loadChart,
84
- createChart,
85
- input,
86
- constr,
87
- callback,
88
- width,
89
- output,
90
- outType,
91
- timer,
92
- renderSVG,
93
- convert,
94
- exit,
95
- interval;
96
-
97
- messages.imagesLoaded = 'Highcharts.images.loaded';
98
- messages.optionsParsed = 'Highcharts.options.parsed';
99
- messages.callbackParsed = 'Highcharts.cb.parsed';
100
- window.imagesLoaded = false;
101
- window.optionsParsed = false;
102
- window.callbackParsed = false;
103
-
104
- page.onConsoleMessage = function (msg) {
105
- //console.log(msg);
106
-
107
- /*
108
- * Ugly hack, but only way to get messages out of the 'page.evaluate()'
109
- * sandbox. If any, please contribute with improvements on this!
110
- */
111
-
112
- if (msg === messages.imagesLoaded) {
113
- window.imagesLoaded = true;
114
- }
115
- /* more ugly hacks, to check options or callback are properly parsed */
116
- if (msg === messages.optionsParsed) {
117
- window.optionsParsed = true;
118
- }
119
-
120
- if (msg === messages.callbackParsed) {
121
- window.callbackParsed = true;
122
- }
123
- };
124
-
125
- page.onAlert = function (msg) {
126
- console.log(msg);
127
- };
128
-
129
- /* scale and clip the page */
130
- scaleAndClipPage = function (svg) {
131
- /* param: svg: The scg configuration object
132
- */
133
-
134
- var zoom = 1,
135
- pageWidth = pick(params.width, svg.width),
136
- clipwidth,
137
- clipheight;
138
-
139
- if (parseInt(pageWidth, 10) == pageWidth) {
140
- zoom = pageWidth / svg.width;
141
- }
142
-
143
- /* set this line when scale factor has a higher precedence
144
- scale has precedence : page.zoomFactor = params.scale ? zoom * params.scale : zoom;*/
145
-
146
- /* params.width has a higher precedence over scaling, to not break backover compatibility */
147
- page.zoomFactor = params.scale && params.width == undefined ? zoom * params.scale : zoom;
148
-
149
- clipwidth = svg.width * page.zoomFactor;
150
- clipheight = svg.height * page.zoomFactor;
151
-
152
- /* define the clip-rectangle */
153
- /* ignored for PDF, see https://github.com/ariya/phantomjs/issues/10465 */
154
- page.clipRect = {
155
- top: 0,
156
- left: 0,
157
- width: clipwidth,
158
- height: clipheight
159
- };
160
-
161
- /* for pdf we need a bit more paperspace in some cases for example (w:600,h:400), I don't know why.*/
162
- if (outType === 'pdf') {
163
- // changed to a multiplication with 1.333 to correct systems dpi setting
164
- clipwidth = clipwidth * dpiCorrection;
165
- clipheight = clipheight * dpiCorrection;
166
- // redefine the viewport
167
- page.viewportSize = { width: clipwidth, height: clipheight};
168
- // make the paper a bit larger than the viewport
169
- page.paperSize = { width: clipwidth + 2 , height: clipheight + 2 };
170
- }
171
- };
172
-
173
- exit = function (result) {
174
- if (serverMode) {
175
- //Calling page.close(), may stop the increasing heap allocation
176
- page.close();
177
- }
178
- exitCallback(result);
179
- };
180
-
181
- convert = function (svg) {
182
- var base64;
183
- scaleAndClipPage(svg);
184
- if (outType === 'pdf' || output !== undefined) {
185
- if (output === undefined) {
186
- // in case of pdf files
187
- output = config.tmpDir + '/chart.' + outType;
188
- }
189
- page.render(output);
190
- exit(output);
191
- } else {
192
- base64 = page.renderBase64(outType);
193
- exit(base64);
194
- }
195
- };
196
-
197
- renderSVG = function (svg) {
198
- var svgFile;
199
- // From this point we have loaded/or created a SVG
200
- try {
201
- if (outType.toLowerCase() === 'svg') {
202
- // output svg
203
- svg = svg.html.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ href=/g, ' xlink:href=').replace(/<\/svg>.*?$/, '</svg>');
204
- // add xml doc type
205
- svg = SVG_DOCTYPE + svg;
206
-
207
- if (output !== undefined) {
208
- // write the file
209
- svgFile = fs.open(output, "w");
210
- svgFile.write(svg);
211
- svgFile.close();
212
- exit(output);
213
- } else {
214
- // return the svg as a string
215
- exit(svg);
216
- }
217
-
218
- } else {
219
- // output binary images or pdf
220
- if (!window.imagesLoaded) {
221
- // render with interval, waiting for all images loaded
222
- interval = window.setInterval(function () {
223
- console.log('waiting');
224
- if (window.imagesLoaded) {
225
- clearTimeout(timer);
226
- clearInterval(interval);
227
- convert(svg);
228
- }
229
- }, 50);
230
-
231
- // we have a 3 second timeframe..
232
- timer = window.setTimeout(function () {
233
- clearInterval(interval);
234
- exitCallback('ERROR: While rendering, there\'s is a timeout reached');
235
- }, config.TIMEOUT);
236
- } else {
237
- // images are loaded, render rightaway
238
- convert(svg);
239
- }
240
- }
241
- } catch (e) {
242
- console.log('ERROR: While rendering, ' + e);
243
- }
244
- };
245
-
246
- loadChart = function (input, outputType, messages) {
247
- var nodeIter, nodes, elem, opacity, counter, svgElem;
248
-
249
- document.body.style.margin = '0px';
250
- document.body.innerHTML = input;
251
-
252
- function loadingImage() {
253
- console.log('Loading image ' + counter);
254
- counter -= 1;
255
- if (counter < 1) {
256
- console.log(messages.imagesLoaded);
257
- }
258
- }
259
-
260
- function loadImages() {
261
- var images = document.getElementsByTagName('image'), i, img;
262
-
263
- if (images.length > 0) {
264
-
265
- counter = images.length;
266
-
267
- for (i = 0; i < images.length; i += 1) {
268
- img = new Image();
269
- img.onload = loadingImage;
270
- /* force loading of images by setting the src attr.*/
271
- img.src = images[i].href.baseVal;
272
- }
273
- } else {
274
- // no images set property to:imagesLoaded = true
275
- console.log(messages.imagesLoaded);
276
- }
277
- }
278
-
279
- if (outputType === 'jpeg') {
280
- document.body.style.backgroundColor = 'white';
281
- }
282
-
283
-
284
- nodes = document.querySelectorAll('*[stroke-opacity]');
285
-
286
- for (nodeIter = 0; nodeIter < nodes.length; nodeIter += 1) {
287
- elem = nodes[nodeIter];
288
- opacity = elem.getAttribute('stroke-opacity');
289
- elem.removeAttribute('stroke-opacity');
290
- elem.setAttribute('opacity', opacity);
291
- }
292
-
293
- // ensure all image are loaded
294
- loadImages();
295
-
296
- svgElem = document.getElementsByTagName('svg')[0];
297
-
298
- return {
299
- html: document.body.innerHTML,
300
- width: svgElem.getAttribute("width"),
301
- height: svgElem.getAttribute("height")
302
- };
303
- };
304
-
305
- createChart = function (width, constr, input, globalOptionsArg, dataOptionsArg, customCodeArg, outputType, callback, messages) {
306
-
307
- var $container, chart, nodes, nodeIter, elem, opacity, counter;
308
-
309
- // dynamic script insertion
310
- function loadScript(varStr, codeStr) {
311
- var $script = $('<script>').attr('type', 'text/javascript');
312
- $script.html('var ' + varStr + ' = ' + codeStr);
313
- document.getElementsByTagName("head")[0].appendChild($script[0]);
314
- if (window[varStr] !== undefined) {
315
- console.log('Highcharts.' + varStr + '.parsed');
316
- }
317
- }
318
-
319
- // are all images loaded in time?
320
- function loadingImage() {
321
- console.log('loading image ' + counter);
322
- counter -= 1;
323
- if (counter < 1) {
324
- console.log(messages.imagesLoaded);
325
- }
326
- }
327
-
328
- function loadImages() {
329
- // are images loaded?
330
- var $images = $('svg image'), i, img;
331
-
332
- if ($images.length > 0) {
333
-
334
- counter = $images.length;
335
-
336
- for (i = 0; i < $images.length; i += 1) {
337
- img = new Image();
338
- img.onload = loadingImage;
339
- /* force loading of images by setting the src attr.*/
340
- img.src = $images[i].getAttribute('href');
341
- }
342
- } else {
343
- // no images set property to all images
344
- // loaded
345
- console.log(messages.imagesLoaded);
346
- }
347
- }
348
-
349
- function parseData(completeHandler, chartOptions, dataConfig) {
350
- try {
351
- dataConfig.complete = completeHandler;
352
- Highcharts.data(dataConfig, chartOptions);
353
- } catch (error) {
354
- completeHandler(undefined);
355
- }
356
- }
357
-
358
- if (input !== 'undefined') {
359
- loadScript('options', input);
360
- }
361
-
362
- if (callback !== 'undefined') {
363
- loadScript('cb', callback);
364
- }
365
-
366
- if (globalOptionsArg !== 'undefined') {
367
- loadScript('globalOptions', globalOptionsArg);
368
- }
369
-
370
- if (dataOptionsArg !== 'undefined') {
371
- loadScript('dataOptions', dataOptionsArg);
372
- }
373
-
374
- if (customCodeArg !== 'undefined') {
375
- loadScript('customCode', customCodeArg);
376
- }
377
-
378
- $(document.body).css('margin', '0px');
379
-
380
- if (outputType === 'jpeg') {
381
- $(document.body).css('backgroundColor', 'white');
382
- }
383
-
384
- $container = $('<div>').appendTo(document.body);
385
- $container.attr('id', 'container');
386
-
387
- // disable animations
388
- Highcharts.SVGRenderer.prototype.Element.prototype.animate = Highcharts.SVGRenderer.prototype.Element.prototype.attr;
389
-
390
- if (!options.chart) {
391
- options.chart = {};
392
- }
393
-
394
- options.chart.renderTo = $container[0];
395
-
396
- // check if witdh is set. Order of precedence:
397
- // args.width, options.chart.width and 600px
398
-
399
- // OLD. options.chart.width = width || options.chart.width || 600;
400
- // Notice we don't use commandline parameter width here. Commandline parameter width is used for scaling.
401
-
402
- options.chart.width = (options.exporting && options.exporting.sourceWidth) || options.chart.width || 600;
403
- options.chart.height = (options.exporting && options.exporting.sourceHeight) || options.chart.height || 400;
404
-
405
- // Load globalOptions
406
- if (globalOptions) {
407
- Highcharts.setOptions(globalOptions);
408
- }
409
-
410
- // Load data
411
- if (dataOptions) {
412
- parseData(function completeHandler(opts) {
413
- // Merge series configs
414
- if (options.series) {
415
- Highcharts.each(options.series, function (series, i) {
416
- options.series[i] = Highcharts.merge(series, opts.series[i]);
417
- });
418
- }
419
-
420
- var mergedOptions = Highcharts.merge(opts, options);
421
-
422
- // Run customCode
423
- if (customCode) {
424
- customCode(mergedOptions);
425
- }
426
-
427
- chart = new Highcharts[constr](mergedOptions, cb);
428
-
429
- // ensure images are all loaded
430
- loadImages();
431
- }, options, dataOptions);
432
- } else {
433
- chart = new Highcharts[constr](options, cb);
434
-
435
- // ensure images are all loaded
436
- loadImages();
437
- }
438
-
439
- /* remove stroke-opacity paths, used by mouse-trackers, they turn up as
440
- * as fully opaque in the PDF
441
- */
442
- nodes = document.querySelectorAll('*[stroke-opacity]');
443
-
444
- for (nodeIter = 0; nodeIter < nodes.length; nodeIter += 1) {
445
- elem = nodes[nodeIter];
446
- opacity = elem.getAttribute('stroke-opacity');
447
- elem.removeAttribute('stroke-opacity');
448
- elem.setAttribute('opacity', opacity);
449
- }
450
-
451
- return {
452
- //html: $container[0].firstChild.innerHTML,
453
- html: $('div.highcharts-container')[0].innerHTML,
454
- width: chart.chartWidth,
455
- height: chart.chartHeight
456
- };
457
- };
458
-
459
- if (params.length < 1) {
460
- exit("Error: Insuficient parameters");
461
- } else {
462
- input = params.infile;
463
- output = params.outfile;
464
-
465
- if (output !== undefined) {
466
- outType = pick(output.split('.').pop(),outType,'png');
467
- } else {
468
- outType = pick(params.outtype,'png');
469
- }
470
-
471
- constr = pick(params.constr, 'Chart');
472
- callback = params.callback;
473
- width = params.width;
474
-
475
- if (input === undefined || input.length === 0) {
476
- exit('Error: Insuficient or wrong parameters for rendering');
477
- }
478
-
479
- page.open('about:blank', function (status) {
480
- var svg,
481
- globalOptions = params.globaloptions,
482
- dataOptions = params.dataoptions,
483
- customCode = 'function customCode(options) {\n' + params.customcode + '}\n';
484
-
485
- /* Decide if we have to generate a svg first before rendering */
486
- if (input.substring(0, 4).toLowerCase() === "<svg") {
487
- //render page directly from svg file
488
- svg = page.evaluate(loadChart, input, outType, messages);
489
- page.viewportSize = { width: svg.width, height: svg.height };
490
- renderSVG(svg);
491
- } else {
492
- // We have a js file, let highcharts create the chart first and grab the svg
493
-
494
- // load necessary libraries
495
- page.injectJs(config.JQUERY);
496
- page.injectJs(config.HIGHCHARTS);
497
- page.injectJs(config.HIGHCHARTS_MORE);
498
- page.injectJs(config.HIGHCHARTS_DATA);
499
-
500
- // load chart in page and return svg height and width
501
- svg = page.evaluate(createChart, width, constr, input, globalOptions, dataOptions, customCode, outType, callback, messages);
502
-
503
- if (!window.optionsParsed) {
504
- exit('ERROR: the options variable was not available, contains the infile an syntax error? see' + input);
505
- }
506
-
507
- if (callback !== undefined && !window.callbackParsed) {
508
- exit('ERROR: the callback variable was not available, contains the callbackfile an syntax error? see' + callback);
509
- }
510
- renderSVG(svg);
511
- }
512
- });
513
- }
514
- };
515
-
516
- startServer = function (host, port) {
517
- var server = require('webserver').create();
518
-
519
- server.listen(host + ':' + port,
520
- function (request, response) {
521
- var jsonStr = request.post,
522
- params,
523
- msg;
524
- try {
525
- params = JSON.parse(jsonStr);
526
- if (params.status) {
527
- // for server health validation
528
- response.statusCode = 200;
529
- response.write('OK');
530
- response.close();
531
- } else {
532
- render(params, function (result) {
533
- // TODO: set response headers?
534
- response.statusCode = 200;
535
- response.write(result);
536
- response.close();
537
- });
538
- }
539
- } catch (e) {
540
- msg = "Failed rendering: \n" + e;
541
- response.statusCode = 500;
542
- response.setHeader('Content-Type', 'text/plain');
543
- response.setHeader('Content-Length', msg.length);
544
- response.write(msg);
545
- response.close();
546
- }
547
- }); // end server.listen
548
-
549
- // switch to serverMode
550
- serverMode = true;
551
-
552
- console.log("OK, PhantomJS is ready.");
553
- };
554
-
555
- args = mapCLArguments();
556
-
557
- // set tmpDir, for output temporary files.
558
- if (args.tmpDir === undefined) {
559
- config.tmpDir = fs.workingDirectory + '/tmp';
560
- } else {
561
- config.tmpDir = args.tmpDir;
562
- }
563
-
564
- // exists tmpDir and is it writable?
565
- if (!fs.exists(config.tmpDir)) {
566
- try{
567
- fs.makeDirectory(config.tmpDir);
568
- } catch (e) {
569
- console.log('ERROR: Cannot make temp directory');
570
- }
571
- }
572
-
573
-
574
- if (args.port !== undefined) {
575
- startServer(args.host, args.port);
576
- } else {
577
- // presume commandline usage
578
- render(args, function (msg) {
579
- console.log(msg);
580
- phantom.exit();
581
- });
582
- }
583
- }());
@@ -1,50 +0,0 @@
1
- /*
2
- Highcharts JS v3.0.7 (2013-10-24)
3
-
4
- (c) 2009-2013 Torstein Hønsi
5
-
6
- License: www.highcharts.com/license
7
- */
8
- (function(l,C){function J(a,b,c){this.init.call(this,a,b,c)}function K(a,b,c){a.call(this,b,c);if(this.chart.polar)this.closeSegment=function(a){var c=this.xAxis.center;a.push("L",c[0],c[1])},this.closedStacks=!0}function L(a,b){var c=this.chart,d=this.options.animation,g=this.group,f=this.markerGroup,e=this.xAxis.center,i=c.plotLeft,o=c.plotTop;if(c.polar){if(c.renderer.isSVG)if(d===!0&&(d={}),b){if(c={translateX:e[0]+i,translateY:e[1]+o,scaleX:0.001,scaleY:0.001},g.attr(c),f)f.attrSetters=g.attrSetters,
9
- f.attr(c)}else c={translateX:i,translateY:o,scaleX:1,scaleY:1},g.animate(c,d),f&&f.animate(c,d),this.animate=null}else a.call(this,b)}var P=l.arrayMin,Q=l.arrayMax,r=l.each,F=l.extend,p=l.merge,R=l.map,q=l.pick,v=l.pInt,m=l.getOptions().plotOptions,h=l.seriesTypes,x=l.extendClass,M=l.splat,n=l.wrap,N=l.Axis,u=l.Tick,z=l.Series,t=h.column.prototype,s=Math,D=s.round,A=s.floor,S=s.max,w=function(){};F(J.prototype,{init:function(a,b,c){var d=this,g=d.defaultOptions;d.chart=b;if(b.angular)g.background=
10
- {};d.options=a=p(g,a);(a=a.background)&&r([].concat(M(a)).reverse(),function(a){var b=a.backgroundColor,a=p(d.defaultBackgroundOptions,a);if(b)a.backgroundColor=b;a.color=a.backgroundColor;c.options.plotBands.unshift(a)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{shape:"circle",borderWidth:1,borderColor:"silver",backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#FFF"],[1,"#DDD"]]},from:Number.MIN_VALUE,innerRadius:0,to:Number.MAX_VALUE,
11
- outerRadius:"105%"}});var G=N.prototype,u=u.prototype,T={getOffset:w,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:w,setCategories:w,setTitle:w},O={isRadial:!0,defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside",minorTickWidth:1,plotBands:[],tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2},defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,
12
- distance:15,x:0,y:null},maxPadding:0,minPadding:0,plotBands:[],showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},plotBands:[],showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(a){this.options=p(this.defaultOptions,this.defaultRadialOptions,a)},getOffset:function(){G.getOffset.call(this);this.chart.axisOffset[this.side]=0},getLinePath:function(a,b){var c=this.center,b=q(b,c[2]/2-this.offset);return this.chart.renderer.symbols.arc(this.left+
13
- c[0],this.top+c[1],b,b,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0})},setAxisTranslation:function(){G.setAxisTranslation.call(this);if(this.center&&(this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/(this.max-this.min||1):this.center[2]/2/(this.max-this.min||1),this.isXAxis))this.minPixelPadding=this.transA*this.minPointOffset+(this.reversed?(this.endAngleRad-this.startAngleRad)/4:0)},beforeSetTickPositions:function(){this.autoConnect&&(this.max+=this.categories&&
14
- 1||this.pointRange||this.closestPointRange||0)},setAxisSize:function(){G.setAxisSize.call(this);if(this.isRadial)this.center=this.pane.center=h.pie.prototype.getCenter.call(this.pane),this.len=this.width=this.height=this.isCircular?this.center[2]*(this.endAngleRad-this.startAngleRad)/2:this.center[2]/2},getPosition:function(a,b){if(!this.isCircular)b=this.translate(a),a=this.min;return this.postTranslate(this.translate(a),q(b,this.center[2]/2)-this.offset)},postTranslate:function(a,b){var c=this.chart,
15
- d=this.center,a=this.startAngleRad+a;return{x:c.plotLeft+d[0]+Math.cos(a)*b,y:c.plotTop+d[1]+Math.sin(a)*b}},getPlotBandPath:function(a,b,c){var d=this.center,g=this.startAngleRad,f=d[2]/2,e=[q(c.outerRadius,"100%"),c.innerRadius,q(c.thickness,10)],i=/%$/,o,k=this.isCircular;this.options.gridLineInterpolation==="polygon"?d=this.getPlotLinePath(a).concat(this.getPlotLinePath(b,!0)):(k||(e[0]=this.translate(a),e[1]=this.translate(b)),e=R(e,function(a){i.test(a)&&(a=v(a,10)*f/100);return a}),c.shape===
16
- "circle"||!k?(a=-Math.PI/2,b=Math.PI*1.5,o=!0):(a=g+this.translate(a),b=g+this.translate(b)),d=this.chart.renderer.symbols.arc(this.left+d[0],this.top+d[1],e[0],e[0],{start:a,end:b,innerR:q(e[1],e[0]-e[2]),open:o}));return d},getPlotLinePath:function(a,b){var c=this.center,d=this.chart,g=this.getPosition(a),f,e,i;this.isCircular?i=["M",c[0]+d.plotLeft,c[1]+d.plotTop,"L",g.x,g.y]:this.options.gridLineInterpolation==="circle"?(a=this.translate(a))&&(i=this.getLinePath(0,a)):(f=d.xAxis[0],i=[],a=this.translate(a),
17
- c=f.tickPositions,f.autoConnect&&(c=c.concat([c[0]])),b&&(c=[].concat(c).reverse()),r(c,function(c,b){e=f.getPosition(c,a);i.push(b?"L":"M",e.x,e.y)}));return i},getTitlePosition:function(){var a=this.center,b=this.chart,c=this.options.title;return{x:b.plotLeft+a[0]+(c.x||0),y:b.plotTop+a[1]-{high:0.5,middle:0.25,low:0}[c.align]*a[2]+(c.y||0)}}};n(G,"init",function(a,b,c){var j;var d=b.angular,g=b.polar,f=c.isX,e=d&&f,i,o;o=b.options;var k=c.pane||0;if(d){if(F(this,e?T:O),i=!f)this.defaultRadialOptions=
18
- this.defaultRadialGaugeOptions}else if(g)F(this,O),this.defaultRadialOptions=(i=f)?this.defaultRadialXOptions:p(this.defaultYAxisOptions,this.defaultRadialYOptions);a.call(this,b,c);if(!e&&(d||g)){a=this.options;if(!b.panes)b.panes=[];this.pane=(j=b.panes[k]=b.panes[k]||new J(M(o.pane)[k],b,this),k=j);k=k.options;b.inverted=!1;o.chart.zoomType=null;this.startAngleRad=b=(k.startAngle-90)*Math.PI/180;this.endAngleRad=o=(q(k.endAngle,k.startAngle+360)-90)*Math.PI/180;this.offset=a.offset||0;if((this.isCircular=
19
- i)&&c.max===C&&o-b===2*Math.PI)this.autoConnect=!0}});n(u,"getPosition",function(a,b,c,d,g){var f=this.axis;return f.getPosition?f.getPosition(c):a.call(this,b,c,d,g)});n(u,"getLabelPosition",function(a,b,c,d,g,f,e,i,o){var k=this.axis,j=f.y,h=f.align,l=(k.translate(this.pos)+k.startAngleRad+Math.PI/2)/Math.PI*180%360;k.isRadial?(a=k.getPosition(this.pos,k.center[2]/2+q(f.distance,-25)),f.rotation==="auto"?d.attr({rotation:l}):j===null&&(j=v(d.styles.lineHeight)*0.9-d.getBBox().height/2),h===null&&
20
- (h=k.isCircular?l>20&&l<160?"left":l>200&&l<340?"right":"center":"center",d.attr({align:h})),a.x+=f.x,a.y+=j):a=a.call(this,b,c,d,g,f,e,i,o);return a});n(u,"getMarkPath",function(a,b,c,d,g,f,e){var i=this.axis;i.isRadial?(a=i.getPosition(this.pos,i.center[2]/2+d),b=["M",b,c,"L",a.x,a.y]):b=a.call(this,b,c,d,g,f,e);return b});m.arearange=p(m.area,{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.low}</b> - <b>{point.high}</b><br/>'},
21
- trackByArea:!0,dataLabels:{verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0}});h.arearange=l.extendClass(h.area,{type:"arearange",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"low",getSegments:function(){var a=this;r(a.points,function(b){if(!a.options.connectNulls&&(b.low===null||b.high===null))b.y=null;else if(b.low===null&&b.high!==null)b.y=b.high});z.prototype.getSegments.call(this)},translate:function(){var a=this.yAxis;h.area.prototype.translate.apply(this);
22
- r(this.points,function(b){var c=b.low,d=b.high,g=b.plotY;d===null&&c===null?b.y=null:c===null?(b.plotLow=b.plotY=null,b.plotHigh=a.translate(d,0,1,0,1)):d===null?(b.plotLow=g,b.plotHigh=null):(b.plotLow=g,b.plotHigh=a.translate(d,0,1,0,1))})},getSegmentPath:function(a){var b,c=[],d=a.length,g=z.prototype.getSegmentPath,f,e;e=this.options;var i=e.step;for(b=HighchartsAdapter.grep(a,function(a){return a.plotLow!==null});d--;)f=a[d],f.plotHigh!==null&&c.push({plotX:f.plotX,plotY:f.plotHigh});a=g.call(this,
23
- b);if(i)i===!0&&(i="left"),e.step={left:"right",center:"center",right:"left"}[i];c=g.call(this,c);e.step=i;e=[].concat(a,c);c[0]="L";this.areaPath=this.areaPath.concat(a,c);return e},drawDataLabels:function(){var a=this.data,b=a.length,c,d=[],g=z.prototype,f=this.options.dataLabels,e,i=this.chart.inverted;if(f.enabled||this._hasPointLabels){for(c=b;c--;)e=a[c],e.y=e.high,e.plotY=e.plotHigh,d[c]=e.dataLabel,e.dataLabel=e.dataLabelUpper,e.below=!1,i?(f.align="left",f.x=f.xHigh):f.y=f.yHigh;g.drawDataLabels.apply(this,
24
- arguments);for(c=b;c--;)e=a[c],e.dataLabelUpper=e.dataLabel,e.dataLabel=d[c],e.y=e.low,e.plotY=e.plotLow,e.below=!0,i?(f.align="right",f.x=f.xLow):f.y=f.yLow;g.drawDataLabels.apply(this,arguments)}},alignDataLabel:h.column.prototype.alignDataLabel,getSymbol:h.column.prototype.getSymbol,drawPoints:w});m.areasplinerange=p(m.arearange);h.areasplinerange=x(h.arearange,{type:"areasplinerange",getPointSpline:h.spline.prototype.getPointSpline});m.columnrange=p(m.column,m.arearange,{lineWidth:1,pointRange:null});
25
- h.columnrange=x(h.arearange,{type:"columnrange",translate:function(){var a=this,b=a.yAxis,c;t.translate.apply(a);r(a.points,function(d){var g=d.shapeArgs,f=a.options.minPointLength,e;d.plotHigh=c=b.translate(d.high,0,1,0,1);d.plotLow=d.plotY;e=c;d=d.plotY-c;d<f&&(f-=d,d+=f,e-=f/2);g.height=d;g.y=e})},trackerGroups:["group","dataLabels"],drawGraph:w,pointAttrToOptions:t.pointAttrToOptions,drawPoints:t.drawPoints,drawTracker:t.drawTracker,animate:t.animate,getColumnMetrics:t.getColumnMetrics});m.gauge=
26
- p(m.line,{dataLabels:{enabled:!0,y:15,borderWidth:1,borderColor:"silver",borderRadius:3,style:{fontWeight:"bold"},verticalAlign:"top",zIndex:2},dial:{},pivot:{},tooltip:{headerFormat:""},showInLegend:!1});u={type:"gauge",pointClass:l.extendClass(l.Point,{setState:function(a){this.state=a}}),angular:!0,drawGraph:w,fixedBox:!0,trackerGroups:["group","dataLabels"],translate:function(){var a=this.yAxis,b=this.options,c=a.center;this.generatePoints();r(this.points,function(d){var g=p(b.dial,d.dial),f=
27
- v(q(g.radius,80))*c[2]/200,e=v(q(g.baseLength,70))*f/100,i=v(q(g.rearLength,10))*f/100,o=g.baseWidth||3,k=g.topWidth||1,j=a.startAngleRad+a.translate(d.y,null,null,null,!0);b.wrap===!1&&(j=Math.max(a.startAngleRad,Math.min(a.endAngleRad,j)));j=j*180/Math.PI;d.shapeType="path";d.shapeArgs={d:g.path||["M",-i,-o/2,"L",e,-o/2,f,-k/2,f,k/2,e,o/2,-i,o/2,"z"],translateX:c[0],translateY:c[1],rotation:j};d.plotX=c[0];d.plotY=c[1]})},drawPoints:function(){var a=this,b=a.yAxis.center,c=a.pivot,d=a.options,g=
28
- d.pivot,f=a.chart.renderer;r(a.points,function(c){var b=c.graphic,g=c.shapeArgs,k=g.d,j=p(d.dial,c.dial);b?(b.animate(g),g.d=k):c.graphic=f[c.shapeType](g).attr({stroke:j.borderColor||"none","stroke-width":j.borderWidth||0,fill:j.backgroundColor||"black",rotation:g.rotation}).add(a.group)});c?c.animate({translateX:b[0],translateY:b[1]}):a.pivot=f.circle(0,0,q(g.radius,5)).attr({"stroke-width":g.borderWidth||0,stroke:g.borderColor||"silver",fill:g.backgroundColor||"black"}).translate(b[0],b[1]).add(a.group)},
29
- animate:function(a){var b=this;if(!a)r(b.points,function(a){var d=a.graphic;d&&(d.attr({rotation:b.yAxis.startAngleRad*180/Math.PI}),d.animate({rotation:a.shapeArgs.rotation},b.options.animation))}),b.animate=null},render:function(){this.group=this.plotGroup("group","series",this.visible?"visible":"hidden",this.options.zIndex,this.chart.seriesGroup);h.pie.prototype.render.call(this);this.group.clip(this.chart.clipRect)},setData:h.pie.prototype.setData,drawTracker:h.column.prototype.drawTracker};h.gauge=
30
- l.extendClass(h.line,u);m.boxplot=p(m.column,{fillColor:"#FFFFFF",lineWidth:1,medianWidth:2,states:{hover:{brightness:-0.3}},threshold:null,tooltip:{pointFormat:'<span style="color:{series.color};font-weight:bold">{series.name}</span><br/>Maximum: {point.high}<br/>Upper quartile: {point.q3}<br/>Median: {point.median}<br/>Lower quartile: {point.q1}<br/>Minimum: {point.low}<br/>'},whiskerLength:"50%",whiskerWidth:2});h.boxplot=x(h.column,{type:"boxplot",pointArrayMap:["low","q1","median","q3","high"],
31
- toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high",pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth"},drawDataLabels:w,translate:function(){var a=this.yAxis,b=this.pointArrayMap;h.column.prototype.translate.apply(this);r(this.points,function(c){r(b,function(b){c[b]!==null&&(c[b+"Plot"]=a.translate(c[b],0,1,0,1))})})},drawPoints:function(){var a=this,b=a.points,c=a.options,d=a.chart.renderer,g,f,e,i,o,k,j,h,l,m,n,H,p,E,I,t,w,s,v,u,z,y,x=a.doQuartiles!==
32
- !1,B=parseInt(a.options.whiskerLength,10)/100;r(b,function(b){l=b.graphic;z=b.shapeArgs;n={};E={};t={};y=b.color||a.color;if(b.plotY!==C)if(g=b.pointAttr[b.selected?"selected":""],w=z.width,s=A(z.x),v=s+w,u=D(w/2),f=A(x?b.q1Plot:b.lowPlot),e=A(x?b.q3Plot:b.lowPlot),i=A(b.highPlot),o=A(b.lowPlot),n.stroke=b.stemColor||c.stemColor||y,n["stroke-width"]=q(b.stemWidth,c.stemWidth,c.lineWidth),n.dashstyle=b.stemDashStyle||c.stemDashStyle,E.stroke=b.whiskerColor||c.whiskerColor||y,E["stroke-width"]=q(b.whiskerWidth,
33
- c.whiskerWidth,c.lineWidth),t.stroke=b.medianColor||c.medianColor||y,t["stroke-width"]=q(b.medianWidth,c.medianWidth,c.lineWidth),t["stroke-linecap"]="round",j=n["stroke-width"]%2/2,h=s+u+j,m=["M",h,e,"L",h,i,"M",h,f,"L",h,o,"z"],x&&(j=g["stroke-width"]%2/2,h=A(h)+j,f=A(f)+j,e=A(e)+j,s+=j,v+=j,H=["M",s,e,"L",s,f,"L",v,f,"L",v,e,"L",s,e,"z"]),B&&(j=E["stroke-width"]%2/2,i+=j,o+=j,p=["M",h-u*B,i,"L",h+u*B,i,"M",h-u*B,o,"L",h+u*B,o]),j=t["stroke-width"]%2/2,k=D(b.medianPlot)+j,I=["M",s,k,"L",v,k,"z"],
34
- l)b.stem.animate({d:m}),B&&b.whiskers.animate({d:p}),x&&b.box.animate({d:H}),b.medianShape.animate({d:I});else{b.graphic=l=d.g().add(a.group);b.stem=d.path(m).attr(n).add(l);if(B)b.whiskers=d.path(p).attr(E).add(l);if(x)b.box=d.path(H).attr(g).add(l);b.medianShape=d.path(I).attr(t).add(l)}})}});m.errorbar=p(m.boxplot,{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:m.arearange.tooltip.pointFormat},whiskerWidth:null});h.errorbar=x(h.boxplot,{type:"errorbar",pointArrayMap:["low",
35
- "high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||h.column.prototype.getColumnMetrics.call(this)}});m.waterfall=p(m.column,{lineWidth:1,lineColor:"#333",dashStyle:"dot",borderColor:"#333"});h.waterfall=x(h.column,{type:"waterfall",upColorProp:"fill",pointArrayMap:["low","y"],pointValKey:"y",init:function(a,b){b.stacking=!0;h.column.prototype.init.call(this,a,b)},translate:function(){var a=
36
- this.options,b=this.yAxis,c,d,g,f,e,i,o,k,j;c=a.threshold;a=a.borderWidth%2/2;h.column.prototype.translate.apply(this);k=c;g=this.points;for(d=0,c=g.length;d<c;d++){f=g[d];e=f.shapeArgs;i=this.getStack(d);j=i.points[this.index];if(isNaN(f.y))f.y=this.yData[d];o=S(k,k+f.y)+j[0];e.y=b.translate(o,0,1);f.isSum||f.isIntermediateSum?(e.y=b.translate(j[1],0,1),e.height=b.translate(j[0],0,1)-e.y):k+=i.total;e.height<0&&(e.y+=e.height,e.height*=-1);f.plotY=e.y=D(e.y)-a;e.height=D(e.height);f.yBottom=e.y+
37
- e.height}},processData:function(a){var b=this.yData,c=this.points,d,g=b.length,f=this.options.threshold||0,e,i,h,k,j,l;i=e=h=k=f;for(l=0;l<g;l++)j=b[l],d=c&&c[l]?c[l]:{},j==="sum"||d.isSum?b[l]=i:j==="intermediateSum"||d.isIntermediateSum?(b[l]=e,e=f):(i+=j,e+=j),h=Math.min(i,h),k=Math.max(i,k);z.prototype.processData.call(this,a);this.dataMin=h;this.dataMax=k},toYData:function(a){if(a.isSum)return"sum";else if(a.isIntermediateSum)return"intermediateSum";return a.y},getAttribs:function(){h.column.prototype.getAttribs.apply(this,
38
- arguments);var a=this.options,b=a.states,c=a.upColor||this.color,a=l.Color(c).brighten(0.1).get(),d=p(this.pointAttr),g=this.upColorProp;d[""][g]=c;d.hover[g]=b.hover.upColor||a;d.select[g]=b.select.upColor||c;r(this.points,function(a){if(a.y>0&&!a.color)a.pointAttr=d,a.color=c})},getGraphPath:function(){var a=this.data,b=a.length,c=D(this.options.lineWidth+this.options.borderWidth)%2/2,d=[],g,f,e;for(e=1;e<b;e++)f=a[e].shapeArgs,g=a[e-1].shapeArgs,f=["M",g.x+g.width,g.y+c,"L",f.x,g.y+c],a[e-1].y<
39
- 0&&(f[2]+=g.height,f[5]+=g.height),d=d.concat(f);return d},getExtremes:w,getStack:function(a){var b=this.yAxis.stacks,c=this.stackKey;this.processedYData[a]<this.options.threshold&&(c="-"+c);return b[c][a]},drawGraph:z.prototype.drawGraph});m.bubble=p(m.scatter,{dataLabels:{inside:!0,style:{color:"white",textShadow:"0px 0px 3px black"},verticalAlign:"middle"},marker:{lineColor:null,lineWidth:1},minSize:8,maxSize:"20%",tooltip:{pointFormat:"({point.x}, {point.y}), Size: {point.z}"},turboThreshold:0,
40
- zThreshold:0});h.bubble=x(h.scatter,{type:"bubble",pointArrayMap:["y","z"],trackerGroups:["group","dataLabelsGroup"],bubblePadding:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor"},applyOpacity:function(a){var b=this.options.marker,c=q(b.fillOpacity,0.5),a=a||b.fillColor||this.color;c!==1&&(a=l.Color(a).setOpacity(c).get("rgba"));return a},convertAttribs:function(){var a=z.prototype.convertAttribs.apply(this,arguments);a.fill=this.applyOpacity(a.fill);return a},
41
- getRadii:function(a,b,c,d){var g,f,e,i=this.zData,h=[],k=this.options.sizeBy!=="width";for(f=0,g=i.length;f<g;f++)e=b-a,e=e>0?(i[f]-a)/(b-a):0.5,k&&(e=Math.sqrt(e)),h.push(s.ceil(c+e*(d-c))/2);this.radii=h},animate:function(a){var b=this.options.animation;if(!a)r(this.points,function(a){var d=a.graphic,a=a.shapeArgs;d&&a&&(d.attr("r",1),d.animate({r:a.r},b))}),this.animate=null},translate:function(){var a,b=this.data,c,d,g=this.radii;h.scatter.prototype.translate.call(this);for(a=b.length;a--;)c=
42
- b[a],d=g?g[a]:0,c.negative=c.z<(this.options.zThreshold||0),d>=this.minPxSize/2?(c.shapeType="circle",c.shapeArgs={x:c.plotX,y:c.plotY,r:d},c.dlBox={x:c.plotX-d,y:c.plotY-d,width:2*d,height:2*d}):c.shapeArgs=c.plotY=c.dlBox=C},drawLegendSymbol:function(a,b){var c=v(a.itemStyle.fontSize)/2;b.legendSymbol=this.chart.renderer.circle(c,a.baseline-c,c).attr({zIndex:3}).add(b.legendGroup);b.legendSymbol.isMarker=!0},drawPoints:h.column.prototype.drawPoints,alignDataLabel:h.column.prototype.alignDataLabel});
43
- N.prototype.beforePadding=function(){var a=this,b=this.len,c=this.chart,d=0,g=b,f=this.isXAxis,e=f?"xData":"yData",i=this.min,h={},k=s.min(c.plotWidth,c.plotHeight),j=Number.MAX_VALUE,l=-Number.MAX_VALUE,m=this.max-i,n=b/m,p=[];this.tickPositions&&(r(this.series,function(b){var c=b.options;if(b.bubblePadding&&b.visible&&(a.allowZoomOutside=!0,p.push(b),f))r(["minSize","maxSize"],function(a){var b=c[a],d=/%$/.test(b),b=v(b);h[a]=d?k*b/100:b}),b.minPxSize=h.minSize,b=b.zData,b.length&&(j=s.min(j,s.max(P(b),
44
- c.displayNegative===!1?c.zThreshold:-Number.MAX_VALUE)),l=s.max(l,Q(b)))}),r(p,function(a){var b=a[e],c=b.length,k;f&&a.getRadii(j,l,h.minSize,h.maxSize);if(m>0)for(;c--;)b[c]!==null&&(k=a.radii[c],d=Math.min((b[c]-i)*n-k,d),g=Math.max((b[c]-i)*n+k,g))}),p.length&&m>0&&q(this.options.min,this.userMin)===C&&q(this.options.max,this.userMax)===C&&(g-=b,n*=(b+d-g)/b,this.min+=d/n,this.max+=g/n))};var y=z.prototype,m=l.Pointer.prototype;y.toXY=function(a){var b,c=this.chart;b=a.plotX;var d=a.plotY;a.rectPlotX=
45
- b;a.rectPlotY=d;a.clientX=(b/Math.PI*180+this.xAxis.pane.options.startAngle)%360;b=this.xAxis.postTranslate(a.plotX,this.yAxis.len-d);a.plotX=a.polarPlotX=b.x-c.plotLeft;a.plotY=a.polarPlotY=b.y-c.plotTop};y.orderTooltipPoints=function(a){if(this.chart.polar&&(a.sort(function(a,c){return a.clientX-c.clientX}),a[0]))a[0].wrappedClientX=a[0].clientX+360,a.push(a[0])};n(h.area.prototype,"init",K);n(h.areaspline.prototype,"init",K);n(h.spline.prototype,"getPointSpline",function(a,b,c,d){var g,f,e,i,h,
46
- k,j;if(this.chart.polar){g=c.plotX;f=c.plotY;a=b[d-1];e=b[d+1];this.connectEnds&&(a||(a=b[b.length-2]),e||(e=b[1]));if(a&&e)i=a.plotX,h=a.plotY,b=e.plotX,k=e.plotY,i=(1.5*g+i)/2.5,h=(1.5*f+h)/2.5,e=(1.5*g+b)/2.5,j=(1.5*f+k)/2.5,b=Math.sqrt(Math.pow(i-g,2)+Math.pow(h-f,2)),k=Math.sqrt(Math.pow(e-g,2)+Math.pow(j-f,2)),i=Math.atan2(h-f,i-g),h=Math.atan2(j-f,e-g),j=Math.PI/2+(i+h)/2,Math.abs(i-j)>Math.PI/2&&(j-=Math.PI),i=g+Math.cos(j)*b,h=f+Math.sin(j)*b,e=g+Math.cos(Math.PI+j)*k,j=f+Math.sin(Math.PI+
47
- j)*k,c.rightContX=e,c.rightContY=j;d?(c=["C",a.rightContX||a.plotX,a.rightContY||a.plotY,i||g,h||f,g,f],a.rightContX=a.rightContY=null):c=["M",g,f]}else c=a.call(this,b,c,d);return c});n(y,"translate",function(a){a.call(this);if(this.chart.polar&&!this.preventPostTranslate)for(var a=this.points,b=a.length;b--;)this.toXY(a[b])});n(y,"getSegmentPath",function(a,b){var c=this.points;if(this.chart.polar&&this.options.connectEnds!==!1&&b[b.length-1]===c[c.length-1]&&c[0].y!==null)this.connectEnds=!0,b=
48
- [].concat(b,[c[0]]);return a.call(this,b)});n(y,"animate",L);n(t,"animate",L);n(y,"setTooltipPoints",function(a,b){this.chart.polar&&F(this.xAxis,{tooltipLen:360});return a.call(this,b)});n(t,"translate",function(a){var b=this.xAxis,c=this.yAxis.len,d=b.center,g=b.startAngleRad,f=this.chart.renderer,e,h;this.preventPostTranslate=!0;a.call(this);if(b.isRadial){b=this.points;for(h=b.length;h--;)e=b[h],a=e.barX+g,e.shapeType="path",e.shapeArgs={d:f.symbols.arc(d[0],d[1],c-e.plotY,null,{start:a,end:a+
49
- e.pointWidth,innerR:c-q(e.yBottom,c)})},this.toXY(e)}});n(t,"alignDataLabel",function(a,b,c,d,g,f){if(this.chart.polar){a=b.rectPlotX/Math.PI*180;if(d.align===null)d.align=a>20&&a<160?"left":a>200&&a<340?"right":"center";if(d.verticalAlign===null)d.verticalAlign=a<45||a>315?"bottom":a>135&&a<225?"top":"middle";y.alignDataLabel.call(this,b,c,d,g,f)}else a.call(this,b,c,d,g,f)});n(m,"getIndex",function(a,b){var c,d=this.chart,g;d.polar?(g=d.xAxis[0].center,c=b.chartX-g[0]-d.plotLeft,d=b.chartY-g[1]-
50
- d.plotTop,c=180-Math.round(Math.atan2(c,d)/Math.PI*180)):c=a.call(this,b);return c});n(m,"getCoordinates",function(a,b){var c=this.chart,d={xAxis:[],yAxis:[]};c.polar?r(c.axes,function(a){var f=a.isXAxis,e=a.center,h=b.chartX-e[0]-c.plotLeft,e=b.chartY-e[1]-c.plotTop;d[f?"xAxis":"yAxis"].push({axis:a,value:a.translate(f?Math.PI-Math.atan2(h,e):Math.sqrt(Math.pow(h,2)+Math.pow(e,2)),!0)})}):d=a.call(this,b);return d})})(Highcharts);