inviton-powerduck 0.0.209 → 0.0.211
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.
- package/common/css/ladda-themeless-zoomin.min.css +89 -89
- package/components/card/card-header.tsx +3 -2
- package/components/card/card.tsx +36 -1
- package/components/card/css/card.scss +42 -0
- package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
- package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
- package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
- package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
- package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
- package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
- package/components/svg/skilift-svg.tsx +6 -6
- package/components/ui/notification.ts +22 -2
- package/package.json +1 -1
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
/*! Ladda http://lab.hakim.se/ladda MIT licensed Copyright (C) 2016 Hakim El Hattab, http://hakim.se ....Lightweight adaptation for Inviton API needs*/
|
|
2
|
-
.ladda-button {
|
|
3
|
-
position: relative;
|
|
4
|
-
}
|
|
5
|
-
.ladda-button .ladda-spinner {
|
|
6
|
-
position: absolute;
|
|
7
|
-
z-index: 2;
|
|
8
|
-
display: inline-block;
|
|
9
|
-
width: 32px;
|
|
10
|
-
height: 32px;
|
|
11
|
-
top: 50%;
|
|
12
|
-
margin-top: 0;
|
|
13
|
-
opacity: 0;
|
|
14
|
-
pointer-events: none;
|
|
15
|
-
}
|
|
16
|
-
.ladda-button .ladda-label {
|
|
17
|
-
position: relative;
|
|
18
|
-
z-index: 3;
|
|
19
|
-
}
|
|
20
|
-
.ladda-button .ladda-progress {
|
|
21
|
-
position: absolute;
|
|
22
|
-
width: 0;
|
|
23
|
-
height: 100%;
|
|
24
|
-
left: 0;
|
|
25
|
-
top: 0;
|
|
26
|
-
background: rgba(0, 0, 0, 0.2);
|
|
27
|
-
visibility: hidden;
|
|
28
|
-
opacity: 0;
|
|
29
|
-
-webkit-transition: 0.1s linear all !important;
|
|
30
|
-
-moz-transition: 0.1s linear all !important;
|
|
31
|
-
-ms-transition: 0.1s linear all !important;
|
|
32
|
-
-o-transition: 0.1s linear all !important;
|
|
33
|
-
transition: 0.1s linear all !important;
|
|
34
|
-
}
|
|
35
|
-
.ladda-button[data-loading] .ladda-progress {
|
|
36
|
-
opacity: 1;
|
|
37
|
-
visibility: visible;
|
|
38
|
-
}
|
|
39
|
-
.ladda-button,
|
|
40
|
-
.ladda-button .ladda-label,
|
|
41
|
-
.ladda-button .ladda-spinner {
|
|
42
|
-
-webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
43
|
-
-moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
44
|
-
-ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
45
|
-
-o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
46
|
-
transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
47
|
-
}
|
|
48
|
-
.ladda-button[data-style="zoom-in"],
|
|
49
|
-
.ladda-button[data-style="zoom-in"] .ladda-label,
|
|
50
|
-
.ladda-button[data-style="zoom-in"] .ladda-spinner {
|
|
51
|
-
-webkit-transition: 0.3s ease all !important;
|
|
52
|
-
-moz-transition: 0.3s ease all !important;
|
|
53
|
-
-ms-transition: 0.3s ease all !important;
|
|
54
|
-
-o-transition: 0.3s ease all !important;
|
|
55
|
-
transition: 0.3s ease all !important;
|
|
56
|
-
}
|
|
57
|
-
.ladda-button[data-style="zoom-in"] {
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
}
|
|
60
|
-
.ladda-button[data-style="zoom-in"] .ladda-spinner {
|
|
61
|
-
left: 50%;
|
|
62
|
-
margin-left: -16px;
|
|
63
|
-
-webkit-transform: scale(0.2);
|
|
64
|
-
-moz-transform: scale(0.2);
|
|
65
|
-
-ms-transform: scale(0.2);
|
|
66
|
-
-o-transform: scale(0.2);
|
|
67
|
-
transform: scale(0.2);
|
|
68
|
-
}
|
|
69
|
-
.ladda-button[data-style="zoom-in"] .ladda-label {
|
|
70
|
-
position: relative;
|
|
71
|
-
display: inline-block;
|
|
72
|
-
}
|
|
73
|
-
.ladda-button[data-style="zoom-in"][data-loading] .ladda-label {
|
|
74
|
-
opacity: 0;
|
|
75
|
-
-webkit-transform: scale(2.2);
|
|
76
|
-
-moz-transform: scale(2.2);
|
|
77
|
-
-ms-transform: scale(2.2);
|
|
78
|
-
-o-transform: scale(2.2);
|
|
79
|
-
transform: scale(2.2);
|
|
80
|
-
}
|
|
81
|
-
.ladda-button[data-style="zoom-in"][data-loading] .ladda-spinner {
|
|
82
|
-
opacity: 1;
|
|
83
|
-
margin-left: 0;
|
|
84
|
-
-webkit-transform: none;
|
|
85
|
-
-moz-transform: none;
|
|
86
|
-
-ms-transform: none;
|
|
87
|
-
-o-transform: none;
|
|
88
|
-
transform: none;
|
|
89
|
-
}
|
|
1
|
+
/*! Ladda http://lab.hakim.se/ladda MIT licensed Copyright (C) 2016 Hakim El Hattab, http://hakim.se ....Lightweight adaptation for Inviton API needs*/
|
|
2
|
+
.ladda-button {
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
.ladda-button .ladda-spinner {
|
|
6
|
+
position: absolute;
|
|
7
|
+
z-index: 2;
|
|
8
|
+
display: inline-block;
|
|
9
|
+
width: 32px;
|
|
10
|
+
height: 32px;
|
|
11
|
+
top: 50%;
|
|
12
|
+
margin-top: 0;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
}
|
|
16
|
+
.ladda-button .ladda-label {
|
|
17
|
+
position: relative;
|
|
18
|
+
z-index: 3;
|
|
19
|
+
}
|
|
20
|
+
.ladda-button .ladda-progress {
|
|
21
|
+
position: absolute;
|
|
22
|
+
width: 0;
|
|
23
|
+
height: 100%;
|
|
24
|
+
left: 0;
|
|
25
|
+
top: 0;
|
|
26
|
+
background: rgba(0, 0, 0, 0.2);
|
|
27
|
+
visibility: hidden;
|
|
28
|
+
opacity: 0;
|
|
29
|
+
-webkit-transition: 0.1s linear all !important;
|
|
30
|
+
-moz-transition: 0.1s linear all !important;
|
|
31
|
+
-ms-transition: 0.1s linear all !important;
|
|
32
|
+
-o-transition: 0.1s linear all !important;
|
|
33
|
+
transition: 0.1s linear all !important;
|
|
34
|
+
}
|
|
35
|
+
.ladda-button[data-loading] .ladda-progress {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
visibility: visible;
|
|
38
|
+
}
|
|
39
|
+
.ladda-button,
|
|
40
|
+
.ladda-button .ladda-label,
|
|
41
|
+
.ladda-button .ladda-spinner {
|
|
42
|
+
-webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
43
|
+
-moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
44
|
+
-ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
45
|
+
-o-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
46
|
+
transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
|
|
47
|
+
}
|
|
48
|
+
.ladda-button[data-style="zoom-in"],
|
|
49
|
+
.ladda-button[data-style="zoom-in"] .ladda-label,
|
|
50
|
+
.ladda-button[data-style="zoom-in"] .ladda-spinner {
|
|
51
|
+
-webkit-transition: 0.3s ease all !important;
|
|
52
|
+
-moz-transition: 0.3s ease all !important;
|
|
53
|
+
-ms-transition: 0.3s ease all !important;
|
|
54
|
+
-o-transition: 0.3s ease all !important;
|
|
55
|
+
transition: 0.3s ease all !important;
|
|
56
|
+
}
|
|
57
|
+
.ladda-button[data-style="zoom-in"] {
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
.ladda-button[data-style="zoom-in"] .ladda-spinner {
|
|
61
|
+
left: 50%;
|
|
62
|
+
margin-left: -16px;
|
|
63
|
+
-webkit-transform: scale(0.2);
|
|
64
|
+
-moz-transform: scale(0.2);
|
|
65
|
+
-ms-transform: scale(0.2);
|
|
66
|
+
-o-transform: scale(0.2);
|
|
67
|
+
transform: scale(0.2);
|
|
68
|
+
}
|
|
69
|
+
.ladda-button[data-style="zoom-in"] .ladda-label {
|
|
70
|
+
position: relative;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
}
|
|
73
|
+
.ladda-button[data-style="zoom-in"][data-loading] .ladda-label {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
-webkit-transform: scale(2.2);
|
|
76
|
+
-moz-transform: scale(2.2);
|
|
77
|
+
-ms-transform: scale(2.2);
|
|
78
|
+
-o-transform: scale(2.2);
|
|
79
|
+
transform: scale(2.2);
|
|
80
|
+
}
|
|
81
|
+
.ladda-button[data-style="zoom-in"][data-loading] .ladda-spinner {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
margin-left: 0;
|
|
84
|
+
-webkit-transform: none;
|
|
85
|
+
-moz-transform: none;
|
|
86
|
+
-ms-transform: none;
|
|
87
|
+
-o-transform: none;
|
|
88
|
+
transform: none;
|
|
89
|
+
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
1
2
|
import { Prop, toNative } from 'vue-facing-decorator';
|
|
2
3
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
3
4
|
|
|
4
5
|
interface CardHeaderArgs {
|
|
5
|
-
title?: string;
|
|
6
|
+
title?: string | VNode;
|
|
6
7
|
subtitle?: string;
|
|
7
8
|
smallTitle?: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
@Component
|
|
11
12
|
class CardHeaderComponent extends TsxComponent<CardHeaderArgs> implements CardHeaderArgs {
|
|
12
|
-
@Prop() title!: string;
|
|
13
|
+
@Prop() title!: string | VNode;
|
|
13
14
|
@Prop() subtitle!: string;
|
|
14
15
|
@Prop() smallTitle?: string;
|
|
15
16
|
|
package/components/card/card.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { Prop, toNative } from 'vue-facing-decorator';
|
|
|
2
2
|
|
|
3
3
|
import PowerduckState from '../../app/powerduck-state';
|
|
4
4
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
5
|
+
import './css/card.scss';
|
|
5
6
|
|
|
6
7
|
export enum CardRole {
|
|
7
8
|
Normal = 0,
|
|
@@ -12,6 +13,9 @@ interface CardArgs {
|
|
|
12
13
|
role?: CardRole;
|
|
13
14
|
renderMode?: 'default' | 'inlined';
|
|
14
15
|
hasShadow?: boolean;
|
|
16
|
+
shadow?: 'none' | 'sm' | 'md' | 'lg';
|
|
17
|
+
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
+
rounded?: boolean;
|
|
15
19
|
cssClass?: string;
|
|
16
20
|
clicked?: () => void;
|
|
17
21
|
}
|
|
@@ -20,13 +24,28 @@ interface CardArgs {
|
|
|
20
24
|
class CardComponent extends TsxComponent<CardArgs> implements CardArgs {
|
|
21
25
|
@Prop() role!: CardRole;
|
|
22
26
|
@Prop() hasShadow!: boolean;
|
|
27
|
+
@Prop() shadow?: 'none' | 'sm' | 'md' | 'lg';
|
|
28
|
+
@Prop() padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
29
|
+
@Prop({ default: false }) rounded?: boolean;
|
|
23
30
|
@Prop() renderMode?: 'default' | 'inlined';
|
|
24
31
|
@Prop() cssClass?: string;
|
|
25
32
|
@Prop() clicked?: () => void;
|
|
26
33
|
|
|
27
34
|
render() {
|
|
35
|
+
const classes = [
|
|
36
|
+
'card',
|
|
37
|
+
this.role == CardRole.RootCard && 'single-card root-element',
|
|
38
|
+
this.getStickyCssClass(),
|
|
39
|
+
this.getBoxShadowCardCss(),
|
|
40
|
+
this.getRenderModeCardCss(),
|
|
41
|
+
this.getShadowClass(),
|
|
42
|
+
this.getPaddingClass(),
|
|
43
|
+
this.rounded && 'card--rounded',
|
|
44
|
+
this.cssClass,
|
|
45
|
+
].filter(Boolean).join(' ');
|
|
46
|
+
|
|
28
47
|
return (
|
|
29
|
-
<div onClick={this?.clicked} role={this.getRole()} class={
|
|
48
|
+
<div onClick={this?.clicked} role={this.getRole()} class={classes}>
|
|
30
49
|
{this.$slots.default?.()}
|
|
31
50
|
</div>
|
|
32
51
|
);
|
|
@@ -63,6 +82,22 @@ class CardComponent extends TsxComponent<CardArgs> implements CardArgs {
|
|
|
63
82
|
return '';
|
|
64
83
|
}
|
|
65
84
|
|
|
85
|
+
getShadowClass(): string {
|
|
86
|
+
if (this.shadow) {
|
|
87
|
+
return `card--shadow-${this.shadow}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getPaddingClass(): string {
|
|
94
|
+
if (this.padding) {
|
|
95
|
+
return `card--padding-${this.padding}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return '';
|
|
99
|
+
}
|
|
100
|
+
|
|
66
101
|
getRole() {
|
|
67
102
|
if (this.clicked != null) {
|
|
68
103
|
return 'button';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Card shadow variants
|
|
2
|
+
.card--shadow-none {
|
|
3
|
+
box-shadow: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.card--shadow-sm {
|
|
7
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.card--shadow-md {
|
|
11
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.card--shadow-lg {
|
|
15
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Card padding variants
|
|
19
|
+
.card--padding-none {
|
|
20
|
+
padding: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.card--padding-sm {
|
|
24
|
+
padding: 0.5rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.card--padding-md {
|
|
28
|
+
padding: 1rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.card--padding-lg {
|
|
32
|
+
padding: 1.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.card--padding-xl {
|
|
36
|
+
padding: 2rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Card rounded corners
|
|
40
|
+
.card--rounded {
|
|
41
|
+
border-radius: 0.5rem;
|
|
42
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
-
Licensed under the MIT license.
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
(function ($) {
|
|
8
|
-
var options = { xaxis: { categories: null }, yaxis: { categories: null } };
|
|
9
|
-
function processRawData(plot, series, data, datapoints) {
|
|
10
|
-
var xCategories = series.xaxis.options.mode == "categories",
|
|
11
|
-
yCategories = series.yaxis.options.mode == "categories";
|
|
12
|
-
if (!(xCategories || yCategories)) return;
|
|
13
|
-
var format = datapoints.format;
|
|
14
|
-
if (!format) {
|
|
15
|
-
var s = series;
|
|
16
|
-
format = [];
|
|
17
|
-
format.push({ x: true, number: true, required: true });
|
|
18
|
-
format.push({ y: true, number: true, required: true });
|
|
19
|
-
if (s.bars.show || (s.lines.show && s.lines.fill)) {
|
|
20
|
-
var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero));
|
|
21
|
-
format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
|
|
22
|
-
if (s.bars.horizontal) {
|
|
23
|
-
delete format[format.length - 1].y;
|
|
24
|
-
format[format.length - 1].x = true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
datapoints.format = format;
|
|
28
|
-
}
|
|
29
|
-
for (var m = 0; m < format.length; ++m) {
|
|
30
|
-
if (format[m].x && xCategories) format[m].number = false;
|
|
31
|
-
if (format[m].y && yCategories) format[m].number = false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function getNextIndex(categories) {
|
|
35
|
-
var index = -1;
|
|
36
|
-
for (var v in categories) if (categories[v] > index) index = categories[v];
|
|
37
|
-
return index + 1;
|
|
38
|
-
}
|
|
39
|
-
function categoriesTickGenerator(axis) {
|
|
40
|
-
var res = [];
|
|
41
|
-
for (var label in axis.categories) {
|
|
42
|
-
var v = axis.categories[label];
|
|
43
|
-
if (v >= axis.min && v <= axis.max) res.push([v, label]);
|
|
44
|
-
}
|
|
45
|
-
res.sort(function (a, b) {
|
|
46
|
-
return a[0] - b[0];
|
|
47
|
-
});
|
|
48
|
-
return res;
|
|
49
|
-
}
|
|
50
|
-
function setupCategoriesForAxis(series, axis, datapoints) {
|
|
51
|
-
if (series[axis].options.mode != "categories") return;
|
|
52
|
-
if (!series[axis].categories) {
|
|
53
|
-
var c = {},
|
|
54
|
-
o = series[axis].options.categories || {};
|
|
55
|
-
if ($.isArray(o)) {
|
|
56
|
-
for (var i = 0; i < o.length; ++i) c[o[i]] = i;
|
|
57
|
-
} else {
|
|
58
|
-
for (var v in o) c[v] = o[v];
|
|
59
|
-
}
|
|
60
|
-
series[axis].categories = c;
|
|
61
|
-
}
|
|
62
|
-
if (!series[axis].options.ticks) series[axis].options.ticks = categoriesTickGenerator;
|
|
63
|
-
transformPointsOnAxis(datapoints, axis, series[axis].categories);
|
|
64
|
-
}
|
|
65
|
-
function transformPointsOnAxis(datapoints, axis, categories) {
|
|
66
|
-
var points = datapoints.points,
|
|
67
|
-
ps = datapoints.pointsize,
|
|
68
|
-
format = datapoints.format,
|
|
69
|
-
formatColumn = axis.charAt(0),
|
|
70
|
-
index = getNextIndex(categories);
|
|
71
|
-
for (var i = 0; i < points.length; i += ps) {
|
|
72
|
-
if (points[i] == null) continue;
|
|
73
|
-
for (var m = 0; m < ps; ++m) {
|
|
74
|
-
var val = points[i + m];
|
|
75
|
-
if (val == null || !format[m][formatColumn]) continue;
|
|
76
|
-
if (!(val in categories)) {
|
|
77
|
-
categories[val] = index;
|
|
78
|
-
++index;
|
|
79
|
-
}
|
|
80
|
-
points[i + m] = categories[val];
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function processDatapoints(plot, series, datapoints) {
|
|
85
|
-
setupCategoriesForAxis(series, "xaxis", datapoints);
|
|
86
|
-
setupCategoriesForAxis(series, "yaxis", datapoints);
|
|
87
|
-
}
|
|
88
|
-
function init(plot) {
|
|
89
|
-
plot.hooks.processRawData.push(processRawData);
|
|
90
|
-
plot.hooks.processDatapoints.push(processDatapoints);
|
|
91
|
-
}
|
|
92
|
-
$.plot.plugins.push({ init: init, options: options, name: "categories", version: "1.0" });
|
|
93
|
-
})(jQuery);
|
|
1
|
+
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
+
Licensed under the MIT license.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
(function ($) {
|
|
8
|
+
var options = { xaxis: { categories: null }, yaxis: { categories: null } };
|
|
9
|
+
function processRawData(plot, series, data, datapoints) {
|
|
10
|
+
var xCategories = series.xaxis.options.mode == "categories",
|
|
11
|
+
yCategories = series.yaxis.options.mode == "categories";
|
|
12
|
+
if (!(xCategories || yCategories)) return;
|
|
13
|
+
var format = datapoints.format;
|
|
14
|
+
if (!format) {
|
|
15
|
+
var s = series;
|
|
16
|
+
format = [];
|
|
17
|
+
format.push({ x: true, number: true, required: true });
|
|
18
|
+
format.push({ y: true, number: true, required: true });
|
|
19
|
+
if (s.bars.show || (s.lines.show && s.lines.fill)) {
|
|
20
|
+
var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero));
|
|
21
|
+
format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
|
|
22
|
+
if (s.bars.horizontal) {
|
|
23
|
+
delete format[format.length - 1].y;
|
|
24
|
+
format[format.length - 1].x = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
datapoints.format = format;
|
|
28
|
+
}
|
|
29
|
+
for (var m = 0; m < format.length; ++m) {
|
|
30
|
+
if (format[m].x && xCategories) format[m].number = false;
|
|
31
|
+
if (format[m].y && yCategories) format[m].number = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function getNextIndex(categories) {
|
|
35
|
+
var index = -1;
|
|
36
|
+
for (var v in categories) if (categories[v] > index) index = categories[v];
|
|
37
|
+
return index + 1;
|
|
38
|
+
}
|
|
39
|
+
function categoriesTickGenerator(axis) {
|
|
40
|
+
var res = [];
|
|
41
|
+
for (var label in axis.categories) {
|
|
42
|
+
var v = axis.categories[label];
|
|
43
|
+
if (v >= axis.min && v <= axis.max) res.push([v, label]);
|
|
44
|
+
}
|
|
45
|
+
res.sort(function (a, b) {
|
|
46
|
+
return a[0] - b[0];
|
|
47
|
+
});
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
function setupCategoriesForAxis(series, axis, datapoints) {
|
|
51
|
+
if (series[axis].options.mode != "categories") return;
|
|
52
|
+
if (!series[axis].categories) {
|
|
53
|
+
var c = {},
|
|
54
|
+
o = series[axis].options.categories || {};
|
|
55
|
+
if ($.isArray(o)) {
|
|
56
|
+
for (var i = 0; i < o.length; ++i) c[o[i]] = i;
|
|
57
|
+
} else {
|
|
58
|
+
for (var v in o) c[v] = o[v];
|
|
59
|
+
}
|
|
60
|
+
series[axis].categories = c;
|
|
61
|
+
}
|
|
62
|
+
if (!series[axis].options.ticks) series[axis].options.ticks = categoriesTickGenerator;
|
|
63
|
+
transformPointsOnAxis(datapoints, axis, series[axis].categories);
|
|
64
|
+
}
|
|
65
|
+
function transformPointsOnAxis(datapoints, axis, categories) {
|
|
66
|
+
var points = datapoints.points,
|
|
67
|
+
ps = datapoints.pointsize,
|
|
68
|
+
format = datapoints.format,
|
|
69
|
+
formatColumn = axis.charAt(0),
|
|
70
|
+
index = getNextIndex(categories);
|
|
71
|
+
for (var i = 0; i < points.length; i += ps) {
|
|
72
|
+
if (points[i] == null) continue;
|
|
73
|
+
for (var m = 0; m < ps; ++m) {
|
|
74
|
+
var val = points[i + m];
|
|
75
|
+
if (val == null || !format[m][formatColumn]) continue;
|
|
76
|
+
if (!(val in categories)) {
|
|
77
|
+
categories[val] = index;
|
|
78
|
+
++index;
|
|
79
|
+
}
|
|
80
|
+
points[i + m] = categories[val];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function processDatapoints(plot, series, datapoints) {
|
|
85
|
+
setupCategoriesForAxis(series, "xaxis", datapoints);
|
|
86
|
+
setupCategoriesForAxis(series, "yaxis", datapoints);
|
|
87
|
+
}
|
|
88
|
+
function init(plot) {
|
|
89
|
+
plot.hooks.processRawData.push(processRawData);
|
|
90
|
+
plot.hooks.processDatapoints.push(processDatapoints);
|
|
91
|
+
}
|
|
92
|
+
$.plot.plugins.push({ init: init, options: options, name: "categories", version: "1.0" });
|
|
93
|
+
})(jQuery);
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
-
Licensed under the MIT license.
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
(function ($) {
|
|
8
|
-
var options = { crosshair: { mode: null, color: "rgba(170, 0, 0, 0.80)", lineWidth: 1 } };
|
|
9
|
-
function init(plot) {
|
|
10
|
-
var crosshair = { x: -1, y: -1, locked: false };
|
|
11
|
-
plot.setCrosshair = function setCrosshair(pos) {
|
|
12
|
-
if (!pos) crosshair.x = -1;
|
|
13
|
-
else {
|
|
14
|
-
var o = plot.p2c(pos);
|
|
15
|
-
crosshair.x = Math.max(0, Math.min(o.left, plot.width()));
|
|
16
|
-
crosshair.y = Math.max(0, Math.min(o.top, plot.height()));
|
|
17
|
-
}
|
|
18
|
-
plot.triggerRedrawOverlay();
|
|
19
|
-
};
|
|
20
|
-
plot.clearCrosshair = plot.setCrosshair;
|
|
21
|
-
plot.lockCrosshair = function lockCrosshair(pos) {
|
|
22
|
-
if (pos) plot.setCrosshair(pos);
|
|
23
|
-
crosshair.locked = true;
|
|
24
|
-
};
|
|
25
|
-
plot.unlockCrosshair = function unlockCrosshair() {
|
|
26
|
-
crosshair.locked = false;
|
|
27
|
-
};
|
|
28
|
-
function onMouseOut(e) {
|
|
29
|
-
if (crosshair.locked) return;
|
|
30
|
-
if (crosshair.x != -1) {
|
|
31
|
-
crosshair.x = -1;
|
|
32
|
-
plot.triggerRedrawOverlay();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function onMouseMove(e) {
|
|
36
|
-
if (crosshair.locked) return;
|
|
37
|
-
if (plot.getSelection && plot.getSelection()) {
|
|
38
|
-
crosshair.x = -1;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
var offset = plot.offset();
|
|
42
|
-
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
|
|
43
|
-
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
|
|
44
|
-
plot.triggerRedrawOverlay();
|
|
45
|
-
}
|
|
46
|
-
plot.hooks.bindEvents.push(function (plot, eventHolder) {
|
|
47
|
-
if (!plot.getOptions().crosshair.mode) return;
|
|
48
|
-
eventHolder.mouseout(onMouseOut);
|
|
49
|
-
eventHolder.mousemove(onMouseMove);
|
|
50
|
-
});
|
|
51
|
-
plot.hooks.drawOverlay.push(function (plot, ctx) {
|
|
52
|
-
var c = plot.getOptions().crosshair;
|
|
53
|
-
if (!c.mode) return;
|
|
54
|
-
var plotOffset = plot.getPlotOffset();
|
|
55
|
-
ctx.save();
|
|
56
|
-
ctx.translate(plotOffset.left, plotOffset.top);
|
|
57
|
-
if (crosshair.x != -1) {
|
|
58
|
-
var adj = plot.getOptions().crosshair.lineWidth % 2 ? 0.5 : 0;
|
|
59
|
-
ctx.strokeStyle = c.color;
|
|
60
|
-
ctx.lineWidth = c.lineWidth;
|
|
61
|
-
ctx.lineJoin = "round";
|
|
62
|
-
ctx.beginPath();
|
|
63
|
-
if (c.mode.indexOf("x") != -1) {
|
|
64
|
-
var drawX = Math.floor(crosshair.x) + adj;
|
|
65
|
-
ctx.moveTo(drawX, 0);
|
|
66
|
-
ctx.lineTo(drawX, plot.height());
|
|
67
|
-
}
|
|
68
|
-
if (c.mode.indexOf("y") != -1) {
|
|
69
|
-
var drawY = Math.floor(crosshair.y) + adj;
|
|
70
|
-
ctx.moveTo(0, drawY);
|
|
71
|
-
ctx.lineTo(plot.width(), drawY);
|
|
72
|
-
}
|
|
73
|
-
ctx.stroke();
|
|
74
|
-
}
|
|
75
|
-
ctx.restore();
|
|
76
|
-
});
|
|
77
|
-
plot.hooks.shutdown.push(function (plot, eventHolder) {
|
|
78
|
-
eventHolder.unbind("mouseout", onMouseOut);
|
|
79
|
-
eventHolder.unbind("mousemove", onMouseMove);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
$.plot.plugins.push({ init: init, options: options, name: "crosshair", version: "1.0" });
|
|
83
|
-
})(jQuery);
|
|
1
|
+
/* Javascript plotting library for jQuery, version 0.8.3.
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
|
4
|
+
Licensed under the MIT license.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
(function ($) {
|
|
8
|
+
var options = { crosshair: { mode: null, color: "rgba(170, 0, 0, 0.80)", lineWidth: 1 } };
|
|
9
|
+
function init(plot) {
|
|
10
|
+
var crosshair = { x: -1, y: -1, locked: false };
|
|
11
|
+
plot.setCrosshair = function setCrosshair(pos) {
|
|
12
|
+
if (!pos) crosshair.x = -1;
|
|
13
|
+
else {
|
|
14
|
+
var o = plot.p2c(pos);
|
|
15
|
+
crosshair.x = Math.max(0, Math.min(o.left, plot.width()));
|
|
16
|
+
crosshair.y = Math.max(0, Math.min(o.top, plot.height()));
|
|
17
|
+
}
|
|
18
|
+
plot.triggerRedrawOverlay();
|
|
19
|
+
};
|
|
20
|
+
plot.clearCrosshair = plot.setCrosshair;
|
|
21
|
+
plot.lockCrosshair = function lockCrosshair(pos) {
|
|
22
|
+
if (pos) plot.setCrosshair(pos);
|
|
23
|
+
crosshair.locked = true;
|
|
24
|
+
};
|
|
25
|
+
plot.unlockCrosshair = function unlockCrosshair() {
|
|
26
|
+
crosshair.locked = false;
|
|
27
|
+
};
|
|
28
|
+
function onMouseOut(e) {
|
|
29
|
+
if (crosshair.locked) return;
|
|
30
|
+
if (crosshair.x != -1) {
|
|
31
|
+
crosshair.x = -1;
|
|
32
|
+
plot.triggerRedrawOverlay();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function onMouseMove(e) {
|
|
36
|
+
if (crosshair.locked) return;
|
|
37
|
+
if (plot.getSelection && plot.getSelection()) {
|
|
38
|
+
crosshair.x = -1;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
var offset = plot.offset();
|
|
42
|
+
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
|
|
43
|
+
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
|
|
44
|
+
plot.triggerRedrawOverlay();
|
|
45
|
+
}
|
|
46
|
+
plot.hooks.bindEvents.push(function (plot, eventHolder) {
|
|
47
|
+
if (!plot.getOptions().crosshair.mode) return;
|
|
48
|
+
eventHolder.mouseout(onMouseOut);
|
|
49
|
+
eventHolder.mousemove(onMouseMove);
|
|
50
|
+
});
|
|
51
|
+
plot.hooks.drawOverlay.push(function (plot, ctx) {
|
|
52
|
+
var c = plot.getOptions().crosshair;
|
|
53
|
+
if (!c.mode) return;
|
|
54
|
+
var plotOffset = plot.getPlotOffset();
|
|
55
|
+
ctx.save();
|
|
56
|
+
ctx.translate(plotOffset.left, plotOffset.top);
|
|
57
|
+
if (crosshair.x != -1) {
|
|
58
|
+
var adj = plot.getOptions().crosshair.lineWidth % 2 ? 0.5 : 0;
|
|
59
|
+
ctx.strokeStyle = c.color;
|
|
60
|
+
ctx.lineWidth = c.lineWidth;
|
|
61
|
+
ctx.lineJoin = "round";
|
|
62
|
+
ctx.beginPath();
|
|
63
|
+
if (c.mode.indexOf("x") != -1) {
|
|
64
|
+
var drawX = Math.floor(crosshair.x) + adj;
|
|
65
|
+
ctx.moveTo(drawX, 0);
|
|
66
|
+
ctx.lineTo(drawX, plot.height());
|
|
67
|
+
}
|
|
68
|
+
if (c.mode.indexOf("y") != -1) {
|
|
69
|
+
var drawY = Math.floor(crosshair.y) + adj;
|
|
70
|
+
ctx.moveTo(0, drawY);
|
|
71
|
+
ctx.lineTo(plot.width(), drawY);
|
|
72
|
+
}
|
|
73
|
+
ctx.stroke();
|
|
74
|
+
}
|
|
75
|
+
ctx.restore();
|
|
76
|
+
});
|
|
77
|
+
plot.hooks.shutdown.push(function (plot, eventHolder) {
|
|
78
|
+
eventHolder.unbind("mouseout", onMouseOut);
|
|
79
|
+
eventHolder.unbind("mousemove", onMouseMove);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
$.plot.plugins.push({ init: init, options: options, name: "crosshair", version: "1.0" });
|
|
83
|
+
})(jQuery);
|