Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,695
Issues
1,695
List
Boards
Labels
Service Desk
Milestones
Merge Requests
87
Merge Requests
87
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
f991cf76
Commit
f991cf76
authored
Aug 09, 2018
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js/{generic,numeric}_axis.js: refactor, re-factorise populateMapping()
See
#2700
. Closes
#2905
. Yeah.
parent
f412e49f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
browser/js/generic_axis.js
browser/js/generic_axis.js
+17
-6
browser/js/numerical_axis.js
browser/js/numerical_axis.js
+7
-18
No files found.
browser/js/generic_axis.js
View file @
f991cf76
...
...
@@ -114,19 +114,30 @@ GenericAxis.prototype = {
}
},
populateValueMapping
:
function
()
{
populateValueMapping
:
function
(
round
)
{
for
(
var
idx
in
this
.
values
)
{
var
value
=
this
.
values
[
idx
];
// if (value.isVirtual())
// continue ; // ? pas toujours ?
var
convert
=
this
.
applyConverter
(
value
);
if
(
typeof
convert
!==
'
undefined
'
)
{
if
(
typeof
round
!==
'
undefined
'
)
convert
=
nice_ceil
(
convert
,
round
)
if
(
typeof
convert
==
"
undefined
"
||
convert
==
undefined
||
convert
==
"
undefined
"
)
{
if
(
this
.
can_undefined
)
{
if
(
typeof
this
.
value_mapping
[
"
?
"
]
===
'
undefined
'
)
this
.
value_mapping
[
"
?
"
]
=
[];
this
.
value_mapping
[
"
?
"
].
push
(
value
);
}
}
else
{
this
.
value_mapping
[
convert
]
=
this
.
value_mapping
[
convert
]
||
[]
this
.
value_mapping
[
convert
].
push
(
value
);
}
else
if
(
this
.
can_undefined
){
if
(
typeof
this
.
value_mapping
[
"
?
"
]
===
'
undefined
'
)
this
.
value_mapping
[
"
?
"
]
=
[];
this
.
value_mapping
[
"
?
"
].
push
(
value
);
}
}
},
...
...
browser/js/numerical_axis.js
View file @
f991cf76
...
...
@@ -33,7 +33,7 @@
function
NumericalAxis
(
model
,
reverse
,
can_undefined
)
{
this
.
m
=
model
;
this
.
labels
=
[];
this
.
clon
es
=
[];
this
.
valu
es
=
[];
this
.
value_mapping
=
{};
this
.
reverse
=
reverse
;
GenericAxis
.
call
(
this
,
reverse
,
can_undefined
);
...
...
@@ -54,7 +54,7 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
* */
NumericalAxis
.
prototype
.
init
=
function
(
clones
,
fct
,
labels
,
sort
,
default_min
,
default_max
,
use_log
,
display_label
){
this
.
reset
();
this
.
clon
es
=
clones
;
this
.
valu
es
=
clones
;
use_log
=
typeof
use_log
!==
'
undefined
'
?
use_log
:
false
;
this
.
use_log
=
use_log
;
display_label
=
typeof
display_label
!==
'
undefined
'
?
display_label
:
true
;
...
...
@@ -80,9 +80,9 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
if
(
typeof
max
===
'
function
'
)
max
=
max
();
if
(
typeof
labels
==
"
undefined
"
)
{
for
(
var
i
in
this
.
clon
es
){
if
(
!
this
.
clon
es
[
i
].
isVirtual
())
{
var
tmp
=
this
.
applyConverter
(
this
.
clon
es
[
i
]);
for
(
var
i
in
this
.
valu
es
){
if
(
!
this
.
valu
es
[
i
].
isVirtual
())
{
var
tmp
=
this
.
applyConverter
(
this
.
valu
es
[
i
]);
if
(
typeof
tmp
!=
"
undefined
"
&&
!
isNaN
(
tmp
)){
if
(
tmp
>
max
||
typeof
max
==
"
undefined
"
)
max
=
tmp
;
...
...
@@ -169,19 +169,8 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
this
.
value_mapping
[
nice_ceil
(
m
,
this
.
step_bar
)]
=
[]
// Fill value_mapping
for
(
var
idx
in
this
.
clones
)
{
var
clone
=
this
.
clones
[
idx
];
if
(
!
clone
.
isVirtual
())
{
var
value
=
nice_ceil
(
this
.
applyConverter
(
clone
),
this
.
step_bar
);
if
(
typeof
value
==
"
undefined
"
||
value
==
undefined
||
value
==
"
undefined
"
)
{
if
(
this
.
can_undefined
)
this
.
value_mapping
[
"
?
"
].
push
(
clone
);
}
else
{
this
.
value_mapping
[
value
]
=
this
.
value_mapping
[
value
]
||
[]
this
.
value_mapping
[
value
].
push
(
clone
);
}
}
}
this
.
populateValueMapping
(
this
.
step_bar
)
this
.
sortValueMapping
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment