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
156d06f7
Commit
156d06f7
authored
May 02, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data.color API - #177
parent
c8cec6f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
c3.js
c3.js
+20
-6
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
156d06f7
...
@@ -2174,7 +2174,7 @@
...
@@ -2174,7 +2174,7 @@
color
=
colors
[
id
](
d
);
color
=
colors
[
id
](
d
);
}
}
// if specified, choose that color
// if specified, choose that color
else
if
(
id
in
colors
)
{
else
if
(
colors
[
id
]
)
{
color
=
colors
[
id
];
color
=
colors
[
id
];
}
}
// if not specified, choose from pattern
// if not specified, choose from pattern
...
@@ -3421,6 +3421,7 @@
...
@@ -3421,6 +3421,7 @@
.
style
(
"opacity"
,
initialOpacity
)
.
style
(
"opacity"
,
initialOpacity
)
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
lineOnMain
)
.
attr
(
"d"
,
lineOnMain
)
.
style
(
"stroke"
,
color
)
.
style
(
"opacity"
,
1
);
.
style
(
"opacity"
,
1
);
mainLine
.
exit
().
transition
().
duration
(
durationForExit
)
mainLine
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
...
@@ -3436,6 +3437,7 @@
...
@@ -3436,6 +3437,7 @@
.
style
(
"opacity"
,
0
)
.
style
(
"opacity"
,
0
)
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
areaOnMain
)
.
attr
(
"d"
,
areaOnMain
)
.
style
(
"fill"
,
color
)
.
style
(
"opacity"
,
orgAreaOpacity
);
.
style
(
"opacity"
,
orgAreaOpacity
);
mainArea
.
exit
().
transition
().
duration
(
durationForExit
)
mainArea
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
...
@@ -3445,11 +3447,13 @@
...
@@ -3445,11 +3447,13 @@
.
data
(
lineOrScatterData
);
.
data
(
lineOrScatterData
);
mainCircle
.
enter
().
append
(
"circle"
)
mainCircle
.
enter
().
append
(
"circle"
)
.
attr
(
"class"
,
classCircle
)
.
attr
(
"class"
,
classCircle
)
.
attr
(
"r"
,
pointR
);
.
attr
(
"r"
,
pointR
)
.
style
(
"fill"
,
color
);
mainCircle
mainCircle
.
style
(
"opacity"
,
initialOpacity
)
.
style
(
"opacity"
,
initialOpacity
)
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
opacityForCircle
)
.
style
(
'opacity'
,
opacityForCircle
)
.
style
(
"fill"
,
color
)
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
.
attr
(
"cy"
,
__axis_rotated
?
circleX
:
circleY
);
.
attr
(
"cy"
,
__axis_rotated
?
circleX
:
circleY
);
mainCircle
.
exit
().
remove
();
mainCircle
.
exit
().
remove
();
...
@@ -3460,6 +3464,7 @@
...
@@ -3460,6 +3464,7 @@
.
attr
(
"class"
,
classText
)
.
attr
(
"class"
,
classText
)
.
attr
(
'text-anchor'
,
function
(
d
)
{
return
__axis_rotated
?
(
d
.
value
<
0
?
'end'
:
'start'
)
:
'middle'
;
})
.
attr
(
'text-anchor'
,
function
(
d
)
{
return
__axis_rotated
?
(
d
.
value
<
0
?
'end'
:
'start'
)
:
'middle'
;
})
.
style
(
"stroke"
,
'none'
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill"
,
color
)
.
style
(
"fill-opacity"
,
0
);
.
style
(
"fill-opacity"
,
0
);
mainText
mainText
.
text
(
function
(
d
)
{
return
formatByAxisId
(
d
.
id
)(
d
.
value
,
d
.
id
);
})
.
text
(
function
(
d
)
{
return
formatByAxisId
(
d
.
id
)(
d
.
value
,
d
.
id
);
})
...
@@ -3467,6 +3472,7 @@
...
@@ -3467,6 +3472,7 @@
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
.
attr
(
'x'
,
xForText
)
.
attr
(
'x'
,
xForText
)
.
attr
(
'y'
,
yForText
)
.
attr
(
'y'
,
yForText
)
.
style
(
"fill"
,
color
)
.
style
(
"fill-opacity"
,
opacityForText
);
.
style
(
"fill-opacity"
,
opacityForText
);
mainText
.
exit
()
mainText
.
exit
()
.
transition
().
duration
(
durationForExit
)
.
transition
().
duration
(
durationForExit
)
...
@@ -3541,6 +3547,7 @@
...
@@ -3541,6 +3547,7 @@
return
function
(
t
)
{
return
getArc
(
interpolate
(
t
),
true
);
};
return
function
(
t
)
{
return
getArc
(
interpolate
(
t
),
true
);
};
})
})
.
attr
(
"transform"
,
withTransform
?
"scale(1)"
:
""
)
.
attr
(
"transform"
,
withTransform
?
"scale(1)"
:
""
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
data
);
})
.
style
(
"opacity"
,
1
)
.
style
(
"opacity"
,
1
)
.
call
(
endall
,
function
()
{
.
call
(
endall
,
function
()
{
transiting
=
false
;
transiting
=
false
;
...
@@ -3783,8 +3790,7 @@
...
@@ -3783,8 +3790,7 @@
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
style
(
"pointer-events"
,
"none"
);
.
style
(
"pointer-events"
,
"none"
);
mainTextEnter
.
append
(
'g'
)
mainTextEnter
.
append
(
'g'
)
.
attr
(
'class'
,
classTexts
)
.
attr
(
'class'
,
classTexts
);
.
style
(
"fill"
,
color
);
//-- Bar --//
//-- Bar --//
mainBarUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
mainBarUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
...
@@ -3818,7 +3824,6 @@
...
@@ -3818,7 +3824,6 @@
.
attr
(
"class"
,
function
(
d
)
{
return
generateClass
(
CLASS
.
selectedCircles
,
d
.
id
);
});
.
attr
(
"class"
,
function
(
d
)
{
return
generateClass
(
CLASS
.
selectedCircles
,
d
.
id
);
});
mainLineEnter
.
append
(
'g'
)
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
classCircles
)
.
attr
(
"class"
,
classCircles
)
.
style
(
"fill"
,
color
)
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
// Update date for selected circles
// Update date for selected circles
targets
.
forEach
(
function
(
t
)
{
targets
.
forEach
(
function
(
t
)
{
...
@@ -4131,7 +4136,7 @@
...
@@ -4131,7 +4136,7 @@
l
.
append
(
'rect'
)
l
.
append
(
'rect'
)
.
attr
(
"class"
,
CLASS
.
legendItemTile
)
.
attr
(
"class"
,
CLASS
.
legendItemTile
)
.
style
(
"pointer-events"
,
"none"
)
.
style
(
"pointer-events"
,
"none"
)
.
style
(
'fill'
,
function
(
id
)
{
return
color
(
id
);
}
)
.
style
(
'fill'
,
color
)
.
attr
(
'x'
,
isLegendRight
?
xForLegendText
:
-
200
)
.
attr
(
'x'
,
isLegendRight
?
xForLegendText
:
-
200
)
.
attr
(
'y'
,
isLegendRight
?
-
200
:
yForLegend
)
.
attr
(
'y'
,
isLegendRight
?
-
200
:
yForLegend
)
.
attr
(
'width'
,
10
)
.
attr
(
'width'
,
10
)
...
@@ -4154,6 +4159,7 @@
...
@@ -4154,6 +4159,7 @@
legend
.
selectAll
(
'rect.'
+
CLASS
.
legendItemTile
)
legend
.
selectAll
(
'rect.'
+
CLASS
.
legendItemTile
)
.
data
(
targetIds
)
.
data
(
targetIds
)
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
style
(
'fill'
,
color
)
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'y'
,
yForLegend
);
.
attr
(
'y'
,
yForLegend
);
...
@@ -4487,6 +4493,14 @@
...
@@ -4487,6 +4493,14 @@
updateLegend
(
mapToIds
(
c3
.
data
.
targets
),
{
withTransition
:
true
});
updateLegend
(
mapToIds
(
c3
.
data
.
targets
),
{
withTransition
:
true
});
return
__data_names
;
return
__data_names
;
};
};
c3
.
data
.
colors
=
function
(
colors
)
{
if
(
!
arguments
.
length
)
{
return
__data_colors
;
}
Object
.
keys
(
colors
).
forEach
(
function
(
id
)
{
__data_colors
[
id
]
=
colors
[
id
];
});
redraw
({
withLegend
:
true
});
return
__data_colors
;
};
c3
.
x
=
function
(
x
)
{
c3
.
x
=
function
(
x
)
{
if
(
arguments
.
length
)
{
if
(
arguments
.
length
)
{
...
...
c3.min.js
View file @
156d06f7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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