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
Evgeny
c3-closed
Commits
0008bae7
Commit
0008bae7
authored
Apr 06, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/joshpurvis/c3
into joshpurvis-master
parents
821f0736
ef71ad5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
c3.js
c3.js
+20
-15
No files found.
c3.js
View file @
0008bae7
...
...
@@ -1925,9 +1925,14 @@
colors
=
_colors
,
pattern
=
notEmpty
(
_pattern
)
?
_pattern
:
[
'#1f77b4'
,
'#ff7f0e'
,
'#2ca02c'
,
'#d62728'
,
'#9467bd'
,
'#8c564b'
,
'#e377c2'
,
'#7f7f7f'
,
'#bcbd22'
,
'#17becf'
];
//same as d3.scale.category10()
return
function
(
id
)
{
return
function
(
d
)
{
var
id
=
d
.
id
||
d
;
// if callback function is provided
if
(
colors
[
id
]
instanceof
Function
)
{
return
colors
[
id
](
d
);
}
// if specified, choose that color
if
(
id
in
colors
)
{
return
_
colors
[
id
];
}
if
(
id
in
colors
)
{
return
colors
[
id
];
}
// if not specified, choose from pattern
if
(
ids
.
indexOf
(
id
)
===
-
1
)
{
...
...
@@ -2008,7 +2013,7 @@
.
attr
(
"class"
,
function
()
{
return
generateClass
(
CLASS
.
selectedCircle
,
i
);
})
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
.
attr
(
"cy"
,
__axis_rotated
?
circleX
:
circleY
)
.
attr
(
"stroke"
,
function
()
{
return
color
(
d
.
id
);
})
.
attr
(
"stroke"
,
function
()
{
return
color
(
d
);
})
.
attr
(
"r"
,
__point_select_r
*
1.4
)
.
transition
().
duration
(
100
)
.
attr
(
"r"
,
__point_select_r
);
...
...
@@ -2026,11 +2031,11 @@
function
selectBar
(
target
,
d
)
{
__data_onselected
(
d
,
target
.
node
());
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
d3
.
rgb
(
color
(
d
.
id
)).
darker
(
1
);
});
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
d3
.
rgb
(
color
(
d
)).
darker
(
1
);
});
}
function
unselectBar
(
target
,
d
)
{
__data_onunselected
(
d
,
target
.
node
());
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
color
(
d
.
id
);
});
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
color
(
d
);
});
}
function
toggleBar
(
selected
,
target
,
d
,
i
)
{
selected
?
selectBar
(
target
,
d
,
i
)
:
unselectBar
(
target
,
d
,
i
);
...
...
@@ -3072,7 +3077,7 @@
.
attr
(
'd'
,
drawBar
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"opacity"
,
0
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
})
.
attr
(
"class"
,
classBar
);
mainBar
.
style
(
"opacity"
,
initialOpacity
)
...
...
@@ -3182,7 +3187,7 @@
contextBar
.
enter
().
append
(
'path'
)
.
attr
(
'd'
,
drawBarOnSub
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
})
.
attr
(
"class"
,
classBar
);
contextBar
.
style
(
"opacity"
,
initialOpacity
)
...
...
@@ -3363,7 +3368,7 @@
.
style
(
"pointer-events"
,
"none"
);
mainTextEnter
.
append
(
'g'
)
.
attr
(
'class'
,
classTexts
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
});
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
});
//-- Bar --//
mainBarUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartBars
)
...
...
@@ -3375,7 +3380,7 @@
// Bars for each data
mainBarEnter
.
append
(
'g'
)
.
attr
(
"class"
,
classBars
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
})
.
style
(
"stroke"
,
"none"
)
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
...
...
@@ -3390,18 +3395,18 @@
mainLineEnter
.
append
(
"path"
)
.
attr
(
"class"
,
classLine
)
.
style
(
"opacity"
,
0
)
.
style
(
"stroke"
,
function
(
d
)
{
return
color
(
d
.
id
);
});
.
style
(
"stroke"
,
function
(
d
)
{
return
color
(
d
);
});
// Areas
mainLineEnter
.
append
(
"path"
)
.
attr
(
"class"
,
classArea
)
.
style
(
"opacity"
,
function
()
{
orgAreaOpacity
=
+
d3
.
select
(
this
).
style
(
'opacity'
);
return
0
;
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
});
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
});
// Circles for each data point on lines
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
generateClass
(
CLASS
.
selectedCircles
,
d
.
id
);
});
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
classCircles
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
})
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
// Update date for selected circles
targets
.
forEach
(
function
(
t
)
{
...
...
@@ -3421,7 +3426,7 @@
mainPieEnter
.
append
(
"path"
)
.
attr
(
"class"
,
classArc
)
.
style
(
"opacity"
,
0
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
data
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
data
);
})
.
style
(
"cursor"
,
function
(
d
)
{
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
})
.
each
(
function
(
d
)
{
this
.
_current
=
d
;
})
.
on
(
'mouseover'
,
function
(
d
,
i
)
{
...
...
@@ -3465,7 +3470,7 @@
// Bars for each data
contextBarEnter
.
append
(
'g'
)
.
attr
(
"class"
,
classBars
)
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
.
id
);
});
.
style
(
"fill"
,
function
(
d
)
{
return
color
(
d
);
});
//-- Line --//
contextLineUpdate
=
context
.
select
(
'.'
+
CLASS
.
chartLines
)
...
...
@@ -3477,7 +3482,7 @@
contextLineEnter
.
append
(
"path"
)
.
attr
(
"class"
,
classLine
)
.
style
(
"opacity"
,
0
)
.
style
(
"stroke"
,
function
(
d
)
{
return
color
(
d
.
id
);
});
.
style
(
"stroke"
,
function
(
d
)
{
return
color
(
d
);
});
}
/*-- Show --*/
...
...
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