response.js
28.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(["chartist"], function (Chartist) {
return (root.returnExportsGlobal = factory(Chartist));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require("chartist"));
} else {
root['Chartist.plugins.ctAccessibility'] = factory(Chartist);
}
}(this, function (Chartist) {
/**
* Chartist.js plugin that generates visually hidden tables for better accessibility. It's also possible to initialize a Chart with data from an existing table.
*
*/
/* global Chartist */
(function (window, document, Chartist) {
'use strict';
// A simple recursive DOM string builder
function Element(name, attrs, parent) {
return {
elem: function (name, attrs) {
var e = Element(name, attrs, this);
this.children.push(e);
return e;
},
children: [],
name: name,
_attrs: attrs || {},
_parent: parent,
parent: function () {
return this._parent;
},
attrs: function (attrs) {
this._attrs = attrs;
return this;
},
text: function (text, after) {
if (after) {
this._textAfter = text;
} else {
this._textBefore = text;
}
return this;
},
toString: function () {
var attrs = Object.keys(this._attrs).filter(function (attrName) {
return this._attrs[attrName] || this._attrs[attrName] === 0;
}.bind(this)).map(function (attrName) {
return [attrName, '="', this._attrs[attrName], '"'].join('');
}.bind(this)).join(' ');
return ['<', this.name, attrs ? ' ' + attrs : '', '>', this._textBefore].concat(this.children.map(function (child) {
return child.toString();
})).concat([this._textAfter, '</', this.name, '>']).join('');
}
};
}
var defaultOptions = {
caption: 'A graphical chart',
seriesHeader: 'Series name',
valueTransform: Chartist.noop,
summary: undefined,
class: undefined,
elementId: function () {
return 'ct-accessibility-table-' + (+new Date());
},
visuallyHiddenStyles: 'position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;'
};
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.ctAccessibility = function (options) {
options = Chartist.extend({}, defaultOptions, options);
return function ctAccessibility(chart) {
var elementId = typeof options.elementId === 'function' ? options.elementId() : options.elementId;
chart.on('created', function (data) {
var containerElement = data.svg._node.parentNode;
var previousElement = containerElement.querySelector('#' + elementId);
if(previousElement) {
containerElement.removeChild(previousElement);
}
// As we are now compensating the SVG graphic with the chart with an accessibility table, we hide it for ARIA
data.svg.attr({
'aria-hidden': 'true'
});
// Create wrapper element
var element = Element('div', {
style: options.visuallyHiddenStyles,
id: elementId
});
// Create table body with caption
var tBody = element.elem('table', {
summary: options.summary,
class: options.class
}).elem('caption')
.text(options.caption)
.elem('tbody');
var firstRow = tBody.elem('tr');
if (chart instanceof Chartist.Pie) {
// For pie charts we have only column headers and one series
var dataArray = Chartist.getDataArray(chart.data, chart.optionsProvider.getCurrentOptions().reverseData);
// First render the column headers with our pie chart labels
chart.data.labels.forEach(function (text) {
firstRow
.elem('th', {
scope: 'col',
role: 'columnheader'
})
.text(text);
});
var row = tBody.elem('tr');
// Add all data fields of our pie chart to the row
dataArray.forEach(function (dataValue) {
row.elem('td').text(options.valueTransform(dataValue));
});
} else {
// For line and bar charts we have multiple series and therefore also row headers
var normalizedData = Chartist.getDataArray(chart.data, chart.optionsProvider.getCurrentOptions().reverseData);
// Add column headers inclusing the series column header for the row headers
[options.seriesHeader].concat(chart.data.labels).forEach(function (text) {
firstRow
.elem('th', {
scope: 'col',
role: 'columnheader'
})
.text(text);
});
// Add all data rows including their row headers
chart.data.series.forEach(function (series, index) {
var seriesName = series.name || [index + 1, '. Series'].join('');
var row = tBody.elem('tr');
row.elem('th', {
scope: 'row',
role: 'rowheader'
}).text(seriesName);
normalizedData[index].forEach(function (dataValue) {
row.elem('td').text(options.valueTransform(dataValue));
});
});
}
// Update invisible table in DOM and update table element with newly created table
containerElement.appendChild(new DOMParser().parseFromString(element.toString(), 'text/html').getElementById(elementId));
});
};
};
}(window, document, Chartist));
return Chartist.plugins.ctAccessibility;
}));
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(["chartist"], function (Chartist) {
return (root.returnExportsGlobal = factory(Chartist));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require("chartist"));
} else {
root['Chartist.plugins.ctAxisTitle'] = factory(Chartist);
}
}(this, function (Chartist) {
/**
* Chartist.js plugin to display a title for 1 or 2 axes.
* version 0.0.7
* author: alex stanbury
*/
/* global Chartist */
(function(Chartist) {
"use strict";
var axisDefaults = {
axisTitle: "",
axisClass: "ct-axis-title",
offset: {
x: 0,
y: 0
},
textAnchor: "middle",
flipTitle: false
};
var defaultOptions = {
axisX: axisDefaults,
axisY: axisDefaults
};
var getTitle = function(title) {
if (title instanceof Function) {
return title();
}
return title;
};
var getClasses = function(classes) {
if (classes instanceof Function) {
return classes();
}
return classes;
};
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.ctAxisTitle = function(options) {
options = Chartist.extend({}, defaultOptions, options);
return function ctAxisTitle(chart) {
chart.on("created", function(data) {
if (!options.axisX.axisTitle && !options.axisY.axisTitle) {
throw new Error(
"ctAxisTitle plugin - You must provide at least one axis title"
);
} else if (!data.axisX && !data.axisY) {
throw new Error(
"ctAxisTitle plugin can only be used on charts that have at least one axis"
);
}
var xPos,
yPos,
title,
chartPadding = Chartist.normalizePadding(data.options.chartPadding); // normalize the padding in case the full padding object was not passed into the options
//position axis X title
if (options.axisX.axisTitle && data.axisX) {
xPos =
data.axisX.axisLength / 2 +
data.options.axisY.offset +
chartPadding.left;
yPos = chartPadding.top;
if (data.options.axisY.position === "end") {
xPos -= data.options.axisY.offset;
}
if (data.options.axisX.position === "end") {
yPos += data.axisY.axisLength;
}
title = new Chartist.Svg("text");
title.addClass(getClasses(options.axisX.axisClass));
title.text(getTitle(options.axisX.axisTitle));
title.attr({
x: xPos + options.axisX.offset.x,
y: yPos + options.axisX.offset.y,
"text-anchor": options.axisX.textAnchor
});
data.svg.append(title, true);
}
//position axis Y title
if (options.axisY.axisTitle && data.axisY) {
xPos = 0;
yPos = data.axisY.axisLength / 2 + chartPadding.top;
if (data.options.axisX.position === "start") {
yPos += data.options.axisX.offset;
}
if (data.options.axisY.position === "end") {
xPos = data.axisX.axisLength;
}
var transform =
"rotate(" +
(options.axisY.flipTitle ? -90 : 90) +
", " +
xPos +
", " +
yPos +
")";
title = new Chartist.Svg("text");
title.addClass(getClasses(options.axisY.axisClass));
title.text(getTitle(options.axisY.axisTitle));
title.attr({
x: xPos + options.axisY.offset.x,
y: yPos + options.axisY.offset.y,
transform: transform,
"text-anchor": options.axisY.textAnchor
});
data.svg.append(title, true);
}
});
};
};
})(Chartist);
return Chartist.plugins.ctAxisTitle;
}));
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], function () {
return (root.returnExportsGlobal = factory());
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory();
} else {
root['Chartist.plugins.ctThreshold'] = factory();
}
}(this, function () {
/**
* Chartist.js plugin to display a data label on top of the points in a line chart.
*
*/
/* global Chartist */
(function (window, document, Chartist) {
'use strict';
var defaultOptions = {
threshold: 0,
classNames: {
aboveThreshold: 'ct-threshold-above',
belowThreshold: 'ct-threshold-below'
},
maskNames: {
aboveThreshold: 'ct-threshold-mask-above',
belowThreshold: 'ct-threshold-mask-below'
}
};
function createMasks(data, options) {
// Select the defs element within the chart or create a new one
var defs = data.svg.querySelector('defs') || data.svg.elem('defs');
// Project the threshold value on the chart Y axis
var projectedThreshold = data.chartRect.height() - data.axisY.projectValue(options.threshold) + data.chartRect.y2;
var width = data.svg.width();
var height = data.svg.height();
// Create mask for upper part above threshold
defs
.elem('mask', {
x: 0,
y: 0,
width: width,
height: height,
id: options.maskNames.aboveThreshold
})
.elem('rect', {
x: 0,
y: 0,
width: width,
height: projectedThreshold,
fill: 'white'
});
// Create mask for lower part below threshold
defs
.elem('mask', {
x: 0,
y: 0,
width: width,
height: height,
id: options.maskNames.belowThreshold
})
.elem('rect', {
x: 0,
y: projectedThreshold,
width: width,
height: height - projectedThreshold,
fill: 'white'
});
return defs;
}
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.ctThreshold = function (options) {
options = Chartist.extend({}, defaultOptions, options);
return function ctThreshold(chart) {
if (chart instanceof Chartist.Line || chart instanceof Chartist.Bar) {
chart.on('draw', function (data) {
if (data.type === 'point') {
// For points we can just use the data value and compare against the threshold in order to determine
// the appropriate class
data.element.addClass(
data.value.y >= options.threshold ? options.classNames.aboveThreshold : options.classNames.belowThreshold
);
} else if (data.type === 'line' || data.type === 'bar' || data.type === 'area') {
// Cloning the original line path, mask it with the upper mask rect above the threshold and add the
// class for above threshold
data.element
.parent()
.elem(data.element._node.cloneNode(true))
.attr({
mask: 'url(#' + options.maskNames.aboveThreshold + ')'
})
.addClass(options.classNames.aboveThreshold);
// Use the original line path, mask it with the lower mask rect below the threshold and add the class
// for blow threshold
data.element
.attr({
mask: 'url(#' + options.maskNames.belowThreshold + ')'
})
.addClass(options.classNames.belowThreshold);
}
});
// On the created event, create the two mask definitions used to mask the line graphs
chart.on('created', function (data) {
createMasks(data, options);
});
}
};
}
}(window, document, Chartist));
return Chartist.plugins.ctThreshold;
}));
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['chartist'], function (chartist) {
return (root.returnExportsGlobal = factory(chartist));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require('chartist'));
} else {
root['Chartist.plugins.legend'] = factory(root.Chartist);
}
}(this, function (Chartist) {
/**
* This Chartist plugin creates a legend to show next to the chart.
*
*/
'use strict';
var defaultOptions = {
className: '',
classNames: false,
removeAll: false,
legendNames: false,
clickable: true,
onClick: null,
position: 'top'
};
Chartist.plugins = Chartist.plugins || {};
Chartist.plugins.legend = function (options) {
// Catch invalid options
if (options && options.position) {
if (!(options.position === 'top' || options.position === 'bottom' || options.position instanceof HTMLElement)) {
throw Error('The position you entered is not a valid position');
}
if (options.position instanceof HTMLElement) {
// Detatch DOM element from options object, because Chartist.extend
// currently chokes on circular references present in HTMLElements
var cachedDOMPosition = options.position;
delete options.position;
}
}
options = Chartist.extend({}, defaultOptions, options);
if (cachedDOMPosition) {
// Reattatch the DOM Element position if it was removed before
options.position = cachedDOMPosition
}
return function legend(chart) {
function removeLegendElement() {
var legendElement = chart.container.querySelector('.ct-legend');
if (legendElement) {
legendElement.parentNode.removeChild(legendElement);
}
}
// Set a unique className for each series so that when a series is removed,
// the other series still have the same color.
function setSeriesClassNames() {
chart.data.series = chart.data.series.map(function (series, seriesIndex) {
if (typeof series !== 'object') {
series = {
value: series
};
}
series.className = series.className || chart.options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex);
return series;
});
}
function createLegendElement() {
var legendElement = document.createElement('ul');
legendElement.className = 'ct-legend';
if (chart instanceof Chartist.Pie) {
legendElement.classList.add('ct-legend-inside');
}
if (typeof options.className === 'string' && options.className.length > 0) {
legendElement.classList.add(options.className);
}
if (chart.options.width) {
legendElement.style.cssText = 'width: ' + chart.options.width + 'px;margin: 0 auto;';
}
return legendElement;
}
// Get the right array to use for generating the legend.
function getLegendNames(useLabels) {
return options.legendNames || (useLabels ? chart.data.labels : chart.data.series);
}
// Initialize the array that associates series with legends.
// -1 indicates that there is no legend associated with it.
function initSeriesMetadata(useLabels) {
var seriesMetadata = new Array(chart.data.series.length);
for (var i = 0; i < chart.data.series.length; i++) {
seriesMetadata[i] = {
data: chart.data.series[i],
label: useLabels ? chart.data.labels[i] : null,
legend: -1
};
}
return seriesMetadata;
}
function createNameElement(i, legendText, classNamesViable) {
var li = document.createElement('li');
li.classList.add('ct-series-' + i);
// Append specific class to a legend element, if viable classes are given
if (classNamesViable) {
li.classList.add(options.classNames[i]);
}
li.setAttribute('data-legend', i);
li.textContent = legendText;
return li;
}
// Append the legend element to the DOM
function appendLegendToDOM(legendElement) {
if (!(options.position instanceof HTMLElement)) {
switch (options.position) {
case 'top':
chart.container.insertBefore(legendElement, chart.container.childNodes[0]);
break;
case 'bottom':
chart.container.insertBefore(legendElement, null);
break;
}
} else {
// Appends the legend element as the last child of a given HTMLElement
options.position.insertBefore(legendElement, null);
}
}
function addClickHandler(legendElement, legends, seriesMetadata, useLabels) {
legendElement.addEventListener('click', function(e) {
var li = e.target;
if (li.parentNode !== legendElement || !li.hasAttribute('data-legend'))
return;
e.preventDefault();
var legendIndex = parseInt(li.getAttribute('data-legend'));
var legend = legends[legendIndex];
if (!legend.active) {
legend.active = true;
li.classList.remove('inactive');
} else {
legend.active = false;
li.classList.add('inactive');
var activeCount = legends.filter(function(legend) { return legend.active; }).length;
if (!options.removeAll && activeCount == 0) {
// If we can't disable all series at the same time, let's
// reenable all of them:
for (var i = 0; i < legends.length; i++) {
legends[i].active = true;
legendElement.childNodes[i].classList.remove('inactive');
}
}
}
var newSeries = [];
var newLabels = [];
for (var i = 0; i < seriesMetadata.length; i++) {
if (seriesMetadata[i].legend != -1 && legends[seriesMetadata[i].legend].active) {
newSeries.push(seriesMetadata[i].data);
newLabels.push(seriesMetadata[i].label);
}
}
chart.data.series = newSeries;
if (useLabels) {
chart.data.labels = newLabels;
}
chart.update();
if (options.onClick) {
options.onClick(chart, e);
}
});
}
removeLegendElement();
var legendElement = createLegendElement();
var useLabels = chart instanceof Chartist.Pie && chart.data.labels && chart.data.labels.length;
var legendNames = getLegendNames(useLabels);
var seriesMetadata = initSeriesMetadata(useLabels);
var legends = [];
// Check if given class names are viable to append to legends
var classNamesViable = Array.isArray(options.classNames) && options.classNames.length === legendNames.length;
// Loop through all legends to set each name in a list item.
legendNames.forEach(function (legend, i) {
var legendText = legend.name || legend;
var legendSeries = legend.series || [i];
var li = createNameElement(i, legendText, classNamesViable);
legendElement.appendChild(li);
legendSeries.forEach(function(seriesIndex) {
seriesMetadata[seriesIndex].legend = i;
});
legends.push({
text: legendText,
series: legendSeries,
active: true
});
});
chart.on('created', function (data) {
appendLegendToDOM(legendElement);
});
if (options.clickable) {
setSeriesClassNames();
addClickHandler(legendElement, legends, seriesMetadata, useLabels);
}
};
};
return Chartist.plugins.legend;
}));
Chartist.Line('#chart0', {
labels: [0+1, 1+1, 2+1, 3+1, 4+1, 5+1, 6+1, 7+1, 8+1, 9+1, 10+1, 11+1],
series: [
{ name: 'Vooluhulk (m^3/s)', data: [54, 41, 18, 65, 167, 18, 12, 10, 22, 78, 69, 63]},
{ name: 'Maksimum-5%', data: [ 158.651000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000, 158.650000]},
{ name: 'Maksimum+5%', data: [ 175.351000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000, 175.350000]}
]
}, {
series:{'Maksimum-5%': { showPoint: true, showLine: true, showArea: false},
'Maksimum+5%': { showPoint: true, showLine: true, showArea: false}},
axisX: {showLabel: false},
width: 800,
height: 600,
plugins: [
Chartist.plugins.ctAccessibility({
caption:' Jõe voolu hulk 1-12',
seriesHeader: 'Kuud',
summary: 'Voolu hulgad, mis olid DB\'s, teie valitud aasta eest.',
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
}),
Chartist.plugins.ctThreshold({ threshold:36.357074}), Chartist.plugins.ctAxisTitle({
axisX: { axisTitle: 'Kuud', axisClass: 'ct-axis-title',
offset: { x: 0, y: 20 }, textAnchor: 'middle'},
axisY: { axisTitle: 'Vooluhulk (m^3/s)', axisClass: 'ct-axis-title',
offset: { x: 0, y: 12 }, textAnchor: 'middle', flipTitle: true }
})
]
});
Chartist.Line('#chart1', {
labels: [0+1, 1+1, 2+1, 3+1, 4+1, 5+1, 6+1, 7+1, 8+1, 9+1, 10+1, 11+1],
series: [
{ name: 'Vooluhulk (m^3/s)', data: [20, 18, 7, 24, 72, 9, 6, 5, 8, 27, 22, 24]},
{ name: 'Maksimum-5%', data: [ 68.401000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000, 68.400000]},
{ name: 'Maksimum+5%', data: [ 75.601000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000, 75.600000]}
]
}, {
series:{'Maksimum-5%': { showPoint: true, showLine: true, showArea: false},
'Maksimum+5%': { showPoint: true, showLine: true, showArea: false}},
axisX: {showLabel: false},
width: 800,
height: 600,
plugins: [
Chartist.plugins.ctAccessibility({
caption:' Jõe voolu hulk 1-12',
seriesHeader: 'Kuud',
summary: 'Voolu hulgad, mis olid DB\'s, teie valitud aasta eest.',
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
}),
Chartist.plugins.ctThreshold({ threshold:14.259987}), Chartist.plugins.ctAxisTitle({
axisX: { axisTitle: 'Kuud', axisClass: 'ct-axis-title',
offset: { x: 0, y: 20 }, textAnchor: 'middle'},
axisY: { axisTitle: 'Vooluhulk (m^3/s)', axisClass: 'ct-axis-title',
offset: { x: 0, y: 12 }, textAnchor: 'middle', flipTitle: true }
})
]
});
Chartist.Line('#chart2', {
labels: [null],
series: [
{ name: 'Vooluhulk (m^3/s)', data: [null]},
{ name: 'Maksimum-5%', data: [null]},
{ name: 'Maksimum+5%', data: [null]}
]
}, {
series:{'Maksimum-5%': { showPoint: true, showLine: true, showArea: false},
'Maksimum+5%': { showPoint: true, showLine: true, showArea: false}},
axisX: {showLabel: false},
width: 800,
height: 600,
plugins: [
Chartist.plugins.ctAccessibility({
caption:' Jõe voolu hulk -',
seriesHeader: 'Kuud',
summary: 'Voolu hulgad, mis olid DB\'s, teie valitud aasta eest.',
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
}),
Chartist.plugins.ctThreshold({ threshold:0}), Chartist.plugins.ctAxisTitle({
axisX: { axisTitle: 'Kuud', axisClass: 'ct-axis-title',
offset: { x: 0, y: 20 }, textAnchor: 'middle'},
axisY: { axisTitle: 'Vooluhulk (m^3/s)', axisClass: 'ct-axis-title',
offset: { x: 0, y: 12 }, textAnchor: 'middle', flipTitle: true }
})
]
});
Chartist.Line('#chart3', {
labels: [0+1, 1+1, 2+1, 3+1, 4+1, 5+1, 6+1, 7+1, 8+1, 9+1, 10+1, 11+1],
series: [
{ name: 'Vooluhulk (m^3/s)', data: [1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]},
{ name: 'Maksimum-5%', data: [ 1.901000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000, 1.900000]},
{ name: 'Maksimum+5%', data: [ 2.101000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000, 2.100000]}
]
}, {
series:{'Maksimum-5%': { showPoint: true, showLine: true, showArea: false},
'Maksimum+5%': { showPoint: true, showLine: true, showArea: false}},
axisX: {showLabel: false},
width: 800,
height: 600,
plugins: [
Chartist.plugins.ctAccessibility({
caption:' Jõe voolu hulk 1-12',
seriesHeader: 'Kuud',
summary: 'Voolu hulgad, mis olid DB\'s, teie valitud aasta eest.',
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
}),
Chartist.plugins.ctThreshold({ threshold:0.766032}), Chartist.plugins.ctAxisTitle({
axisX: { axisTitle: 'Kuud', axisClass: 'ct-axis-title',
offset: { x: 0, y: 20 }, textAnchor: 'middle'},
axisY: { axisTitle: 'Vooluhulk (m^3/s)', axisClass: 'ct-axis-title',
offset: { x: 0, y: 12 }, textAnchor: 'middle', flipTitle: true }
})
]
});