Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charts
c3-closed
Commits
69b79fc1
Commit
69b79fc1
authored
Jul 01, 2016
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pie values absolute. Now -100 and 100 are treated the same way. Fix issue CHRT-208
parent
a0057237
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
1 deletion
+33
-1
Makefile
Makefile
+1
-1
c3.js
c3.js
+16
-0
c3.min.js
c3.min.js
+0
-0
arc.js
src/arc.js
+9
-0
util.js
src/util.js
+7
-0
No files found.
Makefile
View file @
69b79fc1
all
:
all
:
grunt
test
:
...
...
c3.js
View file @
69b79fc1
...
...
@@ -5333,6 +5333,9 @@
c3_chart_internal_fn
.
updateArc
=
function
()
{
var
$$
=
this
;
$$
.
makeTargetsValuesAbsolute
(
$$
.
data
.
targets
);
$$
.
svgArc
=
$$
.
getSvgArc
();
$$
.
svgArcExpanded
=
$$
.
getSvgArcExpanded
();
$$
.
svgArcExpandedSub
=
$$
.
getSvgArcExpanded
(
0.98
);
...
...
@@ -5342,14 +5345,17 @@
var
$$
=
this
,
config
=
$$
.
config
,
found
=
false
,
index
=
0
,
gMin
=
config
.
gauge_min
,
gMax
=
config
.
gauge_max
,
gTic
,
gValue
;
$$
.
pie
(
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
)).
forEach
(
function
(
t
)
{
if
(
!
found
&&
t
.
data
.
id
===
d
.
data
.
id
)
{
found
=
true
;
d
=
t
;
d
.
index
=
index
;
}
index
++
;
});
if
(
isNaN
(
d
.
endAngle
))
{
d
.
endAngle
=
d
.
startAngle
;
}
...
...
@@ -5530,6 +5536,7 @@
classChartArc
=
$$
.
classChartArc
.
bind
(
$$
),
classArcs
=
$$
.
classArcs
.
bind
(
$$
),
classFocus
=
$$
.
classFocus
.
bind
(
$$
);
mainPieUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartArcs
).
selectAll
(
'.'
+
CLASS
.
chartArc
)
.
data
(
$$
.
pie
(
targets
))
.
attr
(
"class"
,
function
(
d
)
{
return
classChartArc
(
d
)
+
classFocus
(
d
.
data
);
});
...
...
@@ -5588,6 +5595,7 @@
interpolate
=
d3
.
interpolate
(
this
.
_current
,
updated
);
this
.
_current
=
interpolate
(
0
);
var
interpolated
=
interpolate
(
1
);
interpolated
.
data
=
d
.
data
;
// data.id will be updated by interporator
return
$$
.
getArc
(
interpolated
,
true
);
})
...
...
@@ -5596,6 +5604,7 @@
return
$$
.
levelColor
?
$$
.
levelColor
(
d
.
data
.
values
[
0
].
value
)
:
$$
.
color
(
d
.
data
.
id
);
})
// Where gauge reading color would receive customization.
.
style
(
"opacity"
,
1
);
mainArc
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
remove
();
...
...
@@ -6666,6 +6675,13 @@
},
isNode
=
function
(){
return
typeof
process
===
'object'
;
},
makeTargetsValuesAbsolute
=
c3_chart_internal_fn
.
makeTargetsValuesAbsolute
=
function
(
targets
){
targets
.
forEach
(
function
(
target
){
target
.
values
.
forEach
(
function
(
value
){
value
.
value
=
Math
.
abs
(
value
.
value
);
});
});
};
...
...
c3.min.js
View file @
69b79fc1
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/arc.js
View file @
69b79fc1
...
...
@@ -21,6 +21,9 @@ c3_chart_internal_fn.updateRadius = function () {
c3_chart_internal_fn
.
updateArc
=
function
()
{
var
$$
=
this
;
$$
.
makeTargetsValuesAbsolute
(
$$
.
data
.
targets
);
$$
.
svgArc
=
$$
.
getSvgArc
();
$$
.
svgArcExpanded
=
$$
.
getSvgArcExpanded
();
$$
.
svgArcExpandedSub
=
$$
.
getSvgArcExpanded
(
0.98
);
...
...
@@ -30,14 +33,17 @@ c3_chart_internal_fn.updateAngle = function (d) {
var
$$
=
this
,
config
=
$$
.
config
,
found
=
false
,
index
=
0
,
gMin
=
config
.
gauge_min
,
gMax
=
config
.
gauge_max
,
gTic
,
gValue
;
$$
.
pie
(
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
)).
forEach
(
function
(
t
)
{
if
(
!
found
&&
t
.
data
.
id
===
d
.
data
.
id
)
{
found
=
true
;
d
=
t
;
d
.
index
=
index
;
}
index
++
;
});
if
(
isNaN
(
d
.
endAngle
))
{
d
.
endAngle
=
d
.
startAngle
;
}
...
...
@@ -218,6 +224,7 @@ c3_chart_internal_fn.updateTargetsForArc = function (targets) {
classChartArc
=
$$
.
classChartArc
.
bind
(
$$
),
classArcs
=
$$
.
classArcs
.
bind
(
$$
),
classFocus
=
$$
.
classFocus
.
bind
(
$$
);
mainPieUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartArcs
).
selectAll
(
'.'
+
CLASS
.
chartArc
)
.
data
(
$$
.
pie
(
targets
))
.
attr
(
"class"
,
function
(
d
)
{
return
classChartArc
(
d
)
+
classFocus
(
d
.
data
);
});
...
...
@@ -276,6 +283,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
interpolate
=
d3
.
interpolate
(
this
.
_current
,
updated
);
this
.
_current
=
interpolate
(
0
);
var
interpolated
=
interpolate
(
1
);
interpolated
.
data
=
d
.
data
;
// data.id will be updated by interporator
return
$$
.
getArc
(
interpolated
,
true
);
})
...
...
@@ -284,6 +292,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
return
$$
.
levelColor
?
$$
.
levelColor
(
d
.
data
.
values
[
0
].
value
)
:
$$
.
color
(
d
.
data
.
id
);
})
// Where gauge reading color would receive customization.
.
style
(
"opacity"
,
1
);
mainArc
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
remove
();
...
...
src/util.js
View file @
69b79fc1
...
...
@@ -113,5 +113,12 @@ var isValue = c3_chart_internal_fn.isValue = function (v) {
},
isNode
=
function
(){
return
typeof
process
===
'object'
;
},
makeTargetsValuesAbsolute
=
c3_chart_internal_fn
.
makeTargetsValuesAbsolute
=
function
(
targets
){
targets
.
forEach
(
function
(
target
){
target
.
values
.
forEach
(
function
(
value
){
value
.
value
=
Math
.
abs
(
value
.
value
);
});
});
};
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