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
841f76b1
Commit
841f76b1
authored
Jul 27, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make subchart plugable
parent
476aa983
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
408 additions
and
394 deletions
+408
-394
c3.js
c3.js
+408
-394
No files found.
c3.js
View file @
841f76b1
...
@@ -288,20 +288,6 @@
...
@@ -288,20 +288,6 @@
// should be define in c3.brush.js (c3.subchart.js?)
c3_chart_internal_fn
.
initBrush
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
;
// TODO: this should be pluggable
$$
.
brush
=
d3
.
svg
.
brush
().
on
(
"brush"
,
$$
.
redrawForBrush
);
$$
.
brush
.
update
=
function
()
{
if
(
$$
.
context
)
{
$$
.
context
.
select
(
'.'
+
$$
.
CLASS
.
brush
).
call
(
this
);
}
return
this
;
};
$$
.
brush
.
scale
=
function
(
scale
)
{
return
$$
.
config
.
axis_rotated
?
this
.
y
(
scale
)
:
this
.
x
(
scale
);
};
};
// should be define in c3.zoom.js
// should be define in c3.zoom.js
c3_chart_internal_fn
.
initZoom
=
function
()
{
c3_chart_internal_fn
.
initZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
;
var
$$
=
this
,
d3
=
$$
.
d3
;
...
@@ -420,8 +406,12 @@
...
@@ -420,8 +406,12 @@
$$
.
withoutFadeIn
=
{};
$$
.
withoutFadeIn
=
{};
if
(
isFunction
(
initPie
))
{
initPie
.
call
(
$$
);
}
if
(
isFunctionType
(
initPie
))
{
initPie
.
call
(
$$
);
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
if
(
isFunctionType
(
typeof
initBrush
))
{
initBrush
.
call
(
$$
);
}
else
{
$$
.
axes
.
subx
=
d3
.
selectAll
([]);
}
if
(
$$
.
initZoom
)
{
$$
.
initZoom
();
}
if
(
$$
.
initZoom
)
{
$$
.
initZoom
();
}
$$
.
selectChart
=
d3
.
select
(
c
.
bindto
);
$$
.
selectChart
=
d3
.
select
(
c
.
bindto
);
...
@@ -446,7 +436,7 @@
...
@@ -446,7 +436,7 @@
}
}
// when gauge, hide legend // TODO: fix
// when gauge, hide legend // TODO: fix
if
(
$$
.
hasGaugeType
(
$$
.
data
.
targets
))
{
if
(
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
))
{
c
.
legend_show
=
false
;
c
.
legend_show
=
false
;
}
}
...
@@ -466,7 +456,7 @@
...
@@ -466,7 +456,7 @@
$$
.
orgXDomain
=
$$
.
x
.
domain
();
$$
.
orgXDomain
=
$$
.
x
.
domain
();
// Set initialized scales to brush and zoom
// Set initialized scales to brush and zoom
$$
.
brush
.
scale
(
$$
.
subX
);
if
(
$$
.
brush
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
}
if
(
c
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
if
(
c
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
/*-- Basic Elements --*/
/*-- Basic Elements --*/
...
@@ -486,12 +476,9 @@
...
@@ -486,12 +476,9 @@
// Define regions
// Define regions
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
main
);
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
main
);
$$
.
context
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
context
);
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
legend
);
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
legend
);
if
(
!
c
.
subchart_show
)
{
if
(
isFunctionType
(
typeof
initSubchart
))
{
initSubchart
.
call
(
$$
);
}
$$
.
context
.
style
(
'visibility'
,
'hidden'
);
}
if
(
!
c
.
legend_show
)
{
if
(
!
c
.
legend_show
)
{
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
...
@@ -562,8 +549,8 @@
...
@@ -562,8 +549,8 @@
.
attr
(
"class"
,
CLASS
.
chartLines
);
.
attr
(
"class"
,
CLASS
.
chartLines
);
// Define g for arc chart area
// Define g for arc chart area
if
(
isFunction
(
initArc
))
{
initArc
.
call
(
$$
);
}
if
(
isFunction
Type
(
initArc
))
{
initArc
.
call
(
$$
);
}
if
(
isFunction
(
initGauge
))
{
initGauge
.
call
(
$$
);
}
if
(
isFunction
Type
(
initGauge
))
{
initGauge
.
call
(
$$
);
}
$$
.
main
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
$$
.
main
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
chartTexts
);
.
attr
(
"class"
,
CLASS
.
chartTexts
);
...
@@ -612,36 +599,6 @@
...
@@ -612,36 +599,6 @@
.
attr
(
"transform"
,
c
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"transform"
,
c
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
function
()
{
return
$$
.
textAnchorForY2AxisLabel
();
});
.
style
(
"text-anchor"
,
function
()
{
return
$$
.
textAnchorForY2AxisLabel
();
});
/*-- Context Region --*/
// Define g for chart area
$$
.
context
.
append
(
'g'
)
.
attr
(
"clip-path"
,
$$
.
clipPath
)
.
attr
(
'class'
,
CLASS
.
chart
);
// Define g for bar chart area
$$
.
context
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
chartBars
);
// Define g for line chart area
$$
.
context
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
chartLines
);
// Add extent rect for Brush
$$
.
context
.
append
(
"g"
)
.
attr
(
"clip-path"
,
$$
.
clipPath
)
.
attr
(
"class"
,
CLASS
.
brush
)
.
call
(
$$
.
brush
)
.
selectAll
(
"rect"
)
.
attr
(
c
.
axis_rotated
?
"width"
:
"height"
,
c
.
axis_rotated
?
$$
.
width2
:
$$
.
height2
);
// ATTENTION: This must be called AFTER chart added
// Add Axis
$$
.
axes
.
subx
=
$$
.
context
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axisX
)
.
attr
(
"transform"
,
$$
.
translate
.
subx
)
.
attr
(
"clip-path"
,
c
.
axis_rotated
?
""
:
$$
.
clipPathForXAxis
);
// Set targets
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
$$
.
updateTargets
(
$$
.
data
.
targets
);
...
@@ -667,7 +624,7 @@
...
@@ -667,7 +624,7 @@
}
}
$$
.
tooltip
.
html
(
c
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
$$
.
tooltip
.
html
(
c
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
return
$$
.
addName
(
d
.
values
[
c
.
tooltip_init_x
]);
return
$$
.
addName
(
d
.
values
[
c
.
tooltip_init_x
]);
}),
$$
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
$$
.
hasArcType
(
$$
.
data
.
targets
)),
$$
.
color
));
}),
$$
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
)),
$$
.
color
));
$$
.
tooltip
.
style
(
"top"
,
c
.
tooltip_init_position
.
top
)
$$
.
tooltip
.
style
(
"top"
,
c
.
tooltip_init_position
.
top
)
.
style
(
"left"
,
c
.
tooltip_init_position
.
left
)
.
style
(
"left"
,
c
.
tooltip_init_position
.
left
)
.
style
(
"display"
,
"block"
);
.
style
(
"display"
,
"block"
);
...
@@ -718,7 +675,7 @@
...
@@ -718,7 +675,7 @@
var
$$
=
this
,
c
=
$$
.
config
;
var
$$
=
this
,
c
=
$$
.
config
;
var
legendHeight
=
$$
.
getLegendHeight
(),
legendWidth
=
$$
.
getLegendWidth
(),
var
legendHeight
=
$$
.
getLegendHeight
(),
legendWidth
=
$$
.
getLegendWidth
(),
legendHeightForBottom
=
$$
.
isLegendRight
||
$$
.
isLegendInset
?
0
:
legendHeight
,
legendHeightForBottom
=
$$
.
isLegendRight
||
$$
.
isLegendInset
?
0
:
legendHeight
,
hasArc
=
$$
.
hasArcType
(
$$
.
data
.
targets
),
hasArc
=
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
),
xAxisHeight
=
c
.
axis_rotated
||
hasArc
?
0
:
$$
.
getHorizontalAxisHeight
(
'x'
),
xAxisHeight
=
c
.
axis_rotated
||
hasArc
?
0
:
$$
.
getHorizontalAxisHeight
(
'x'
),
subchartHeight
=
c
.
subchart_show
&&
!
hasArc
?
(
c
.
subchart_size_height
+
xAxisHeight
)
:
0
;
subchartHeight
=
c
.
subchart_show
&&
!
hasArc
?
(
c
.
subchart_size_height
+
xAxisHeight
)
:
0
;
...
@@ -778,7 +735,7 @@
...
@@ -778,7 +735,7 @@
// for arc
// for arc
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
if
(
isFunction
(
updateRadius
))
{
updateRadius
.
call
(
$$
);
}
if
(
isFunction
Type
(
updateRadius
))
{
updateRadius
.
call
(
$$
);
}
if
(
$$
.
isLegendRight
&&
hasArc
)
{
if
(
$$
.
isLegendRight
&&
hasArc
)
{
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
...
@@ -787,94 +744,66 @@
...
@@ -787,94 +744,66 @@
c3_chart_internal_fn
.
updateTargets
=
function
(
targets
)
{
c3_chart_internal_fn
.
updateTargets
=
function
(
targets
)
{
var
mainLineEnter
,
mainLineUpdate
,
mainBarEnter
,
mainBarUpdate
,
mainTextUpdate
,
mainTextEnter
;
var
mainLineEnter
,
mainLineUpdate
,
mainBarEnter
,
mainBarUpdate
,
mainTextUpdate
,
mainTextEnter
;
var
contextLineEnter
,
contextLineUpdate
,
contextBarEnter
,
contextBarUpdate
;
var
$$
=
this
,
main
=
$$
.
main
,
CLASS
=
$$
.
CLASS
;
var
$$
=
this
,
main
=
$$
.
main
,
context
=
$$
.
context
,
CLASS
=
$$
.
CLASS
;
/*-- Main --*/
/*-- Main --*/
//-- Text --//
//-- Text --//
mainTextUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartTexts
).
selectAll
(
'.'
+
CLASS
.
chartText
)
mainTextUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartTexts
).
selectAll
(
'.'
+
CLASS
.
chartText
)
.
data
(
targets
)
.
data
(
targets
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartText
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classChartText
.
call
(
$$
,
d
);
});
mainTextEnter
=
mainTextUpdate
.
enter
().
append
(
'g'
)
mainTextEnter
=
mainTextUpdate
.
enter
().
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartText
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classChartText
.
call
(
$$
,
d
);
})
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
style
(
"pointer-events"
,
"none"
);
.
style
(
"pointer-events"
,
"none"
);
mainTextEnter
.
append
(
'g'
)
mainTextEnter
.
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classTexts
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classTexts
.
call
(
$$
,
d
);
});
//-- Bar --//
//-- Bar --//
mainBarUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
mainBarUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
.
data
(
targets
)
.
data
(
targets
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartBar
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classChartBar
.
call
(
$$
,
d
);
});
mainBarEnter
=
mainBarUpdate
.
enter
().
append
(
'g'
)
mainBarEnter
=
mainBarUpdate
.
enter
().
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartBar
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classChartBar
.
call
(
$$
,
d
);
})
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
style
(
"pointer-events"
,
"none"
);
.
style
(
"pointer-events"
,
"none"
);
// Bars for each data
// Bars for each data
mainBarEnter
.
append
(
'g'
)
mainBarEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classBars
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classBars
.
call
(
$$
,
d
);
})
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
//-- Line --//
//-- Line --//
mainLineUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartLines
).
selectAll
(
'.'
+
CLASS
.
chartLine
)
mainLineUpdate
=
main
.
select
(
'.'
+
CLASS
.
chartLines
).
selectAll
(
'.'
+
CLASS
.
chartLine
)
.
data
(
targets
)
.
data
(
targets
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartLine
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classChartLine
.
call
(
$$
,
d
);
});
mainLineEnter
=
mainLineUpdate
.
enter
().
append
(
'g'
)
mainLineEnter
=
mainLineUpdate
.
enter
().
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classChartLine
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classChartLine
.
call
(
$$
,
d
);
})
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
style
(
"pointer-events"
,
"none"
);
.
style
(
"pointer-events"
,
"none"
);
// Lines for each data
// Lines for each data
mainLineEnter
.
append
(
'g'
)
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classLines
(
d
);
});
.
attr
(
"class"
,
function
(
d
)
{
return
classLines
.
call
(
$$
,
d
);
});
// Areas
// Areas
mainLineEnter
.
append
(
'g'
)
mainLineEnter
.
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classAreas
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classAreas
.
call
(
$$
,
d
);
});
// Circles for each data point on lines
// Circles for each data point on lines
mainLineEnter
.
append
(
'g'
)
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
generateClass
(
CLASS
.
selectedCircles
,
d
.
id
);
});
.
attr
(
"class"
,
function
(
d
)
{
return
generateClass
.
call
(
$$
,
CLASS
.
selectedCircles
,
d
.
id
);
});
mainLineEnter
.
append
(
'g'
)
mainLineEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classCircles
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classCircles
.
call
(
$$
,
d
);
})
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
});
// Update date for selected circles
// Update date for selected circles
targets
.
forEach
(
function
(
t
)
{
targets
.
forEach
(
function
(
t
)
{
main
.
selectAll
(
'.'
+
CLASS
.
selectedCircles
+
$$
.
getTargetSelectorSuffix
(
t
.
id
)).
selectAll
(
'.'
+
CLASS
.
selectedCircle
).
each
(
function
(
d
)
{
main
.
selectAll
(
'.'
+
CLASS
.
selectedCircles
+
getTargetSelectorSuffix
.
call
(
$$
,
t
.
id
)).
selectAll
(
'.'
+
CLASS
.
selectedCircle
).
each
(
function
(
d
)
{
d
.
value
=
t
.
values
[
d
.
index
].
value
;
d
.
value
=
t
.
values
[
d
.
index
].
value
;
});
});
});
});
// MEMO: can not keep same color...
// MEMO: can not keep same color...
//mainLineUpdate.exit().remove();
//mainLineUpdate.exit().remove();
if
(
isFunction
(
updateTargetsForArc
))
{
updateTargetsForArc
.
call
(
$$
,
targets
);
}
if
(
isFunctionType
(
updateTargetsForArc
))
{
updateTargetsForArc
.
call
(
$$
,
targets
);
}
/*-- Context --*/
if
(
$$
.
config
.
subchart_show
)
{
if
(
isFunctionType
(
typeof
updateTargetsForSubchart
))
{
updateTargetsForSubchart
.
call
(
$$
,
targets
);
}
contextBarUpdate
=
context
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
.
data
(
targets
)
.
attr
(
'class'
,
$$
.
classChartBar
);
contextBarEnter
=
contextBarUpdate
.
enter
().
append
(
'g'
)
.
style
(
'opacity'
,
0
)
.
attr
(
'class'
,
$$
.
classChartBar
);
// Bars for each data
contextBarEnter
.
append
(
'g'
)
.
attr
(
"class"
,
$$
.
classBars
);
//-- Line --//
contextLineUpdate
=
context
.
select
(
'.'
+
CLASS
.
chartLines
).
selectAll
(
'.'
+
CLASS
.
chartLine
)
.
data
(
targets
)
.
attr
(
'class'
,
$$
.
classChartLine
);
contextLineEnter
=
contextLineUpdate
.
enter
().
append
(
'g'
)
.
style
(
'opacity'
,
0
)
.
attr
(
'class'
,
$$
.
classChartLine
);
// Lines for each data
contextLineEnter
.
append
(
"g"
)
.
attr
(
"class"
,
$$
.
classLines
);
// Area
contextLineEnter
.
append
(
"g"
)
.
attr
(
"class"
,
$$
.
classAreas
);
}
/*-- Show --*/
/*-- Show --*/
...
@@ -885,14 +814,14 @@
...
@@ -885,14 +814,14 @@
};
};
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
var
$$
=
this
,
main
=
$$
.
main
,
context
=
$$
.
context
,
CLASS
=
$$
.
CLASS
,
d3
=
$$
.
d3
;
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
;
var
xgrid
,
xgridAttr
,
xgridData
,
xgridLines
,
xgridLine
,
ygrid
,
ygridLines
,
ygridLine
,
flushXGrid
;
var
xgrid
,
xgridAttr
,
xgridData
,
xgridLines
,
xgridLine
,
ygrid
,
ygridLines
,
ygridLine
,
flushXGrid
;
var
mainLine
,
mainArea
,
mainCircle
,
mainBar
,
mainRegion
,
mainText
,
contextLine
,
contextArea
,
contextBar
,
eventRect
,
eventRectUpdate
;
var
mainLine
,
mainArea
,
mainCircle
,
mainBar
,
mainRegion
,
mainText
,
eventRect
,
eventRectUpdate
;
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
),
maxDataCountTarget
,
tickOffset
;
var
areaIndices
=
$$
.
getShapeIndices
(
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
isLineType
),
maxDataCountTarget
,
tickOffset
;
var
rectX
,
rectW
;
var
rectX
,
rectW
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withLegend
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withLegend
;
var
hideAxis
=
$$
.
hasArcType
(
$$
.
data
.
targets
);
var
hideAxis
=
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
);
var
drawArea
,
draw
AreaOnSub
,
drawBar
,
drawBarOnSub
,
drawLine
,
drawLineOnSub
,
xForText
,
yForText
;
var
drawArea
,
draw
Bar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
,
waitForDraw
;
var
duration
,
durationForExit
,
durationForAxis
,
waitForDraw
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
;
...
@@ -1104,7 +1033,7 @@
...
@@ -1104,7 +1033,7 @@
mainRegion
=
main
.
select
(
'.'
+
CLASS
.
regions
).
selectAll
(
'.'
+
CLASS
.
region
)
mainRegion
=
main
.
select
(
'.'
+
CLASS
.
regions
).
selectAll
(
'.'
+
CLASS
.
region
)
.
data
(
$$
.
config
.
regions
);
.
data
(
$$
.
config
.
regions
);
mainRegion
.
enter
().
append
(
'g'
)
mainRegion
.
enter
().
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classRegion
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classRegion
.
call
(
$$
,
d
);
})
.
append
(
'rect'
)
.
append
(
'rect'
)
.
style
(
"fill-opacity"
,
0
);
.
style
(
"fill-opacity"
,
0
);
mainRegion
.
exit
().
transition
().
duration
(
duration
)
mainRegion
.
exit
().
transition
().
duration
(
duration
)
...
@@ -1113,34 +1042,34 @@
...
@@ -1113,34 +1042,34 @@
// bars
// bars
mainBar
=
main
.
selectAll
(
'.'
+
CLASS
.
bars
).
selectAll
(
'.'
+
CLASS
.
bar
)
mainBar
=
main
.
selectAll
(
'.'
+
CLASS
.
bars
).
selectAll
(
'.'
+
CLASS
.
bar
)
.
data
(
function
(
d
)
{
return
$$
.
barData
(
d
);
});
.
data
(
function
(
d
)
{
return
barData
.
call
(
$$
,
d
);
});
mainBar
.
enter
().
append
(
'path'
)
mainBar
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classBar
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classBar
.
call
(
$$
,
d
);
})
.
style
(
"stroke"
,
function
(
d
)
{
return
$$
.
color
(
d
.
id
);
})
.
style
(
"stroke"
,
function
(
d
)
{
return
$$
.
color
(
d
.
id
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
.
id
);
});
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
.
id
);
});
mainBar
mainBar
.
style
(
"opacity"
,
function
(
d
)
{
return
$$
.
initialOpacity
(
d
);
});
.
style
(
"opacity"
,
function
(
d
)
{
return
initialOpacity
.
call
(
$$
,
d
);
});
mainBar
.
exit
().
transition
().
duration
(
durationForExit
)
mainBar
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
remove
();
.
remove
();
// lines, areas and cricles
// lines, areas and cricles
mainLine
=
main
.
selectAll
(
'.'
+
CLASS
.
lines
).
selectAll
(
'.'
+
CLASS
.
line
)
mainLine
=
main
.
selectAll
(
'.'
+
CLASS
.
lines
).
selectAll
(
'.'
+
CLASS
.
line
)
.
data
(
function
(
d
)
{
return
$$
.
lineData
(
d
);
});
.
data
(
function
(
d
)
{
return
lineData
.
call
(
$$
,
d
);
});
mainLine
.
enter
().
append
(
'path'
)
mainLine
.
enter
().
append
(
'path'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classLine
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classLine
.
call
(
$$
,
d
);
})
.
style
(
"stroke"
,
$$
.
color
);
.
style
(
"stroke"
,
$$
.
color
);
mainLine
mainLine
.
style
(
"opacity"
,
function
(
d
)
{
return
$$
.
initialOpacity
(
d
);
})
.
style
(
"opacity"
,
function
(
d
)
{
return
initialOpacity
.
call
(
$$
,
d
);
})
.
attr
(
'transform'
,
null
);
.
attr
(
'transform'
,
null
);
mainLine
.
exit
().
transition
().
duration
(
durationForExit
)
mainLine
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
remove
();
.
remove
();
mainArea
=
main
.
selectAll
(
'.'
+
CLASS
.
areas
).
selectAll
(
'.'
+
CLASS
.
area
)
mainArea
=
main
.
selectAll
(
'.'
+
CLASS
.
areas
).
selectAll
(
'.'
+
CLASS
.
area
)
.
data
(
function
(
d
)
{
return
$$
.
lineData
(
d
);
});
.
data
(
function
(
d
)
{
return
lineData
.
call
(
$$
,
d
);
});
mainArea
.
enter
().
append
(
'path'
)
mainArea
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classArea
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classArea
.
call
(
$$
,
d
);
})
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"opacity"
,
function
()
{
$$
.
orgAreaOpacity
=
+
d3
.
select
(
this
).
style
(
'opacity'
);
return
0
;
});
.
style
(
"opacity"
,
function
()
{
$$
.
orgAreaOpacity
=
+
d3
.
select
(
this
).
style
(
'opacity'
);
return
0
;
});
mainArea
mainArea
...
@@ -1151,21 +1080,21 @@
...
@@ -1151,21 +1080,21 @@
if
(
$$
.
config
.
point_show
)
{
if
(
$$
.
config
.
point_show
)
{
mainCircle
=
main
.
selectAll
(
'.'
+
CLASS
.
circles
).
selectAll
(
'.'
+
CLASS
.
circle
)
mainCircle
=
main
.
selectAll
(
'.'
+
CLASS
.
circles
).
selectAll
(
'.'
+
CLASS
.
circle
)
.
data
(
function
(
d
)
{
return
$$
.
lineOrScatterData
(
d
);
});
.
data
(
function
(
d
)
{
return
lineOrScatterData
.
call
(
$$
,
d
);
});
mainCircle
.
enter
().
append
(
"circle"
)
mainCircle
.
enter
().
append
(
"circle"
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classCircle
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classCircle
.
call
(
$$
,
d
);
})
.
attr
(
"r"
,
function
(
d
)
{
return
$$
.
pointR
(
d
);
})
.
attr
(
"r"
,
function
(
d
)
{
return
$$
.
pointR
(
d
);
})
.
style
(
"fill"
,
$$
.
color
);
.
style
(
"fill"
,
$$
.
color
);
mainCircle
mainCircle
.
style
(
"opacity"
,
function
(
d
)
{
return
$$
.
initialOpacity
(
d
);
});
.
style
(
"opacity"
,
function
(
d
)
{
return
initialOpacity
.
call
(
$$
,
d
);
});
mainCircle
.
exit
().
remove
();
mainCircle
.
exit
().
remove
();
}
}
if
(
$$
.
hasDataLabel
())
{
if
(
$$
.
hasDataLabel
())
{
mainText
=
main
.
selectAll
(
'.'
+
CLASS
.
texts
).
selectAll
(
'.'
+
CLASS
.
text
)
mainText
=
main
.
selectAll
(
'.'
+
CLASS
.
texts
).
selectAll
(
'.'
+
CLASS
.
text
)
.
data
(
$$
.
barOrLineData
);
.
data
(
function
(
d
)
{
return
barOrLineData
.
call
(
$$
,
d
);
}
);
mainText
.
enter
().
append
(
'text'
)
mainText
.
enter
().
append
(
'text'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classText
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classText
.
call
(
$$
,
d
);
})
.
attr
(
'text-anchor'
,
function
(
d
)
{
return
$$
.
config
.
axis_rotated
?
(
d
.
value
<
0
?
'end'
:
'start'
)
:
'middle'
;
})
.
attr
(
'text-anchor'
,
function
(
d
)
{
return
$$
.
config
.
axis_rotated
?
(
d
.
value
<
0
?
'end'
:
'start'
)
:
'middle'
;
})
.
style
(
"stroke"
,
'none'
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
);
})
...
@@ -1179,81 +1108,14 @@
...
@@ -1179,81 +1108,14 @@
}
}
// arc
// arc
if
(
isFunction
(
redrawArc
))
{
redrawArc
.
call
(
$$
,
duration
,
durationForExit
,
withTransform
);
}
if
(
isFunction
Type
(
redrawArc
))
{
redrawArc
.
call
(
$$
,
duration
,
durationForExit
,
withTransform
);
}
// subchart
// subchart
if
(
$$
.
config
.
subchart_show
)
{
if
(
isFunctionType
(
typeof
redrawSubchart
))
{
redrawSubchart
.
call
(
$$
,
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
);
}
// reflect main chart to extent on subchart if zoomed
if
(
d3
.
event
&&
d3
.
event
.
type
===
'zoom'
)
{
$$
.
brush
.
extent
(
$$
.
x
.
orgDomain
()).
update
();
}
// update subchart elements if needed
if
(
withSubchart
)
{
// rotate tick text if needed
if
(
!
$$
.
config
.
axis_rotated
&&
$$
.
config
.
axis_x_tick_rotate
)
{
$$
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
$$
.
config
.
axis_x_tick_rotate
);
}
// extent rect
if
(
!
$$
.
brush
.
empty
())
{
$$
.
brush
.
extent
(
$$
.
x
.
orgDomain
()).
update
();
}
// setup drawer - MEMO: this must be called after axis updated
drawAreaOnSub
=
$$
.
generateDrawArea
(
areaIndices
,
true
);
drawBarOnSub
=
$$
.
generateDrawBar
(
barIndices
,
true
);
drawLineOnSub
=
$$
.
generateDrawLine
(
lineIndices
,
true
);
// bars
contextBar
=
context
.
selectAll
(
'.'
+
CLASS
.
bars
).
selectAll
(
'.'
+
CLASS
.
bar
)
.
data
(
$$
.
barData
);
contextBar
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
$$
.
classBar
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill"
,
$$
.
color
);
contextBar
.
style
(
"opacity"
,
$$
.
initialOpacity
)
.
transition
().
duration
(
duration
)
.
attr
(
'd'
,
drawBarOnSub
)
.
style
(
'opacity'
,
1
);
contextBar
.
exit
().
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
0
)
.
remove
();
// lines
contextLine
=
context
.
selectAll
(
'.'
+
CLASS
.
lines
).
selectAll
(
'.'
+
CLASS
.
line
)
.
data
(
$$
.
lineData
);
contextLine
.
enter
().
append
(
'path'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classLine
(
d
);
})
.
style
(
'stroke'
,
$$
.
color
);
contextLine
.
style
(
"opacity"
,
$$
.
initialOpacity
)
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
drawLineOnSub
)
.
style
(
'opacity'
,
1
);
contextLine
.
exit
().
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
0
)
.
remove
();
// area
contextArea
=
context
.
selectAll
(
'.'
+
CLASS
.
areas
).
selectAll
(
'.'
+
CLASS
.
area
)
.
data
(
$$
.
lineData
);
contextArea
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classArea
(
d
);
})
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"opacity"
,
function
()
{
$$
.
orgAreaOpacity
=
+
d3
.
select
(
this
).
style
(
'opacity'
);
return
0
;
});
contextArea
.
style
(
"opacity"
,
0
)
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
drawAreaOnSub
)
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"opacity"
,
$$
.
orgAreaOpacity
);
contextArea
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
remove
();
}
}
// circles for select
// circles for select
main
.
selectAll
(
'.'
+
CLASS
.
selectedCircles
)
main
.
selectAll
(
'.'
+
CLASS
.
selectedCircles
)
.
filter
(
function
(
d
)
{
return
$$
.
isBarType
(
d
);
})
.
filter
(
function
(
d
)
{
return
isBarType
.
call
(
$$
,
d
);
})
.
selectAll
(
'circle'
)
.
selectAll
(
'circle'
)
.
remove
();
.
remove
();
...
@@ -1313,7 +1175,7 @@
...
@@ -1313,7 +1175,7 @@
$$
.
generateEventRectsForSingleX
(
eventRectUpdate
.
enter
());
$$
.
generateEventRectsForSingleX
(
eventRectUpdate
.
enter
());
// update
// update
eventRectUpdate
eventRectUpdate
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classEvent
(
d
);
})
.
attr
(
'class'
,
function
(
d
)
{
return
classEvent
.
call
(
$$
,
d
);
})
.
attr
(
"x"
,
$$
.
config
.
axis_rotated
?
0
:
rectX
)
.
attr
(
"x"
,
$$
.
config
.
axis_rotated
?
0
:
rectX
)
.
attr
(
"y"
,
$$
.
config
.
axis_rotated
?
rectX
:
0
)
.
attr
(
"y"
,
$$
.
config
.
axis_rotated
?
rectX
:
0
)
.
attr
(
"width"
,
$$
.
config
.
axis_rotated
?
$$
.
width
:
rectW
)
.
attr
(
"width"
,
$$
.
config
.
axis_rotated
?
$$
.
width
:
rectW
)
...
@@ -1505,16 +1367,6 @@
...
@@ -1505,16 +1367,6 @@
$$
.
updateZoom
();
$$
.
updateZoom
();
};
};
c3_chart_internal_fn
.
redrawForBrush
=
function
()
{
var
$$
=
this
,
x
=
$$
.
x
;
$$
.
redraw
({
withTransition
:
false
,
withY
:
false
,
withSubchart
:
false
,
withUpdateXDomain
:
true
});
$$
.
config
.
subchart_onbrush
.
call
(
c3
,
x
.
orgDomain
());
};
c3_chart_internal_fn
.
redrawForZoom
=
function
()
{
c3_chart_internal_fn
.
redrawForZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
,
orgXDomain
=
$$
.
orgXDomain
;
var
$$
=
this
,
d3
=
$$
.
d3
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
,
orgXDomain
=
$$
.
orgXDomain
;
if
(
!
$$
.
config
.
zoom_enabled
)
{
if
(
!
$$
.
config
.
zoom_enabled
)
{
...
@@ -1571,13 +1423,13 @@
...
@@ -1571,13 +1423,13 @@
c3_chart_internal_fn
.
generateEventRectsForSingleX
=
function
(
eventRectEnter
)
{
c3_chart_internal_fn
.
generateEventRectsForSingleX
=
function
(
eventRectEnter
)
{
var
$$
=
this
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
;
var
$$
=
this
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
;
eventRectEnter
.
append
(
"rect"
)
eventRectEnter
.
append
(
"rect"
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classEvent
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classEvent
.
call
(
$$
,
d
);
})
.
style
(
"cursor"
,
$$
.
config
.
data_selection_enabled
&&
$$
.
config
.
data_selection_grouped
?
"pointer"
:
null
)
.
style
(
"cursor"
,
$$
.
config
.
data_selection_enabled
&&
$$
.
config
.
data_selection_grouped
?
"pointer"
:
null
)
.
on
(
'mouseover'
,
function
(
d
)
{
.
on
(
'mouseover'
,
function
(
d
)
{
var
index
=
d
.
index
,
selectedData
,
newData
;
var
index
=
d
.
index
,
selectedData
,
newData
;
if
(
$$
.
dragging
)
{
return
;
}
// do nothing if dragging
if
(
$$
.
dragging
)
{
return
;
}
// do nothing if dragging
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
selectedData
=
$$
.
data
.
targets
.
map
(
function
(
t
)
{
selectedData
=
$$
.
data
.
targets
.
map
(
function
(
t
)
{
return
$$
.
addName
(
$$
.
getValueOnIndex
(
t
.
values
,
index
));
return
$$
.
addName
(
$$
.
getValueOnIndex
(
t
.
values
,
index
));
...
@@ -1607,7 +1459,7 @@
...
@@ -1607,7 +1459,7 @@
})
})
.
on
(
'mouseout'
,
function
(
d
)
{
.
on
(
'mouseout'
,
function
(
d
)
{
var
index
=
d
.
index
;
var
index
=
d
.
index
;
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
$$
.
hideXGridFocus
();
$$
.
hideXGridFocus
();
$$
.
hideTooltip
();
$$
.
hideTooltip
();
// Undo expanded shapes
// Undo expanded shapes
...
@@ -1623,7 +1475,7 @@
...
@@ -1623,7 +1475,7 @@
eventRect
=
$$
.
svg
.
select
(
'.'
+
CLASS
.
eventRect
+
'-'
+
index
);
eventRect
=
$$
.
svg
.
select
(
'.'
+
CLASS
.
eventRect
+
'-'
+
index
);
if
(
$$
.
dragging
)
{
return
;
}
// do nothing when dragging
if
(
$$
.
dragging
)
{
return
;
}
// do nothing when dragging
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
// Show tooltip
// Show tooltip
selectedData
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
).
map
(
function
(
t
)
{
selectedData
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
).
map
(
function
(
t
)
{
...
@@ -1676,7 +1528,7 @@
...
@@ -1676,7 +1528,7 @@
})
})
.
on
(
'click'
,
function
(
d
)
{
.
on
(
'click'
,
function
(
d
)
{
var
index
=
d
.
index
;
var
index
=
d
.
index
;
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
if
(
$$
.
cancelClick
)
{
if
(
$$
.
cancelClick
)
{
$$
.
cancelClick
=
false
;
$$
.
cancelClick
=
false
;
return
;
return
;
...
@@ -1711,14 +1563,14 @@
...
@@ -1711,14 +1563,14 @@
var
mouse
,
closest
,
sameXData
,
selectedData
;
var
mouse
,
closest
,
sameXData
,
selectedData
;
if
(
$$
.
dragging
)
{
return
;
}
// do nothing when dragging
if
(
$$
.
dragging
)
{
return
;
}
// do nothing when dragging
if
(
$$
.
hasArcType
(
targetsToShow
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
targetsToShow
))
{
return
;
}
mouse
=
d3
.
mouse
(
this
);
mouse
=
d3
.
mouse
(
this
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
if
(
!
closest
)
{
return
;
}
if
(
!
closest
)
{
return
;
}
if
(
$$
.
isScatterType
(
closest
))
{
if
(
isScatterType
.
call
(
$$
,
closest
))
{
sameXData
=
[
closest
];
sameXData
=
[
closest
];
}
else
{
}
else
{
sameXData
=
$$
.
filterSameX
(
targetsToShow
,
closest
.
x
);
sameXData
=
$$
.
filterSameX
(
targetsToShow
,
closest
.
x
);
...
@@ -1756,7 +1608,7 @@
...
@@ -1756,7 +1608,7 @@
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
);
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
);
var
mouse
,
closest
;
var
mouse
,
closest
;
if
(
$$
.
hasArcType
(
targetsToShow
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
targetsToShow
))
{
return
;
}
mouse
=
d3
.
mouse
(
this
);
mouse
=
d3
.
mouse
(
this
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
...
@@ -1765,7 +1617,7 @@
...
@@ -1765,7 +1617,7 @@
// select if selection enabled
// select if selection enabled
if
(
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
if
(
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
$$
.
main
.
select
(
'.'
+
CLASS
.
circles
+
$$
.
getTargetSelectorSuffix
(
closest
.
id
)).
select
(
'.'
+
CLASS
.
circle
+
'-'
+
closest
.
index
).
each
(
function
()
{
$$
.
main
.
select
(
'.'
+
CLASS
.
circles
+
getTargetSelectorSuffix
.
call
(
$$
,
closest
.
id
)).
select
(
'.'
+
CLASS
.
circle
+
'-'
+
closest
.
index
).
each
(
function
()
{
$$
.
toggleShape
(
this
,
closest
,
closest
.
index
);
$$
.
toggleShape
(
this
,
closest
,
closest
.
index
);
});
});
}
}
...
@@ -1786,13 +1638,12 @@
...
@@ -1786,13 +1638,12 @@
c3_chart_internal_fn
.
initialOpacity
=
function
(
d
)
{
var
initialOpacity
=
c3_chart_internal_fn
.
initialOpacity
=
function
(
d
)
{
var
$$
=
this
;
return
d
.
value
!==
null
&&
this
.
withoutFadeIn
[
d
.
id
]
?
1
:
0
;
return
d
.
value
!==
null
&&
$$
.
withoutFadeIn
[
d
.
id
]
?
1
:
0
;
};
};
c3_chart_internal_fn
.
opacityForCircle
=
function
(
d
)
{
c3_chart_internal_fn
.
opacityForCircle
=
function
(
d
)
{
var
$$
=
this
;
var
$$
=
this
;
return
$$
.
isValue
(
d
.
value
)
?
$$
.
isScatterType
(
d
)
?
0.5
:
1
:
0
;
return
$$
.
isValue
(
d
.
value
)
?
isScatterType
.
call
(
$$
,
d
)
?
0.5
:
1
:
0
;
};
};
c3_chart_internal_fn
.
opacityForText
=
function
()
{
c3_chart_internal_fn
.
opacityForText
=
function
()
{
return
this
.
hasDataLabel
()
?
1
:
0
;
return
this
.
hasDataLabel
()
?
1
:
0
;
...
@@ -1842,17 +1693,6 @@
...
@@ -1842,17 +1693,6 @@
y2Axis
.
attr
(
"transform"
,
$$
.
translate
.
y2
);
y2Axis
.
attr
(
"transform"
,
$$
.
translate
.
y2
);
$$
.
main
.
select
(
'.'
+
CLASS
.
chartArcs
).
attr
(
"transform"
,
$$
.
translate
.
arc
);
$$
.
main
.
select
(
'.'
+
CLASS
.
chartArcs
).
attr
(
"transform"
,
$$
.
translate
.
arc
);
};
};
c3_chart_internal_fn
.
transformContext
=
function
(
withTransition
,
transitions
)
{
var
$$
=
this
,
subXAxis
;
if
(
transitions
&&
transitions
.
axisSubX
)
{
subXAxis
=
transitions
.
axisSubX
;
}
else
{
subXAxis
=
$$
.
context
.
select
(
'.'
+
$$
.
CLASS
.
axisX
);
if
(
withTransition
)
{
subXAxis
=
subXAxis
.
transition
();
}
}
$$
.
context
.
attr
(
"transform"
,
$$
.
translate
.
context
);
subXAxis
.
attr
(
"transform"
,
$$
.
translate
.
subx
);
};
c3_chart_internal_fn
.
transformLegend
=
function
(
withTransition
)
{
c3_chart_internal_fn
.
transformLegend
=
function
(
withTransition
)
{
var
$$
=
this
;
var
$$
=
this
;
(
withTransition
?
$$
.
legend
.
transition
()
:
$$
.
legend
).
attr
(
"transform"
,
$$
.
translate
.
legend
);
(
withTransition
?
$$
.
legend
.
transition
()
:
$$
.
legend
).
attr
(
"transform"
,
$$
.
translate
.
legend
);
...
@@ -1860,7 +1700,7 @@
...
@@ -1860,7 +1700,7 @@
c3_chart_internal_fn
.
transformAll
=
function
(
withTransition
,
transitions
)
{
c3_chart_internal_fn
.
transformAll
=
function
(
withTransition
,
transitions
)
{
var
$$
=
this
;
var
$$
=
this
;
$$
.
transformMain
(
withTransition
,
transitions
);
$$
.
transformMain
(
withTransition
,
transitions
);
if
(
$$
.
config
.
subchart_show
)
{
$$
.
transformContext
(
withTransition
,
transitions
);
}
if
(
$$
.
config
.
subchart_show
)
{
transformContext
.
call
(
$$
,
withTransition
,
transitions
);
}
$$
.
transformLegend
(
withTransition
);
$$
.
transformLegend
(
withTransition
);
};
};
...
@@ -2011,7 +1851,7 @@
...
@@ -2011,7 +1851,7 @@
leftAxis
=
$$
.
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
leftAxis
=
$$
.
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
chartRect
=
$$
.
selectChart
.
node
().
getBoundingClientRect
(),
chartRect
=
$$
.
selectChart
.
node
().
getBoundingClientRect
(),
hasArc
=
$$
.
hasArcType
(
$$
.
data
.
targets
),
hasArc
=
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
),
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
());
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
());
return
svgLeft
>
0
?
svgLeft
:
0
;
return
svgLeft
>
0
?
svgLeft
:
0
;
};
};
...
@@ -2043,7 +1883,7 @@
...
@@ -2043,7 +1883,7 @@
return
$$
.
config
.
axis_rotated
?
$$
.
height
:
$$
.
width
;
return
$$
.
config
.
axis_rotated
?
$$
.
height
:
$$
.
width
;
}
}
maxDataCount
=
$$
.
getMaxDataCount
();
maxDataCount
=
$$
.
getMaxDataCount
();
ratio
=
(
$$
.
hasBarType
(
$$
.
data
.
targets
)
?
(
maxDataCount
-
(
$$
.
isCategorized
?
0.25
:
1
))
/
maxDataCount
:
1
);
ratio
=
(
hasBarType
.
call
(
$$
,
$$
.
data
.
targets
)
?
(
maxDataCount
-
(
$$
.
isCategorized
?
0.25
:
1
))
/
maxDataCount
:
1
);
w
=
maxDataCount
>
1
?
(
base
*
ratio
)
/
(
maxDataCount
-
1
)
:
base
;
w
=
maxDataCount
>
1
?
(
base
*
ratio
)
/
(
maxDataCount
-
1
)
:
base
;
return
w
<
1
?
1
:
w
;
return
w
<
1
?
1
:
w
;
};
};
...
@@ -2055,7 +1895,7 @@
...
@@ -2055,7 +1895,7 @@
c3_chart_internal_fn
.
showTooltip
=
function
(
selectedData
,
mouse
)
{
c3_chart_internal_fn
.
showTooltip
=
function
(
selectedData
,
mouse
)
{
var
$$
=
this
;
var
$$
=
this
;
var
tWidth
,
tHeight
,
svgLeft
,
tooltipLeft
,
tooltipRight
,
tooltipTop
,
chartRight
;
var
tWidth
,
tHeight
,
svgLeft
,
tooltipLeft
,
tooltipRight
,
tooltipTop
,
chartRight
;
var
forArc
=
$$
.
hasArcType
(
$$
.
data
.
targets
),
var
forArc
=
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
),
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
$$
.
isValue
(
d
.
value
);
});
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
$$
.
isValue
(
d
.
value
);
});
if
(
dataToShow
.
length
===
0
||
!
$$
.
config
.
tooltip_show
)
{
if
(
dataToShow
.
length
===
0
||
!
$$
.
config
.
tooltip_show
)
{
return
;
return
;
...
@@ -2108,7 +1948,7 @@
...
@@ -2108,7 +1948,7 @@
var
$$
=
this
,
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
$$
.
isValue
(
d
.
value
);
});
var
$$
=
this
,
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
$$
.
isValue
(
d
.
value
);
});
if
(
!
$$
.
config
.
tooltip_show
)
{
return
;
}
if
(
!
$$
.
config
.
tooltip_show
)
{
return
;
}
// Hide when scatter plot exists
// Hide when scatter plot exists
if
(
$$
.
hasScatterType
(
$$
.
data
.
targets
)
||
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasScatterType
.
call
(
$$
,
$$
.
data
.
targets
)
||
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
var
focusEl
=
$$
.
main
.
selectAll
(
'line.'
+
$$
.
CLASS
.
xgridFocus
);
var
focusEl
=
$$
.
main
.
selectAll
(
'line.'
+
$$
.
CLASS
.
xgridFocus
);
focusEl
focusEl
.
style
(
"visibility"
,
"visible"
)
.
style
(
"visibility"
,
"visible"
)
...
@@ -2239,7 +2079,7 @@
...
@@ -2239,7 +2079,7 @@
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
}
}
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
$$
.
legend
.
selectAll
(
selectorLegends
.
call
(
$$
,
targetIds
))
.
style
(
'visibility'
,
'visible'
)
.
style
(
'visibility'
,
'visible'
)
.
transition
()
.
transition
()
.
style
(
'opacity'
,
function
()
{
return
$$
.
opacityForLegend
(
$$
.
d3
.
select
(
this
));
});
.
style
(
'opacity'
,
function
()
{
return
$$
.
opacityForLegend
(
$$
.
d3
.
select
(
this
));
});
...
@@ -2251,7 +2091,7 @@
...
@@ -2251,7 +2091,7 @@
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
}
}
$$
.
addHiddenLegendIds
(
targetIds
);
$$
.
addHiddenLegendIds
(
targetIds
);
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
$$
.
legend
.
selectAll
(
selectorLegends
.
call
(
$$
,
targetIds
))
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
style
(
'visibility'
,
'hidden'
);
.
style
(
'visibility'
,
'hidden'
);
};
};
...
@@ -2347,7 +2187,7 @@
...
@@ -2347,7 +2187,7 @@
l
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
l
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
.
data
(
targetIds
)
.
data
(
targetIds
)
.
enter
().
append
(
'g'
)
.
enter
().
append
(
'g'
)
.
attr
(
'class'
,
function
(
id
)
{
return
$$
.
generateClass
(
CLASS
.
legendItem
,
id
);
})
.
attr
(
'class'
,
function
(
id
)
{
return
generateClass
.
call
(
$$
,
CLASS
.
legendItem
,
id
);
})
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'cursor'
,
'pointer'
)
.
style
(
'cursor'
,
'pointer'
)
.
on
(
'click'
,
function
(
id
)
{
.
on
(
'click'
,
function
(
id
)
{
...
@@ -3019,7 +2859,7 @@
...
@@ -3019,7 +2859,7 @@
done
();
done
();
return
;
return
;
}
}
$$
.
svg
.
selectAll
(
targetIds
.
map
(
function
(
id
)
{
return
$$
.
selectorTarget
(
id
);
}))
$$
.
svg
.
selectAll
(
targetIds
.
map
(
function
(
id
)
{
return
selectorTarget
.
call
(
$$
,
id
);
}))
.
transition
()
.
transition
()
.
style
(
'opacity'
,
0
)
.
style
(
'opacity'
,
0
)
.
remove
()
.
remove
()
...
@@ -3028,7 +2868,7 @@
...
@@ -3028,7 +2868,7 @@
// Reset fadein for future load
// Reset fadein for future load
$$
.
withoutFadeIn
[
id
]
=
false
;
$$
.
withoutFadeIn
[
id
]
=
false
;
// Remove target's elements
// Remove target's elements
$$
.
legend
.
selectAll
(
'.'
+
$$
.
CLASS
.
legendItem
+
$$
.
getTargetSelectorSuffix
(
id
)).
remove
();
$$
.
legend
.
selectAll
(
'.'
+
$$
.
CLASS
.
legendItem
+
getTargetSelectorSuffix
.
call
(
$$
,
id
)).
remove
();
// Remove target
// Remove target
$$
.
data
.
targets
=
$$
.
data
.
targets
.
filter
(
function
(
t
)
{
$$
.
data
.
targets
=
$$
.
data
.
targets
.
filter
(
function
(
t
)
{
return
t
.
id
!==
id
;
return
t
.
id
!==
id
;
...
@@ -3100,7 +2940,7 @@
...
@@ -3100,7 +2940,7 @@
c3_chart_internal_fn
.
getInterpolate
=
function
(
d
)
{
c3_chart_internal_fn
.
getInterpolate
=
function
(
d
)
{
var
$$
=
this
;
var
$$
=
this
;
return
$$
.
isSplineType
(
d
)
?
"cardinal"
:
$$
.
isStepType
(
d
)
?
"step-after"
:
"linear"
;
return
isSplineType
.
call
(
$$
,
d
)
?
"cardinal"
:
isStepType
.
call
(
$$
,
d
)
?
"step-after"
:
"linear"
;
};
};
...
@@ -3109,12 +2949,12 @@
...
@@ -3109,12 +2949,12 @@
};
};
c3_chart_internal_fn
.
circleY
=
function
(
d
,
i
)
{
c3_chart_internal_fn
.
circleY
=
function
(
d
,
i
)
{
var
$$
=
this
,
var
$$
=
this
,
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
),
getPoint
=
$$
.
generateGetLinePoint
(
lineIndices
);
lineIndices
=
$$
.
getShapeIndices
(
isLineType
),
getPoint
=
$$
.
generateGetLinePoint
(
lineIndices
);
return
$$
.
config
.
data_groups
.
length
>
0
?
getPoint
(
d
,
i
)[
0
][
1
]
:
$$
.
getYScale
(
d
.
id
)(
d
.
value
);
return
$$
.
config
.
data_groups
.
length
>
0
?
getPoint
(
d
,
i
)[
0
][
1
]
:
$$
.
getYScale
(
d
.
id
)(
d
.
value
);
};
};
c3_chart_internal_fn
.
getCircles
=
function
(
i
,
id
)
{
c3_chart_internal_fn
.
getCircles
=
function
(
i
,
id
)
{
var
$$
=
this
,
CLASS
=
$$
.
CLASS
;
var
$$
=
this
,
CLASS
=
$$
.
CLASS
;
return
(
id
?
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
circles
+
$$
.
getTargetSelectorSuffix
(
id
))
:
$$
.
main
).
selectAll
(
'.'
+
CLASS
.
circle
+
(
$$
.
isValue
(
i
)
?
'-'
+
i
:
''
));
return
(
id
?
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
circles
+
getTargetSelectorSuffix
.
call
(
$$
,
id
))
:
$$
.
main
).
selectAll
(
'.'
+
CLASS
.
circle
+
(
$$
.
isValue
(
i
)
?
'-'
+
i
:
''
));
};
};
c3_chart_internal_fn
.
expandCircles
=
function
(
i
,
id
)
{
c3_chart_internal_fn
.
expandCircles
=
function
(
i
,
id
)
{
var
$$
=
this
,
CLASS
=
$$
.
CLASS
;
var
$$
=
this
,
CLASS
=
$$
.
CLASS
;
...
@@ -3131,7 +2971,7 @@
...
@@ -3131,7 +2971,7 @@
};
};
c3_chart_internal_fn
.
pointR
=
function
(
d
)
{
c3_chart_internal_fn
.
pointR
=
function
(
d
)
{
var
$$
=
this
;
var
$$
=
this
;
return
$$
.
config
.
point_show
&&
!
$$
.
isStepType
(
d
)
?
(
typeof
$$
.
config
.
point_r
===
'function'
?
$$
.
config
.
point_r
(
d
)
:
$$
.
config
.
point_r
)
:
0
;
return
$$
.
config
.
point_show
&&
!
isStepType
.
call
(
$$
,
d
)
?
(
typeof
$$
.
config
.
point_r
===
'function'
?
$$
.
config
.
point_r
(
d
)
:
$$
.
config
.
point_r
)
:
0
;
};
};
c3_chart_internal_fn
.
pointExpandedR
=
function
(
d
)
{
c3_chart_internal_fn
.
pointExpandedR
=
function
(
d
)
{
var
$$
=
this
,
c
=
$$
.
config
;
var
$$
=
this
,
c
=
$$
.
config
;
...
@@ -3186,7 +3026,7 @@
...
@@ -3186,7 +3026,7 @@
barW
=
$$
.
getBarW
(
$$
.
xAxis
,
barTargetsNum
),
barW
=
$$
.
getBarW
(
$$
.
xAxis
,
barTargetsNum
),
barX
=
$$
.
getShapeX
(
barW
,
barTargetsNum
,
barIndices
,
!!
isSub
),
barX
=
$$
.
getShapeX
(
barW
,
barTargetsNum
,
barIndices
,
!!
isSub
),
barY
=
$$
.
getShapeY
(
!!
isSub
),
barY
=
$$
.
getShapeY
(
!!
isSub
),
barOffset
=
$$
.
getShapeOffset
(
$$
.
isBarType
,
barIndices
,
!!
isSub
),
barOffset
=
$$
.
getShapeOffset
(
isBarType
,
barIndices
,
!!
isSub
),
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
return
function
(
d
,
i
)
{
return
function
(
d
,
i
)
{
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
...
@@ -3222,7 +3062,7 @@
...
@@ -3222,7 +3062,7 @@
return
function
(
d
)
{
return
function
(
d
)
{
var
data
=
$$
.
filterRemoveNull
(
d
.
values
),
x0
=
0
,
y0
=
0
,
path
;
var
data
=
$$
.
filterRemoveNull
(
d
.
values
),
x0
=
0
,
y0
=
0
,
path
;
if
(
$$
.
isAreaType
(
d
))
{
if
(
isAreaType
.
call
(
$$
,
d
))
{
path
=
area
.
interpolate
(
$$
.
getInterpolate
(
d
))(
data
);
path
=
area
.
interpolate
(
$$
.
getInterpolate
(
d
))(
data
);
}
else
{
}
else
{
if
(
data
[
0
])
{
if
(
data
[
0
])
{
...
@@ -3250,7 +3090,7 @@
...
@@ -3250,7 +3090,7 @@
return
function
(
d
)
{
return
function
(
d
)
{
var
data
=
$$
.
config
.
line_connect_null
?
$$
.
filterRemoveNull
(
d
.
values
)
:
d
.
values
,
var
data
=
$$
.
config
.
line_connect_null
?
$$
.
filterRemoveNull
(
d
.
values
)
:
d
.
values
,
x
=
isSub
?
$$
.
x
:
$$
.
subX
,
y
=
yScaleGetter
.
call
(
$$
,
d
.
id
),
x0
=
0
,
y0
=
0
,
path
;
x
=
isSub
?
$$
.
x
:
$$
.
subX
,
y
=
yScaleGetter
.
call
(
$$
,
d
.
id
),
x0
=
0
,
y0
=
0
,
path
;
if
(
$$
.
isLineType
(
d
))
{
if
(
isLineType
.
call
(
$$
,
d
))
{
if
(
$$
.
config
.
data_regions
[
d
.
id
])
{
if
(
$$
.
config
.
data_regions
[
d
.
id
])
{
path
=
$$
.
lineWithRegions
(
data
,
x
,
y
,
$$
.
config
.
data_regions
[
d
.
id
]);
path
=
$$
.
lineWithRegions
(
data
,
x
,
y
,
$$
.
config
.
data_regions
[
d
.
id
]);
}
else
{
}
else
{
...
@@ -3279,7 +3119,7 @@
...
@@ -3279,7 +3119,7 @@
var
$$
=
this
,
var
$$
=
this
,
box
=
textElement
.
getBoundingClientRect
(),
xPos
,
padding
;
box
=
textElement
.
getBoundingClientRect
(),
xPos
,
padding
;
if
(
$$
.
config
.
axis_rotated
)
{
if
(
$$
.
config
.
axis_rotated
)
{
padding
=
$$
.
isBarType
(
d
)
?
4
:
6
;
padding
=
isBarType
.
call
(
$$
,
d
)
?
4
:
6
;
xPos
=
points
[
2
][
1
]
+
padding
*
(
d
.
value
<
0
?
-
1
:
1
);
xPos
=
points
[
2
][
1
]
+
padding
*
(
d
.
value
<
0
?
-
1
:
1
);
}
else
{
}
else
{
xPos
=
points
[
0
][
0
]
+
(
points
[
2
][
0
]
-
points
[
0
][
0
])
/
2
;
xPos
=
points
[
0
][
0
]
+
(
points
[
2
][
0
]
-
points
[
0
][
0
])
/
2
;
...
@@ -3292,7 +3132,7 @@
...
@@ -3292,7 +3132,7 @@
if
(
$$
.
config
.
axis_rotated
)
{
if
(
$$
.
config
.
axis_rotated
)
{
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
}
else
{
}
else
{
yPos
=
points
[
2
][
1
]
+
(
d
.
value
<
0
?
box
.
height
:
$$
.
isBarType
(
d
)
?
-
3
:
-
6
);
yPos
=
points
[
2
][
1
]
+
(
d
.
value
<
0
?
box
.
height
:
isBarType
.
call
(
$$
,
d
)
?
-
3
:
-
6
);
}
}
return
yPos
<
box
.
height
?
box
.
height
:
yPos
;
return
yPos
<
box
.
height
?
box
.
height
:
yPos
;
};
};
...
@@ -3302,7 +3142,7 @@
...
@@ -3302,7 +3142,7 @@
areaTargetsNum
=
areaIndices
.
__max__
+
1
,
areaTargetsNum
=
areaIndices
.
__max__
+
1
,
x
=
$$
.
getShapeX
(
0
,
areaTargetsNum
,
areaIndices
,
!!
isSub
),
x
=
$$
.
getShapeX
(
0
,
areaTargetsNum
,
areaIndices
,
!!
isSub
),
y
=
$$
.
getShapeY
(
!!
isSub
),
y
=
$$
.
getShapeY
(
!!
isSub
),
areaOffset
=
$$
.
getShapeOffset
(
$$
.
isAreaType
,
areaIndices
,
!!
isSub
),
areaOffset
=
$$
.
getShapeOffset
(
isAreaType
,
areaIndices
,
!!
isSub
),
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
return
function
(
d
,
i
)
{
return
function
(
d
,
i
)
{
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
...
@@ -3325,7 +3165,7 @@
...
@@ -3325,7 +3165,7 @@
lineTargetsNum
=
lineIndices
.
__max__
+
1
,
lineTargetsNum
=
lineIndices
.
__max__
+
1
,
x
=
$$
.
getShapeX
(
0
,
lineTargetsNum
,
lineIndices
,
!!
isSub
),
x
=
$$
.
getShapeX
(
0
,
lineTargetsNum
,
lineIndices
,
!!
isSub
),
y
=
$$
.
getShapeY
(
!!
isSub
),
y
=
$$
.
getShapeY
(
!!
isSub
),
lineOffset
=
$$
.
getShapeOffset
(
$$
.
isLineType
,
lineIndices
,
!!
isSub
),
lineOffset
=
$$
.
getShapeOffset
(
isLineType
,
lineIndices
,
!!
isSub
),
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
yScale
=
isSub
?
$$
.
getSubYScale
:
$$
.
getYScale
;
return
function
(
d
,
i
)
{
return
function
(
d
,
i
)
{
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
var
y0
=
yScale
.
call
(
$$
,
d
.
id
)(
0
),
...
@@ -3525,7 +3365,7 @@
...
@@ -3525,7 +3365,7 @@
$$
.
config
.
data_type
=
type
;
$$
.
config
.
data_type
=
type
;
}
}
};
};
c3_chart_internal_fn
.
hasType
=
function
(
targets
,
type
)
{
var
hasType
=
c3_chart_internal_fn
.
hasType
=
function
(
targets
,
type
)
{
var
$$
=
this
,
has
=
false
;
var
$$
=
this
,
has
=
false
;
targets
.
forEach
(
function
(
t
)
{
targets
.
forEach
(
function
(
t
)
{
if
(
$$
.
config
.
data_types
[
t
.
id
]
===
type
)
{
has
=
true
;
}
if
(
$$
.
config
.
data_types
[
t
.
id
]
===
type
)
{
has
=
true
;
}
...
@@ -3533,91 +3373,90 @@
...
@@ -3533,91 +3373,90 @@
});
});
return
has
;
return
has
;
};
};
/* not used
/* not used
function hasLineType(targets) {
function hasLineType(targets) {
return hasType(targets, 'line');
return hasType(targets, 'line');
}
}
*/
*/
c3_chart_internal_fn
.
hasAreaType
=
function
(
targets
)
{
var
hasAreaType
=
c3_chart_internal_fn
.
hasAreaType
=
function
(
targets
)
{
return
this
.
hasType
(
targets
,
'area'
)
||
this
.
hasType
(
targets
,
'area-spline'
)
||
this
.
hasType
(
targets
,
'area-step'
);
return
hasType
.
call
(
this
,
targets
,
'area'
)
||
hasType
.
call
(
this
,
targets
,
'area-spline'
)
||
hasType
.
call
(
this
,
targets
,
'area-step'
);
};
};
c3_chart_internal_fn
.
hasBarType
=
function
(
targets
)
{
var
hasBarType
=
c3_chart_internal_fn
.
hasBarType
=
function
(
targets
)
{
return
this
.
hasType
(
targets
,
'bar'
);
return
hasType
.
call
(
this
,
targets
,
'bar'
);
};
};
c3_chart_internal_fn
.
hasScatterType
=
function
(
targets
)
{
var
hasScatterType
=
c3_chart_internal_fn
.
hasScatterType
=
function
(
targets
)
{
return
this
.
hasType
(
targets
,
'scatter'
);
return
hasType
.
call
(
this
,
targets
,
'scatter'
);
};
};
c3_chart_internal_fn
.
hasPieType
=
function
(
targets
)
{
var
hasPieType
=
c3_chart_internal_fn
.
hasPieType
=
function
(
targets
)
{
return
this
.
config
.
data_type
===
'pie'
||
this
.
hasType
(
targets
,
'pie'
);
return
this
.
config
.
data_type
===
'pie'
||
hasType
.
call
(
this
,
targets
,
'pie'
);
};
};
c3_chart_internal_fn
.
hasGaugeType
=
function
(
targets
)
{
var
hasGaugeType
=
c3_chart_internal_fn
.
hasGaugeType
=
function
(
targets
)
{
return
this
.
hasType
(
targets
,
'gauge'
);
return
hasType
.
call
(
this
,
targets
,
'gauge'
);
};
};
c3_chart_internal_fn
.
hasDonutType
=
function
(
targets
)
{
var
hasDonutType
=
c3_chart_internal_fn
.
hasDonutType
=
function
(
targets
)
{
return
this
.
config
.
data_type
===
'donut'
||
this
.
hasType
(
targets
,
'donut'
);
return
this
.
config
.
data_type
===
'donut'
||
hasType
.
call
(
this
,
targets
,
'donut'
);
};
};
c3_chart_internal_fn
.
hasArcType
=
function
(
targets
)
{
var
hasArcType
=
c3_chart_internal_fn
.
hasArcType
=
function
(
targets
)
{
return
this
.
hasPieType
(
targets
)
||
this
.
hasDonutType
(
targets
)
||
this
.
hasGaugeType
(
targets
);
return
hasPieType
.
call
(
this
,
targets
)
||
hasDonutType
.
call
(
this
,
targets
)
||
hasGaugeType
.
call
(
this
,
targets
);
};
};
c3_chart_internal_fn
.
isLineType
=
function
(
d
)
{
var
isLineType
=
c3_chart_internal_fn
.
isLineType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
!
this
.
config
.
data_types
[
id
]
||
[
'line'
,
'spline'
,
'area'
,
'area-spline'
,
'step'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
return
!
this
.
config
.
data_types
[
id
]
||
[
'line'
,
'spline'
,
'area'
,
'area-spline'
,
'step'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
};
};
c3_chart_internal_fn
.
isStepType
=
function
(
d
)
{
var
isStepType
=
c3_chart_internal_fn
.
isStepType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
[
'step'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
return
[
'step'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
};
};
c3_chart_internal_fn
.
isSplineType
=
function
(
d
)
{
var
isSplineType
=
c3_chart_internal_fn
.
isSplineType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
[
'spline'
,
'area-spline'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
return
[
'spline'
,
'area-spline'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
};
};
c3_chart_internal_fn
.
isAreaType
=
function
(
d
)
{
var
isAreaType
=
c3_chart_internal_fn
.
isAreaType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
[
'area'
,
'area-spline'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
return
[
'area'
,
'area-spline'
,
'area-step'
].
indexOf
(
this
.
config
.
data_types
[
id
])
>=
0
;
};
};
c3_chart_internal_fn
.
isBarType
=
function
(
d
)
{
var
isBarType
=
c3_chart_internal_fn
.
isBarType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
this
.
config
.
data_types
[
id
]
===
'bar'
;
return
this
.
config
.
data_types
[
id
]
===
'bar'
;
};
};
c3_chart_internal_fn
.
isScatterType
=
function
(
d
)
{
var
isScatterType
=
c3_chart_internal_fn
.
isScatterType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
this
.
config
.
data_types
[
id
]
===
'scatter'
;
return
this
.
config
.
data_types
[
id
]
===
'scatter'
;
};
};
c3_chart_internal_fn
.
isPieType
=
function
(
d
)
{
var
isPieType
=
c3_chart_internal_fn
.
isPieType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
this
.
config
.
data_types
[
id
]
===
'pie'
;
return
this
.
config
.
data_types
[
id
]
===
'pie'
;
};
};
c3_chart_internal_fn
.
isGaugeType
=
function
(
d
)
{
var
isGaugeType
=
c3_chart_internal_fn
.
isGaugeType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
this
.
config
.
data_types
[
id
]
===
'gauge'
;
return
this
.
config
.
data_types
[
id
]
===
'gauge'
;
};
};
c3_chart_internal_fn
.
isDonutType
=
function
(
d
)
{
var
isDonutType
=
c3_chart_internal_fn
.
isDonutType
=
function
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
;
return
this
.
config
.
data_types
[
id
]
===
'donut'
;
return
this
.
config
.
data_types
[
id
]
===
'donut'
;
};
};
c3_chart_internal_fn
.
isArcType
=
function
(
d
)
{
var
isArcType
=
c3_chart_internal_fn
.
isArcType
=
function
(
d
)
{
return
this
.
isPieType
(
d
)
||
this
.
isDonutType
(
d
)
||
this
.
isGaugeType
(
d
);
return
isPieType
.
call
(
this
,
d
)
||
isDonutType
.
call
(
this
,
d
)
||
isGaugeType
.
call
(
this
,
d
);
};
};
c3_chart_internal_fn
.
lineData
=
function
(
d
)
{
var
lineData
=
c3_chart_internal_fn
.
lineData
=
function
(
d
)
{
return
this
.
isLineType
(
d
)
?
[
d
]
:
[];
return
isLineType
.
call
(
this
,
d
)
?
[
d
]
:
[];
};
};
c3_chart_internal_fn
.
arcData
=
function
(
d
)
{
var
arcData
=
c3_chart_internal_fn
.
arcData
=
function
(
d
)
{
return
this
.
isArcType
(
d
.
data
)
?
[
d
]
:
[];
return
isArcType
.
call
(
this
,
d
.
data
)
?
[
d
]
:
[];
};
};
/* not used
/* not used
function scatterData(d) {
function scatterData(d) {
return isScatterType(d) ? d.values : [];
return isScatterType(d) ? d.values : [];
}
}
*/
*/
c3_chart_internal_fn
.
barData
=
function
(
d
)
{
var
barData
=
c3_chart_internal_fn
.
barData
=
function
(
d
)
{
return
this
.
isBarType
(
d
)
?
d
.
values
:
[];
return
isBarType
.
call
(
this
,
d
)
?
d
.
values
:
[];
};
};
c3_chart_internal_fn
.
lineOrScatterData
=
function
(
d
)
{
var
lineOrScatterData
=
c3_chart_internal_fn
.
lineOrScatterData
=
function
(
d
)
{
return
this
.
isLineType
(
d
)
||
this
.
isScatterType
(
d
)
?
d
.
values
:
[];
return
isLineType
.
call
(
this
,
d
)
||
isScatterType
.
call
(
this
,
d
)
?
d
.
values
:
[];
};
};
c3_chart_internal_fn
.
barOrLineData
=
function
(
d
)
{
var
barOrLineData
=
c3_chart_internal_fn
.
barOrLineData
=
function
(
d
)
{
return
this
.
isBarType
(
d
)
||
this
.
isLineType
(
d
)
?
d
.
values
:
[];
return
isBarType
.
call
(
this
,
d
)
||
isLineType
.
call
(
this
,
d
)
?
d
.
values
:
[];
};
};
...
@@ -3767,11 +3606,11 @@
...
@@ -3767,11 +3606,11 @@
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
c
.
axis_y2_tick_format
,
c
.
axis_y2_ticks
);
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
c
.
axis_y2_tick_format
,
c
.
axis_y2_ticks
);
// Set initialized scales to brush and zoom
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
if
(
!
forInit
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
if
(
$$
.
brush
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
}
if
(
c
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
if
(
c
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
}
}
// update for arc
// update for arc
if
(
isFunction
(
updateArc
))
{
updateArc
.
call
(
$$
);
}
if
(
isFunction
Type
(
updateArc
))
{
updateArc
.
call
(
$$
);
}
};
};
...
@@ -3850,7 +3689,7 @@
...
@@ -3850,7 +3689,7 @@
domainLength
,
padding
,
padding_top
,
padding_bottom
,
domainLength
,
padding
,
padding_top
,
padding_bottom
,
center
=
axisId
===
'y2'
?
c
.
axis_y2_center
:
c
.
axis_y_center
,
center
=
axisId
===
'y2'
?
c
.
axis_y2_center
:
c
.
axis_y_center
,
yDomainAbs
,
lengths
,
diff
,
ratio
,
isAllPositive
,
isAllNegative
,
yDomainAbs
,
lengths
,
diff
,
ratio
,
isAllPositive
,
isAllNegative
,
isZeroBased
=
(
$$
.
hasBarType
(
yTargets
)
&&
c
.
bar_zerobased
)
||
(
$$
.
hasAreaType
(
yTargets
)
&&
c
.
area_zerobased
),
isZeroBased
=
(
hasBarType
.
call
(
$$
,
yTargets
)
&&
c
.
bar_zerobased
)
||
(
hasAreaType
.
call
(
$$
,
yTargets
)
&&
c
.
area_zerobased
),
showHorizontalDataLabel
=
$$
.
hasDataLabel
()
&&
c
.
axis_rotated
,
showHorizontalDataLabel
=
$$
.
hasDataLabel
()
&&
c
.
axis_rotated
,
showVerticalDataLabel
=
$$
.
hasDataLabel
()
&&
!
c
.
axis_rotated
;
showVerticalDataLabel
=
$$
.
hasDataLabel
()
&&
!
c
.
axis_rotated
;
if
(
yTargets
.
length
===
0
)
{
// use current domain if target of axisId is none
if
(
yTargets
.
length
===
0
)
{
// use current domain if target of axisId is none
...
@@ -3917,7 +3756,7 @@
...
@@ -3917,7 +3756,7 @@
maxDataCount
,
padding
,
paddingLeft
,
paddingRight
;
maxDataCount
,
padding
,
paddingLeft
,
paddingRight
;
if
(
$$
.
isCategorized
)
{
if
(
$$
.
isCategorized
)
{
padding
=
0
;
padding
=
0
;
}
else
if
(
this
.
hasBarType
(
targets
))
{
}
else
if
(
hasBarType
.
call
(
this
,
targets
))
{
maxDataCount
=
this
.
getMaxDataCount
();
maxDataCount
=
this
.
getMaxDataCount
();
padding
=
maxDataCount
>
1
?
(
diff
/
(
maxDataCount
-
1
))
/
2
:
0.5
;
padding
=
maxDataCount
>
1
?
(
diff
/
(
maxDataCount
-
1
))
/
2
:
0.5
;
}
else
{
}
else
{
...
@@ -3959,10 +3798,10 @@
...
@@ -3959,10 +3798,10 @@
$$
.
orgXDomain
=
$$
.
x
.
domain
();
$$
.
orgXDomain
=
$$
.
x
.
domain
();
if
(
$$
.
config
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
).
updateScaleExtent
();
}
if
(
$$
.
config
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
).
updateScaleExtent
();
}
$$
.
subX
.
domain
(
$$
.
x
.
domain
());
$$
.
subX
.
domain
(
$$
.
x
.
domain
());
$$
.
brush
.
scale
(
$$
.
subX
);
if
(
$$
.
brush
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
}
}
}
if
(
withUpdateXDomain
)
{
if
(
withUpdateXDomain
)
{
$$
.
x
.
domain
(
domain
?
domain
:
$$
.
brush
.
empty
(
)
?
$$
.
orgXDomain
:
$$
.
brush
.
extent
());
$$
.
x
.
domain
(
domain
?
domain
:
(
!
$$
.
brush
||
$$
.
brush
.
empty
()
)
?
$$
.
orgXDomain
:
$$
.
brush
.
extent
());
if
(
$$
.
config
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
).
updateScaleExtent
();
}
if
(
$$
.
config
.
zoom_enabled
)
{
$$
.
zoom
.
scale
(
$$
.
x
).
updateScaleExtent
();
}
}
}
return
$$
.
x
.
domain
();
return
$$
.
x
.
domain
();
...
@@ -4325,7 +4164,7 @@
...
@@ -4325,7 +4164,7 @@
$$
.
radiusExpanded
=
Math
.
min
(
$$
.
arcWidth
,
$$
.
arcHeight
)
/
2
;
$$
.
radiusExpanded
=
Math
.
min
(
$$
.
arcWidth
,
$$
.
arcHeight
)
/
2
;
$$
.
radius
=
$$
.
radiusExpanded
*
0.95
;
$$
.
radius
=
$$
.
radiusExpanded
*
0.95
;
$$
.
innerRadiusRatio
=
w
?
(
$$
.
radius
-
w
)
/
$$
.
radius
:
0.6
;
$$
.
innerRadiusRatio
=
w
?
(
$$
.
radius
-
w
)
/
$$
.
radius
:
0.6
;
$$
.
innerRadius
=
$$
.
hasDonutType
(
$$
.
data
.
targets
)
||
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
?
$$
.
radius
*
$$
.
innerRadiusRatio
:
0
;
$$
.
innerRadius
=
hasDonutType
.
call
(
$$
,
$$
.
data
.
targets
)
||
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
?
$$
.
radius
*
$$
.
innerRadiusRatio
:
0
;
};
};
var
updateArc
=
c3_chart_internal_fn
.
updateArc
=
function
()
{
var
updateArc
=
c3_chart_internal_fn
.
updateArc
=
function
()
{
...
@@ -4349,7 +4188,7 @@
...
@@ -4349,7 +4188,7 @@
if
(
isNaN
(
d
.
endAngle
))
{
if
(
isNaN
(
d
.
endAngle
))
{
d
.
endAngle
=
d
.
startAngle
;
d
.
endAngle
=
d
.
startAngle
;
}
}
if
(
$$
.
isGaugeType
(
d
.
data
))
{
if
(
isGaugeType
.
call
(
$$
,
d
.
data
))
{
var
gMin
=
$$
.
config
.
gauge_min
,
gMax
=
$$
.
config
.
gauge_max
,
var
gMin
=
$$
.
config
.
gauge_min
,
gMax
=
$$
.
config
.
gauge_max
,
gF
=
Math
.
abs
(
gMin
)
+
gMax
,
gF
=
Math
.
abs
(
gMin
)
+
gMax
,
aTic
=
(
Math
.
PI
)
/
gF
;
aTic
=
(
Math
.
PI
)
/
gF
;
...
@@ -4383,14 +4222,14 @@
...
@@ -4383,14 +4222,14 @@
};
};
var
getArc
=
c3_chart_internal_fn
.
getArc
=
function
(
d
,
withoutUpdate
,
force
)
{
var
getArc
=
c3_chart_internal_fn
.
getArc
=
function
(
d
,
withoutUpdate
,
force
)
{
return
force
||
this
.
isArcType
(
d
.
data
)
?
this
.
svgArc
(
d
,
withoutUpdate
)
:
"M 0 0"
;
return
force
||
isArcType
.
call
(
this
,
d
.
data
)
?
this
.
svgArc
(
d
,
withoutUpdate
)
:
"M 0 0"
;
};
};
var
transformForArcLabel
=
c3_chart_internal_fn
.
transformForArcLabel
=
function
(
d
)
{
var
transformForArcLabel
=
c3_chart_internal_fn
.
transformForArcLabel
=
function
(
d
)
{
var
$$
=
this
,
var
$$
=
this
,
updated
=
updateAngle
.
call
(
$$
,
d
),
c
,
x
,
y
,
h
,
ratio
,
translate
=
""
;
updated
=
updateAngle
.
call
(
$$
,
d
),
c
,
x
,
y
,
h
,
ratio
,
translate
=
""
;
if
(
updated
&&
!
$$
.
hasGaugeType
(
$$
.
data
.
targets
))
{
if
(
updated
&&
!
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
))
{
c
=
this
.
svgArc
.
centroid
(
updated
);
c
=
this
.
svgArc
.
centroid
(
updated
);
x
=
isNaN
(
c
[
0
])
?
0
:
c
[
0
];
x
=
isNaN
(
c
[
0
])
?
0
:
c
[
0
];
y
=
isNaN
(
c
[
1
])
?
0
:
c
[
1
];
y
=
isNaN
(
c
[
1
])
?
0
:
c
[
1
];
...
@@ -4404,7 +4243,7 @@
...
@@ -4404,7 +4243,7 @@
var
getArcRatio
=
c3_chart_internal_fn
.
getArcRatio
=
function
(
d
)
{
var
getArcRatio
=
c3_chart_internal_fn
.
getArcRatio
=
function
(
d
)
{
var
$$
=
this
,
var
$$
=
this
,
whole
=
this
.
hasGaugeType
(
$$
.
data
.
targets
)
?
Math
.
PI
:
(
Math
.
PI
*
2
);
whole
=
hasGaugeType
.
call
(
this
,
$$
.
data
.
targets
)
?
Math
.
PI
:
(
Math
.
PI
*
2
);
return
d
?
(
d
.
endAngle
-
d
.
startAngle
)
/
whole
:
null
;
return
d
?
(
d
.
endAngle
-
d
.
startAngle
)
/
whole
:
null
;
};
};
...
@@ -4424,14 +4263,14 @@
...
@@ -4424,14 +4263,14 @@
updated
=
updateAngle
.
call
(
$$
,
d
);
updated
=
updateAngle
.
call
(
$$
,
d
);
value
=
updated
?
updated
.
value
:
null
;
value
=
updated
?
updated
.
value
:
null
;
ratio
=
getArcRatio
.
call
(
$$
,
updated
);
ratio
=
getArcRatio
.
call
(
$$
,
updated
);
if
(
!
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
&&
!
meetsArcLabelThreshold
.
call
(
$$
,
ratio
))
{
return
""
;
}
if
(
!
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
&&
!
meetsArcLabelThreshold
.
call
(
$$
,
ratio
))
{
return
""
;
}
format
=
getArcLabelFormat
.
call
(
$$
);
format
=
getArcLabelFormat
.
call
(
$$
);
return
format
?
format
(
value
,
ratio
)
:
$$
.
defaultArcValueFormat
(
value
,
ratio
);
return
format
?
format
(
value
,
ratio
)
:
$$
.
defaultArcValueFormat
(
value
,
ratio
);
};
};
var
expandArc
=
c3_chart_internal_fn
.
expandArc
=
function
(
id
,
withoutFadeOut
)
{
var
expandArc
=
c3_chart_internal_fn
.
expandArc
=
function
(
id
,
withoutFadeOut
)
{
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
target
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
chartArc
+
$$
.
selectorTarget
(
id
)),
target
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
chartArc
+
selectorTarget
.
call
(
$$
,
id
)),
noneTargets
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
arc
).
filter
(
function
(
data
)
{
return
data
.
data
.
id
!==
id
;
});
noneTargets
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
arc
).
filter
(
function
(
data
)
{
return
data
.
data
.
id
!==
id
;
});
if
(
shouldExpand
.
call
(
$$
,
id
))
{
if
(
shouldExpand
.
call
(
$$
,
id
))
{
...
@@ -4441,7 +4280,7 @@
...
@@ -4441,7 +4280,7 @@
.
transition
().
duration
(
100
)
.
transition
().
duration
(
100
)
.
attr
(
"d"
,
$$
.
svgArcExpandedSub
)
.
attr
(
"d"
,
$$
.
svgArcExpandedSub
)
.
each
(
function
(
d
)
{
.
each
(
function
(
d
)
{
if
(
$$
.
isDonutType
(
d
.
data
))
{
if
(
isDonutType
.
call
(
$$
,
d
.
data
))
{
// callback here
// callback here
}
}
});
});
...
@@ -4453,7 +4292,7 @@
...
@@ -4453,7 +4292,7 @@
var
unexpandArc
=
c3_chart_internal_fn
.
unexpandArc
=
function
(
id
)
{
var
unexpandArc
=
c3_chart_internal_fn
.
unexpandArc
=
function
(
id
)
{
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
target
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
chartArc
+
$$
.
selectorTarget
(
id
));
target
=
$$
.
svg
.
selectAll
(
'.'
+
CLASS
.
chartArc
+
selectorTarget
.
call
(
$$
,
id
));
target
.
selectAll
(
'path.'
+
CLASS
.
arc
)
target
.
selectAll
(
'path.'
+
CLASS
.
arc
)
.
transition
().
duration
(
50
)
.
transition
().
duration
(
50
)
.
attr
(
"d"
,
$$
.
svgArc
);
.
attr
(
"d"
,
$$
.
svgArc
);
...
@@ -4463,14 +4302,14 @@
...
@@ -4463,14 +4302,14 @@
var
shouldExpand
=
c3_chart_internal_fn
.
shouldExpand
=
function
(
id
)
{
var
shouldExpand
=
c3_chart_internal_fn
.
shouldExpand
=
function
(
id
)
{
var
$$
=
this
;
var
$$
=
this
;
return
(
$$
.
isDonutType
(
id
)
&&
$$
.
config
.
donut_expand
)
||
(
$$
.
isGaugeType
(
id
)
&&
$$
.
config
.
gauge_expand
)
||
(
$$
.
isPieType
(
id
)
&&
$$
.
config
.
pie_expand
);
return
(
isDonutType
.
call
(
$$
,
id
)
&&
$$
.
config
.
donut_expand
)
||
(
isGaugeType
.
call
(
$$
,
id
)
&&
$$
.
config
.
gauge_expand
)
||
(
isPieType
.
call
(
$$
,
id
)
&&
$$
.
config
.
pie_expand
);
};
};
var
shouldShowArcLabel
=
c3_chart_internal_fn
.
shouldShowArcLabel
=
function
()
{
var
shouldShowArcLabel
=
c3_chart_internal_fn
.
shouldShowArcLabel
=
function
()
{
var
$$
=
this
,
shouldShow
=
true
;
var
$$
=
this
,
shouldShow
=
true
;
if
(
$$
.
hasDonutType
(
$$
.
data
.
targets
))
{
if
(
hasDonutType
.
call
(
$$
,
$$
.
data
.
targets
))
{
shouldShow
=
$$
.
config
.
donut_label_show
;
shouldShow
=
$$
.
config
.
donut_label_show
;
}
else
if
(
$$
.
hasPieType
(
$$
.
data
.
targets
))
{
}
else
if
(
hasPieType
.
call
(
$$
,
$$
.
data
.
targets
))
{
shouldShow
=
$$
.
config
.
pie_label_show
;
shouldShow
=
$$
.
config
.
pie_label_show
;
}
}
// when gauge, always true
// when gauge, always true
...
@@ -4479,16 +4318,16 @@
...
@@ -4479,16 +4318,16 @@
var
meetsArcLabelThreshold
=
c3_chart_internal_fn
.
meetsArcLabelThreshold
=
function
(
ratio
)
{
var
meetsArcLabelThreshold
=
c3_chart_internal_fn
.
meetsArcLabelThreshold
=
function
(
ratio
)
{
var
$$
=
this
,
c
=
$$
.
config
,
var
$$
=
this
,
c
=
$$
.
config
,
threshold
=
this
.
hasDonutType
(
$$
.
data
.
targets
)
?
c
.
donut_label_threshold
:
c
.
pie_label_threshold
;
threshold
=
hasDonutType
.
call
(
this
,
$$
.
data
.
targets
)
?
c
.
donut_label_threshold
:
c
.
pie_label_threshold
;
return
ratio
>=
threshold
;
return
ratio
>=
threshold
;
};
};
var
getArcLabelFormat
=
c3_chart_internal_fn
.
getArcLabelFormat
=
function
()
{
var
getArcLabelFormat
=
c3_chart_internal_fn
.
getArcLabelFormat
=
function
()
{
var
$$
=
this
,
var
$$
=
this
,
format
=
$$
.
config
.
pie_label_format
;
format
=
$$
.
config
.
pie_label_format
;
if
(
$$
.
hasGaugeType
(
$$
.
data
.
targets
))
{
if
(
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
))
{
format
=
$$
.
config
.
gauge_label_format
;
format
=
$$
.
config
.
gauge_label_format
;
}
else
if
(
$$
.
hasDonutType
(
$$
.
data
.
targets
))
{
}
else
if
(
hasDonutType
.
call
(
$$
,
$$
.
data
.
targets
))
{
format
=
$$
.
config
.
donut_label_format
;
format
=
$$
.
config
.
donut_label_format
;
}
}
return
format
;
return
format
;
...
@@ -4496,7 +4335,7 @@
...
@@ -4496,7 +4335,7 @@
var
getArcTitle
=
c3_chart_internal_fn
.
getArcTitle
=
function
()
{
var
getArcTitle
=
c3_chart_internal_fn
.
getArcTitle
=
function
()
{
var
$$
=
this
;
var
$$
=
this
;
return
$$
.
hasDonutType
(
$$
.
data
.
targets
)
?
$$
.
config
.
donut_title
:
""
;
return
hasDonutType
.
call
(
$$
,
$$
.
data
.
targets
)
?
$$
.
config
.
donut_title
:
""
;
};
};
var
descByStartAngle
=
c3_chart_internal_fn
.
descByStartAngle
=
function
(
a
,
b
)
{
var
descByStartAngle
=
c3_chart_internal_fn
.
descByStartAngle
=
function
(
a
,
b
)
{
...
@@ -4507,13 +4346,13 @@
...
@@ -4507,13 +4346,13 @@
var
$$
=
this
,
main
=
$$
.
main
,
mainPieUpdate
,
mainPieEnter
;
var
$$
=
this
,
main
=
$$
.
main
,
mainPieUpdate
,
mainPieEnter
;
mainPieUpdate
=
main
.
select
(
'.'
+
$$
.
CLASS
.
chartArcs
).
selectAll
(
'.'
+
$$
.
CLASS
.
chartArc
)
mainPieUpdate
=
main
.
select
(
'.'
+
$$
.
CLASS
.
chartArcs
).
selectAll
(
'.'
+
$$
.
CLASS
.
chartArc
)
.
data
(
$$
.
pie
(
targets
))
.
data
(
$$
.
pie
(
targets
))
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classChartArc
(
d
);
});
.
attr
(
"class"
,
function
(
d
)
{
return
classChartArc
.
call
(
$$
,
d
);
});
mainPieEnter
=
mainPieUpdate
.
enter
().
append
(
"g"
)
mainPieEnter
=
mainPieUpdate
.
enter
().
append
(
"g"
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classChartArc
(
d
);
});
.
attr
(
"class"
,
function
(
d
)
{
return
classChartArc
.
call
(
$$
,
d
);
});
mainPieEnter
.
append
(
'g'
)
mainPieEnter
.
append
(
'g'
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
classArcs
(
d
);
});
.
attr
(
'class'
,
function
(
d
)
{
return
classArcs
.
call
(
$$
,
d
);
});
mainPieEnter
.
append
(
"text"
)
mainPieEnter
.
append
(
"text"
)
.
attr
(
"dy"
,
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
?
"-0.35em"
:
".35em"
)
.
attr
(
"dy"
,
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
?
"-0.35em"
:
".35em"
)
.
style
(
"opacity"
,
0
)
.
style
(
"opacity"
,
0
)
.
style
(
"text-anchor"
,
"middle"
)
.
style
(
"text-anchor"
,
"middle"
)
.
style
(
"pointer-events"
,
"none"
);
.
style
(
"pointer-events"
,
"none"
);
...
@@ -4536,14 +4375,14 @@
...
@@ -4536,14 +4375,14 @@
var
$$
=
this
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
,
main
=
$$
.
main
,
var
$$
=
this
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
,
main
=
$$
.
main
,
mainArc
;
mainArc
;
mainArc
=
main
.
selectAll
(
'.'
+
CLASS
.
arcs
).
selectAll
(
'.'
+
CLASS
.
arc
)
mainArc
=
main
.
selectAll
(
'.'
+
CLASS
.
arcs
).
selectAll
(
'.'
+
CLASS
.
arc
)
.
data
(
function
(
d
)
{
return
$$
.
arcData
(
d
);
});
.
data
(
function
(
d
)
{
return
arcData
.
call
(
$$
,
d
);
});
mainArc
.
enter
().
append
(
'path'
)
mainArc
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
$$
.
classArc
(
d
);
})
.
attr
(
"class"
,
function
(
d
)
{
return
classArc
.
call
(
$$
,
d
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
.
data
);
})
.
style
(
"fill"
,
function
(
d
)
{
return
$$
.
color
(
d
.
data
);
})
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
})
.
style
(
"cursor"
,
function
(
d
)
{
return
$$
.
config
.
data_selection_isselectable
(
d
)
?
"pointer"
:
null
;
})
.
style
(
"opacity"
,
0
)
.
style
(
"opacity"
,
0
)
.
each
(
function
(
d
)
{
.
each
(
function
(
d
)
{
if
(
$$
.
isGaugeType
(
d
.
data
))
{
if
(
isGaugeType
.
call
(
$$
,
d
.
data
))
{
d
.
startAngle
=
d
.
endAngle
=
-
1
*
(
Math
.
PI
/
2
);
d
.
startAngle
=
d
.
endAngle
=
-
1
*
(
Math
.
PI
/
2
);
}
}
this
.
_current
=
d
;
this
.
_current
=
d
;
...
@@ -4585,7 +4424,7 @@
...
@@ -4585,7 +4424,7 @@
$$
.
toggleShape
(
this
,
arcData
,
i
);
// onclick called in toogleShape()
$$
.
toggleShape
(
this
,
arcData
,
i
);
// onclick called in toogleShape()
});
});
mainArc
mainArc
.
attr
(
"transform"
,
function
(
d
)
{
return
!
$$
.
isGaugeType
(
d
.
data
)
&&
withTransform
?
"scale(0)"
:
""
;
})
.
attr
(
"transform"
,
function
(
d
)
{
return
!
isGaugeType
.
call
(
$$
,
d
.
data
)
&&
withTransform
?
"scale(0)"
:
""
;
})
.
style
(
"opacity"
,
function
(
d
)
{
return
d
===
this
.
_current
?
0
:
1
;
})
.
style
(
"opacity"
,
function
(
d
)
{
return
d
===
this
.
_current
?
0
:
1
;
})
.
each
(
function
()
{
$$
.
transiting
=
true
;
})
.
each
(
function
()
{
$$
.
transiting
=
true
;
})
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
...
@@ -4620,13 +4459,13 @@
...
@@ -4620,13 +4459,13 @@
.
remove
();
.
remove
();
main
.
selectAll
(
'.'
+
CLASS
.
chartArc
).
select
(
'text'
)
main
.
selectAll
(
'.'
+
CLASS
.
chartArc
).
select
(
'text'
)
.
style
(
"opacity"
,
0
)
.
style
(
"opacity"
,
0
)
.
attr
(
'class'
,
function
(
d
)
{
return
$$
.
isGaugeType
(
d
.
data
)
?
CLASS
.
gaugeValue
:
''
;
})
.
attr
(
'class'
,
function
(
d
)
{
return
isGaugeType
.
call
(
$$
,
d
.
data
)
?
CLASS
.
gaugeValue
:
''
;
})
.
text
(
function
(
d
)
{
return
textForArcLabel
.
call
(
$$
,
d
);
})
.
text
(
function
(
d
)
{
return
textForArcLabel
.
call
(
$$
,
d
);
})
.
attr
(
"transform"
,
function
(
d
)
{
return
transformForArcLabel
.
call
(
$$
,
d
);
})
.
attr
(
"transform"
,
function
(
d
)
{
return
transformForArcLabel
.
call
(
$$
,
d
);
})
.
transition
().
duration
(
duration
)
.
transition
().
duration
(
duration
)
.
style
(
"opacity"
,
function
(
d
)
{
return
$$
.
isTargetToShow
(
d
.
data
.
id
)
&&
$$
.
isArcType
(
d
.
data
)
?
1
:
0
;
});
.
style
(
"opacity"
,
function
(
d
)
{
return
$$
.
isTargetToShow
(
d
.
data
.
id
)
&&
isArcType
.
call
(
$$
,
d
.
data
)
?
1
:
0
;
});
main
.
select
(
'.'
+
CLASS
.
chartArcsTitle
)
main
.
select
(
'.'
+
CLASS
.
chartArcsTitle
)
.
style
(
"opacity"
,
$$
.
hasDonutType
(
$$
.
data
.
targets
)
||
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
?
1
:
0
);
.
style
(
"opacity"
,
hasDonutType
.
call
(
$$
,
$$
.
data
.
targets
)
||
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
?
1
:
0
);
};
};
...
@@ -4634,7 +4473,7 @@
...
@@ -4634,7 +4473,7 @@
var
initGauge
=
c3_chart_internal_fn
.
initGauge
=
function
()
{
var
initGauge
=
c3_chart_internal_fn
.
initGauge
=
function
()
{
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
c
=
$$
.
config
,
arcs
;
var
$$
=
this
,
CLASS
=
$$
.
CLASS
,
c
=
$$
.
config
,
arcs
;
if
(
$$
.
hasGaugeType
(
$$
.
data
.
targets
))
{
if
(
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
))
{
arcs
.
append
(
'path'
)
arcs
.
append
(
'path'
)
.
attr
(
"class"
,
CLASS
.
chartArcsBackground
)
.
attr
(
"class"
,
CLASS
.
chartArcsBackground
)
.
attr
(
"d"
,
function
()
{
.
attr
(
"d"
,
function
()
{
...
@@ -4689,6 +4528,182 @@
...
@@ -4689,6 +4528,182 @@
return
targets
;
return
targets
;
};
};
//-- subchart.js --//
var
initBrush
=
c3_chart_internal_fn
.
initBrush
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
;
$$
.
brush
=
d3
.
svg
.
brush
().
on
(
"brush"
,
function
()
{
redrawForBrush
.
call
(
$$
);
});
$$
.
brush
.
update
=
function
()
{
if
(
$$
.
context
)
{
$$
.
context
.
select
(
'.'
+
$$
.
CLASS
.
brush
).
call
(
this
);
}
return
this
;
};
$$
.
brush
.
scale
=
function
(
scale
)
{
return
$$
.
config
.
axis_rotated
?
this
.
y
(
scale
)
:
this
.
x
(
scale
);
};
};
var
initSubchart
=
c3_chart_internal_fn
.
initSubchart
=
function
()
{
var
$$
=
this
,
c
=
$$
.
config
,
context
=
$$
.
context
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
translate
.
context
);
if
(
!
c
.
subchart_show
)
{
context
.
style
(
'visibility'
,
'hidden'
);
}
// Define g for chart area
context
.
append
(
'g'
)
.
attr
(
"clip-path"
,
$$
.
clipPath
)
.
attr
(
'class'
,
CLASS
.
chart
);
// Define g for bar chart area
context
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
chartBars
);
// Define g for line chart area
context
.
select
(
'.'
+
CLASS
.
chart
).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
chartLines
);
// Add extent rect for Brush
context
.
append
(
"g"
)
.
attr
(
"clip-path"
,
$$
.
clipPath
)
.
attr
(
"class"
,
CLASS
.
brush
)
.
call
(
$$
.
brush
)
.
selectAll
(
"rect"
)
.
attr
(
c
.
axis_rotated
?
"width"
:
"height"
,
c
.
axis_rotated
?
$$
.
width2
:
$$
.
height2
);
// ATTENTION: This must be called AFTER chart added
// Add Axis
$$
.
axes
.
subx
=
context
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axisX
)
.
attr
(
"transform"
,
$$
.
translate
.
subx
)
.
attr
(
"clip-path"
,
c
.
axis_rotated
?
""
:
$$
.
clipPathForXAxis
);
};
var
updateTargetsForSubchart
=
c3_chart_internal_fn
.
updateTargetsForSubchart
=
function
(
targets
)
{
var
$$
=
this
,
context
=
$$
.
context
,
c
=
$$
.
config
,
contextLineEnter
,
contextLineUpdate
,
contextBarEnter
,
contextBarUpdate
;
if
(
c
.
subchart_show
)
{
contextBarUpdate
=
context
.
select
(
'.'
+
CLASS
.
chartBars
).
selectAll
(
'.'
+
CLASS
.
chartBar
)
.
data
(
targets
)
.
attr
(
'class'
,
function
(
d
)
{
return
classChartBar
.
call
(
$$
,
d
);
});
contextBarEnter
=
contextBarUpdate
.
enter
().
append
(
'g'
)
.
style
(
'opacity'
,
0
)
.
attr
(
'class'
,
function
(
d
)
{
return
classChartBar
.
call
(
$$
,
d
);
});
// Bars for each data
contextBarEnter
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
)
{
return
classBars
.
call
(
$$
,
d
);
});
//-- Line --//
contextLineUpdate
=
context
.
select
(
'.'
+
CLASS
.
chartLines
).
selectAll
(
'.'
+
CLASS
.
chartLine
)
.
data
(
targets
)
.
attr
(
'class'
,
function
(
d
)
{
return
classChartLine
.
call
(
$$
,
d
);
});
contextLineEnter
=
contextLineUpdate
.
enter
().
append
(
'g'
)
.
style
(
'opacity'
,
0
)
.
attr
(
'class'
,
function
(
d
)
{
return
classChartLine
.
call
(
$$
,
d
);
});
// Lines for each data
contextLineEnter
.
append
(
"g"
)
.
attr
(
"class"
,
function
(
d
)
{
return
classLines
.
call
(
$$
,
d
);
});
// Area
contextLineEnter
.
append
(
"g"
)
.
attr
(
"class"
,
function
(
d
)
{
return
classAreas
.
call
(
$$
,
d
);
});
}
};
var
redrawSubchart
=
c3_chart_internal_fn
.
redrawSubchart
=
function
(
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
)
{
var
$$
=
this
,
d3
=
$$
.
d3
,
context
=
$$
.
context
,
c
=
$$
.
config
,
contextLine
,
contextArea
,
contextBar
,
drawAreaOnSub
,
drawBarOnSub
,
drawLineOnSub
;
// subchart
if
(
c
.
subchart_show
)
{
// reflect main chart to extent on subchart if zoomed
if
(
d3
.
event
&&
d3
.
event
.
type
===
'zoom'
)
{
$$
.
brush
.
extent
(
$$
.
x
.
orgDomain
()).
update
();
}
// update subchart elements if needed
if
(
withSubchart
)
{
// rotate tick text if needed
if
(
!
c
.
axis_rotated
&&
c
.
axis_x_tick_rotate
)
{
$$
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
$$
.
config
.
axis_x_tick_rotate
);
}
// extent rect
if
(
!
$$
.
brush
.
empty
())
{
$$
.
brush
.
extent
(
$$
.
x
.
orgDomain
()).
update
();
}
// setup drawer - MEMO: this must be called after axis updated
drawAreaOnSub
=
$$
.
generateDrawArea
(
areaIndices
,
true
);
drawBarOnSub
=
$$
.
generateDrawBar
(
barIndices
,
true
);
drawLineOnSub
=
$$
.
generateDrawLine
(
lineIndices
,
true
);
// bars
contextBar
=
context
.
selectAll
(
'.'
+
CLASS
.
bars
).
selectAll
(
'.'
+
CLASS
.
bar
)
.
data
(
function
(
d
)
{
return
barData
.
call
(
$$
,
d
);
});
contextBar
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
classBar
.
call
(
$$
,
d
);
})
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill"
,
$$
.
color
);
contextBar
.
style
(
"opacity"
,
function
(
d
)
{
return
initialOpacity
.
call
(
$$
,
d
);
})
.
transition
().
duration
(
duration
)
.
attr
(
'd'
,
drawBarOnSub
)
.
style
(
'opacity'
,
1
);
contextBar
.
exit
().
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
0
)
.
remove
();
// lines
contextLine
=
context
.
selectAll
(
'.'
+
CLASS
.
lines
).
selectAll
(
'.'
+
CLASS
.
line
)
.
data
(
function
(
d
)
{
return
lineData
.
call
(
$$
,
d
);
});
contextLine
.
enter
().
append
(
'path'
)
.
attr
(
'class'
,
function
(
d
)
{
return
classLine
.
call
(
$$
,
d
);
})
.
style
(
'stroke'
,
$$
.
color
);
contextLine
.
style
(
"opacity"
,
function
(
d
)
{
return
initialOpacity
.
call
(
$$
,
d
);
})
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
drawLineOnSub
)
.
style
(
'opacity'
,
1
);
contextLine
.
exit
().
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
0
)
.
remove
();
// area
contextArea
=
context
.
selectAll
(
'.'
+
CLASS
.
areas
).
selectAll
(
'.'
+
CLASS
.
area
)
.
data
(
function
(
d
)
{
return
lineData
.
call
(
$$
,
d
);
});
contextArea
.
enter
().
append
(
'path'
)
.
attr
(
"class"
,
function
(
d
)
{
return
classArea
.
call
(
$$
,
d
);
})
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"opacity"
,
function
()
{
$$
.
orgAreaOpacity
=
+
d3
.
select
(
this
).
style
(
'opacity'
);
return
0
;
});
contextArea
.
style
(
"opacity"
,
0
)
.
transition
().
duration
(
duration
)
.
attr
(
"d"
,
drawAreaOnSub
)
.
style
(
"fill"
,
$$
.
color
)
.
style
(
"opacity"
,
$$
.
orgAreaOpacity
);
contextArea
.
exit
().
transition
().
duration
(
durationForExit
)
.
style
(
'opacity'
,
0
)
.
remove
();
}
}
};
var
redrawForBrush
=
c3_chart_internal_fn
.
redrawForBrush
=
function
()
{
var
$$
=
this
,
x
=
$$
.
x
;
$$
.
redraw
({
withTransition
:
false
,
withY
:
false
,
withSubchart
:
false
,
withUpdateXDomain
:
true
});
$$
.
config
.
subchart_onbrush
.
call
(
$$
,
x
.
orgDomain
());
};
var
transformContext
=
c3_chart_internal_fn
.
transformContext
=
function
(
withTransition
,
transitions
)
{
var
$$
=
this
,
subXAxis
;
if
(
transitions
&&
transitions
.
axisSubX
)
{
subXAxis
=
transitions
.
axisSubX
;
}
else
{
subXAxis
=
$$
.
context
.
select
(
'.'
+
$$
.
CLASS
.
axisX
);
if
(
withTransition
)
{
subXAxis
=
subXAxis
.
transition
();
}
}
$$
.
context
.
attr
(
"transform"
,
$$
.
translate
.
context
);
subXAxis
.
attr
(
"transform"
,
$$
.
translate
.
subx
);
};
/**
/**
* c3.zoom.js
* c3.zoom.js
...
@@ -4708,10 +4723,10 @@
...
@@ -4708,10 +4723,10 @@
c3_chart_internal_fn
.
isValue
=
function
(
v
)
{
c3_chart_internal_fn
.
isValue
=
function
(
v
)
{
return
v
||
v
===
0
;
return
v
||
v
===
0
;
};
};
function
isFunction
(
s
)
{
function
isFunction
Type
(
type
)
{
return
s
===
'function'
;
return
type
===
'function'
;
}
}
c3_chart_internal_fn
.
isFunction
=
isFunction
();
c3_chart_internal_fn
.
isFunction
Type
=
isFunctionType
();
c3_chart_internal_fn
.
isUndefined
=
function
(
v
)
{
c3_chart_internal_fn
.
isUndefined
=
function
(
v
)
{
return
typeof
v
===
'undefined'
;
return
typeof
v
===
'undefined'
;
};
};
...
@@ -4774,10 +4789,10 @@
...
@@ -4774,10 +4789,10 @@
var
$$
=
this
;
var
$$
=
this
;
$$
.
config
.
data_onselected
.
call
(
c3
,
d
,
target
.
node
());
$$
.
config
.
data_onselected
.
call
(
c3
,
d
,
target
.
node
());
// add selected-circle on low layer g
// add selected-circle on low layer g
$$
.
main
.
select
(
'.'
+
this
.
CLASS
.
selectedCircles
+
$$
.
getTargetSelectorSuffix
(
d
.
id
)).
selectAll
(
'.'
+
this
.
CLASS
.
selectedCircle
+
'-'
+
i
)
$$
.
main
.
select
(
'.'
+
this
.
CLASS
.
selectedCircles
+
getTargetSelectorSuffix
.
call
(
$$
,
d
.
id
)).
selectAll
(
'.'
+
this
.
CLASS
.
selectedCircle
+
'-'
+
i
)
.
data
([
d
])
.
data
([
d
])
.
enter
().
append
(
'circle'
)
.
enter
().
append
(
'circle'
)
.
attr
(
"class"
,
function
()
{
return
$$
.
generateClass
(
this
.
CLASS
.
selectedCircle
,
i
);
})
.
attr
(
"class"
,
function
()
{
return
generateClass
.
call
(
$$
,
this
.
CLASS
.
selectedCircle
,
i
);
})
.
attr
(
"cx"
,
$$
.
config
.
axis_rotated
?
$$
.
circleY
:
$$
.
circleX
)
.
attr
(
"cx"
,
$$
.
config
.
axis_rotated
?
$$
.
circleY
:
$$
.
circleX
)
.
attr
(
"cy"
,
$$
.
config
.
axis_rotated
?
$$
.
circleX
:
$$
.
circleY
)
.
attr
(
"cy"
,
$$
.
config
.
axis_rotated
?
$$
.
circleX
:
$$
.
circleY
)
.
attr
(
"stroke"
,
function
()
{
return
$$
.
color
(
d
);
})
.
attr
(
"stroke"
,
function
()
{
return
$$
.
color
(
d
);
})
...
@@ -4789,7 +4804,7 @@
...
@@ -4789,7 +4804,7 @@
var
$$
=
this
;
var
$$
=
this
;
$$
.
config
.
data_onunselected
.
call
(
c3
,
d
,
target
.
node
());
$$
.
config
.
data_onunselected
.
call
(
c3
,
d
,
target
.
node
());
// remove selected-circle from low layer g
// remove selected-circle from low layer g
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
selectedCircles
+
$$
.
getTargetSelectorSuffix
(
d
.
id
)).
selectAll
(
'.'
+
this
.
CLASS
.
selectedCircle
+
'-'
+
i
)
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
selectedCircles
+
getTargetSelectorSuffix
.
call
(
$$
,
d
.
id
)).
selectAll
(
'.'
+
this
.
CLASS
.
selectedCircle
+
'-'
+
i
)
.
transition
().
duration
(
100
).
attr
(
'r'
,
0
)
.
transition
().
duration
(
100
).
attr
(
'r'
,
0
)
.
remove
();
.
remove
();
};
};
...
@@ -4838,7 +4853,7 @@
...
@@ -4838,7 +4853,7 @@
if
(
$$
.
config
.
data_selection_grouped
||
isWithin
)
{
if
(
$$
.
config
.
data_selection_grouped
||
isWithin
)
{
if
(
$$
.
config
.
data_selection_enabled
&&
$$
.
config
.
data_selection_isselectable
(
d
))
{
if
(
$$
.
config
.
data_selection_enabled
&&
$$
.
config
.
data_selection_isselectable
(
d
))
{
if
(
!
$$
.
config
.
data_selection_multiple
)
{
if
(
!
$$
.
config
.
data_selection_multiple
)
{
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
(
$$
.
config
.
data_selection_grouped
?
$$
.
getTargetSelectorSuffix
(
d
.
id
)
:
""
)).
selectAll
(
'.'
+
CLASS
.
shape
).
each
(
function
(
d
,
i
)
{
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
(
$$
.
config
.
data_selection_grouped
?
getTargetSelectorSuffix
.
call
(
$$
,
d
.
id
)
:
""
)).
selectAll
(
'.'
+
CLASS
.
shape
).
each
(
function
(
d
,
i
)
{
var
shape
=
d3
.
select
(
this
);
var
shape
=
d3
.
select
(
this
);
if
(
shape
.
classed
(
CLASS
.
SELECTED
))
{
toggle
(
false
,
shape
.
classed
(
CLASS
.
SELECTED
,
false
),
d
,
i
);
}
if
(
shape
.
classed
(
CLASS
.
SELECTED
))
{
toggle
(
false
,
shape
.
classed
(
CLASS
.
SELECTED
,
false
),
d
,
i
);
}
});
});
...
@@ -4905,7 +4920,7 @@
...
@@ -4905,7 +4920,7 @@
*/
*/
c3_chart_internal_fn
.
transformTo
=
function
(
targetIds
,
type
,
optionsForRedraw
)
{
c3_chart_internal_fn
.
transformTo
=
function
(
targetIds
,
type
,
optionsForRedraw
)
{
var
$$
=
this
,
var
$$
=
this
,
withTransitionForAxis
=
!
$$
.
hasArcType
(
$$
.
data
.
targets
),
withTransitionForAxis
=
!
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
),
options
=
optionsForRedraw
||
{
withTransitionForAxis
:
withTransitionForAxis
};
options
=
optionsForRedraw
||
{
withTransitionForAxis
:
withTransitionForAxis
};
options
.
withTransitionForTransform
=
false
;
options
.
withTransitionForTransform
=
false
;
$$
.
transiting
=
false
;
$$
.
transiting
=
false
;
...
@@ -4917,7 +4932,7 @@
...
@@ -4917,7 +4932,7 @@
/**
/**
* c3.class.js
* c3.class.js
*/
*/
c3_chart_internal_fn
.
CLASS
=
{
var
CLASS
=
c3_chart_internal_fn
.
CLASS
=
{
target
:
'c3-target'
,
target
:
'c3-target'
,
chart
:
'c3-chart'
,
chart
:
'c3-chart'
,
chartLine
:
'c3-chart-line'
,
chartLine
:
'c3-chart-line'
,
...
@@ -4990,93 +5005,92 @@
...
@@ -4990,93 +5005,92 @@
SELECTED
:
'_selected_'
,
SELECTED
:
'_selected_'
,
INCLUDED
:
'_included_'
INCLUDED
:
'_included_'
};
};
c3_chart_internal_fn
.
generateClass
=
function
(
prefix
,
targetId
)
{
var
generateClass
=
c3_chart_internal_fn
.
generateClass
=
function
(
prefix
,
targetId
)
{
return
" "
+
prefix
+
" "
+
prefix
+
this
.
getTargetSelectorSuffix
(
targetId
);
return
" "
+
prefix
+
" "
+
prefix
+
getTargetSelectorSuffix
.
call
(
this
,
targetId
);
};
};
c3_chart_internal_fn
.
classText
=
function
(
d
)
{
var
classText
=
c3_chart_internal_fn
.
classText
=
function
(
d
)
{
return
this
.
generateClass
(
this
.
CLASS
.
text
,
d
.
index
);
return
generateClass
.
call
(
this
,
CLASS
.
text
,
d
.
index
);
};
};
c3_chart_internal_fn
.
classTexts
=
function
(
d
)
{
var
classTexts
=
c3_chart_internal_fn
.
classTexts
=
function
(
d
)
{
return
this
.
generateClass
(
this
.
CLASS
.
texts
,
d
.
id
);
return
generateClass
.
call
(
this
,
CLASS
.
texts
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classShape
=
function
(
d
)
{
var
classShape
=
c3_chart_internal_fn
.
classShape
=
function
(
d
)
{
return
this
.
generateClass
(
this
.
CLASS
.
shape
,
d
.
index
);
return
generateClass
.
call
(
this
,
CLASS
.
shape
,
d
.
index
);
};
};
c3_chart_internal_fn
.
classShapes
=
function
(
d
)
{
var
classShapes
=
c3_chart_internal_fn
.
classShapes
=
function
(
d
)
{
return
this
.
generateClass
(
this
.
CLASS
.
shapes
,
d
.
id
);
return
generateClass
.
call
(
this
,
CLASS
.
shapes
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classLine
=
function
(
d
)
{
var
classLine
=
c3_chart_internal_fn
.
classLine
=
function
(
d
)
{
return
this
.
classShape
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
line
,
d
.
id
);
return
classShape
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
line
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classLines
=
function
(
d
)
{
var
classLines
=
c3_chart_internal_fn
.
classLines
=
function
(
d
)
{
return
this
.
classShapes
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
lines
,
d
.
id
);
return
classShapes
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
lines
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classCircle
=
function
(
d
)
{
var
classCircle
=
c3_chart_internal_fn
.
classCircle
=
function
(
d
)
{
return
this
.
classShape
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
circle
,
d
.
index
);
return
classShape
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
circle
,
d
.
index
);
};
};
c3_chart_internal_fn
.
classCircles
=
function
(
d
)
{
var
classCircles
=
c3_chart_internal_fn
.
classCircles
=
function
(
d
)
{
return
this
.
classShapes
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
circles
,
d
.
id
);
return
classShapes
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
circles
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classBar
=
function
(
d
)
{
var
classBar
=
c3_chart_internal_fn
.
classBar
=
function
(
d
)
{
return
this
.
classShape
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
bar
,
d
.
index
);
return
classShape
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
bar
,
d
.
index
);
};
};
c3_chart_internal_fn
.
classBars
=
function
(
d
)
{
var
classBars
=
c3_chart_internal_fn
.
classBars
=
function
(
d
)
{
return
this
.
classShapes
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
bars
,
d
.
id
);
return
classShapes
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
bars
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classArc
=
function
(
d
)
{
var
classArc
=
c3_chart_internal_fn
.
classArc
=
function
(
d
)
{
return
this
.
classShape
(
d
.
data
)
+
this
.
generateClass
(
this
.
CLASS
.
arc
,
d
.
data
.
id
);
return
classShape
.
call
(
this
,
d
.
data
)
+
generateClass
.
call
(
this
,
CLASS
.
arc
,
d
.
data
.
id
);
};
};
c3_chart_internal_fn
.
classArcs
=
function
(
d
)
{
var
classArcs
=
c3_chart_internal_fn
.
classArcs
=
function
(
d
)
{
return
this
.
classShapes
(
d
.
data
)
+
this
.
generateClass
(
this
.
CLASS
.
arcs
,
d
.
data
.
id
);
return
classShapes
.
call
(
this
,
d
.
data
)
+
generateClass
.
call
(
this
,
CLASS
.
arcs
,
d
.
data
.
id
);
};
};
c3_chart_internal_fn
.
classArea
=
function
(
d
)
{
var
classArea
=
c3_chart_internal_fn
.
classArea
=
function
(
d
)
{
return
this
.
classShape
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
area
,
d
.
id
);
return
classShape
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
area
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classAreas
=
function
(
d
)
{
var
classAreas
=
c3_chart_internal_fn
.
classAreas
=
function
(
d
)
{
return
this
.
classShapes
(
d
)
+
this
.
generateClass
(
this
.
CLASS
.
areas
,
d
.
id
);
return
classShapes
.
call
(
this
,
d
)
+
generateClass
.
call
(
this
,
CLASS
.
areas
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classRegion
=
function
(
d
,
i
)
{
var
classRegion
=
c3_chart_internal_fn
.
classRegion
=
function
(
d
,
i
)
{
return
this
.
generateClass
(
this
.
CLASS
.
region
,
i
)
+
' '
+
(
'class'
in
d
?
d
.
class
:
''
);
return
generateClass
.
call
(
this
,
CLASS
.
region
,
i
)
+
' '
+
(
'class'
in
d
?
d
.
class
:
''
);
};
};
c3_chart_internal_fn
.
classEvent
=
function
(
d
)
{
var
classEvent
=
c3_chart_internal_fn
.
classEvent
=
function
(
d
)
{
return
this
.
generateClass
(
this
.
CLASS
.
eventRect
,
d
.
index
);
return
generateClass
.
call
(
this
,
CLASS
.
eventRect
,
d
.
index
);
};
};
c3_chart_internal_fn
.
classTarget
=
function
(
id
)
{
var
classTarget
=
c3_chart_internal_fn
.
classTarget
=
function
(
id
)
{
var
$$
=
this
;
var
$$
=
this
;
var
additionalClassSuffix
=
$$
.
config
.
data_classes
[
id
],
additionalClass
=
''
;
var
additionalClassSuffix
=
$$
.
config
.
data_classes
[
id
],
additionalClass
=
''
;
if
(
additionalClassSuffix
)
{
if
(
additionalClassSuffix
)
{
additionalClass
=
' '
+
$$
.
CLASS
.
target
+
'-'
+
additionalClassSuffix
;
additionalClass
=
' '
+
$$
.
CLASS
.
target
+
'-'
+
additionalClassSuffix
;
}
}
return
$$
.
generateClass
(
$$
.
CLASS
.
target
,
id
)
+
additionalClass
;
return
generateClass
.
call
(
$$
,
CLASS
.
target
,
id
)
+
additionalClass
;
};
};
c3_chart_internal_fn
.
classChartText
=
function
(
d
)
{
var
classChartText
=
c3_chart_internal_fn
.
classChartText
=
function
(
d
)
{
return
this
.
CLASS
.
chartText
+
this
.
classTarget
(
d
.
id
);
return
CLASS
.
chartText
+
classTarget
.
call
(
this
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classChartLine
=
function
(
d
)
{
var
classChartLine
=
c3_chart_internal_fn
.
classChartLine
=
function
(
d
)
{
return
this
.
CLASS
.
chartLine
+
this
.
classTarget
(
d
.
id
);
return
CLASS
.
chartLine
+
classTarget
.
call
(
this
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classChartBar
=
function
(
d
)
{
var
classChartBar
=
c3_chart_internal_fn
.
classChartBar
=
function
(
d
)
{
return
this
.
CLASS
.
chartBar
+
this
.
classTarget
(
d
.
id
);
return
CLASS
.
chartBar
+
classTarget
.
call
(
this
,
d
.
id
);
};
};
c3_chart_internal_fn
.
classChartArc
=
function
(
d
)
{
var
classChartArc
=
c3_chart_internal_fn
.
classChartArc
=
function
(
d
)
{
return
this
.
CLASS
.
chartArc
+
this
.
classTarget
(
d
.
data
.
id
);
return
CLASS
.
chartArc
+
classTarget
.
call
(
this
,
d
.
data
.
id
);
};
};
c3_chart_internal_fn
.
getTargetSelectorSuffix
=
function
(
targetId
)
{
var
getTargetSelectorSuffix
=
c3_chart_internal_fn
.
getTargetSelectorSuffix
=
function
(
targetId
)
{
return
targetId
||
targetId
===
0
?
'-'
+
(
targetId
.
replace
?
targetId
.
replace
(
/
([^
a-zA-Z0-9-_
])
/g
,
'-'
)
:
targetId
)
:
''
;
return
targetId
||
targetId
===
0
?
'-'
+
(
targetId
.
replace
?
targetId
.
replace
(
/
([^
a-zA-Z0-9-_
])
/g
,
'-'
)
:
targetId
)
:
''
;
};
};
c3_chart_internal_fn
.
selectorTarget
=
function
(
id
)
{
var
selectorTarget
=
c3_chart_internal_fn
.
selectorTarget
=
function
(
id
)
{
return
'.'
+
this
.
CLASS
.
target
+
this
.
getTargetSelectorSuffix
(
id
);
return
'.'
+
CLASS
.
target
+
getTargetSelectorSuffix
.
call
(
this
,
id
);
};
};
c3_chart_internal_fn
.
selectorTargets
=
function
(
ids
)
{
var
selectorTargets
=
c3_chart_internal_fn
.
selectorTargets
=
function
(
ids
)
{
var
$$
=
this
;
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
selectorTarget
.
call
(
this
,
id
);
})
:
null
;
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
$$
.
selectorTarget
(
id
);
})
:
null
;
};
};
c3_chart_internal_fn
.
selectorLegend
=
function
(
id
)
{
var
selectorLegend
=
c3_chart_internal_fn
.
selectorLegend
=
function
(
id
)
{
return
'.'
+
this
.
CLASS
.
legendItem
+
this
.
getTargetSelectorSuffix
(
id
);
return
'.'
+
CLASS
.
legendItem
+
getTargetSelectorSuffix
.
call
(
this
,
id
);
};
};
c3_chart_internal_fn
.
selectorLegends
=
function
(
ids
)
{
var
selectorLegends
=
c3_chart_internal_fn
.
selectorLegends
=
function
(
ids
)
{
var
$$
=
this
;
var
$$
=
this
;
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
$$
.
selectorLegend
(
id
);
})
:
null
;
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
selectorLegend
.
call
(
$$
,
id
);
})
:
null
;
};
};
...
@@ -5086,8 +5100,8 @@
...
@@ -5086,8 +5100,8 @@
*/
*/
c3_chart_internal_fn
.
getYFormat
=
function
(
forArc
)
{
c3_chart_internal_fn
.
getYFormat
=
function
(
forArc
)
{
var
$$
=
this
,
var
$$
=
this
,
formatForY
=
forArc
&&
!
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY
=
forArc
&&
!
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY2
=
forArc
&&
!
$$
.
hasGaugeType
(
$$
.
data
.
targets
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
formatForY2
=
forArc
&&
!
hasGaugeType
.
call
(
$$
,
$$
.
data
.
targets
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
return
function
(
v
,
ratio
,
id
)
{
return
function
(
v
,
ratio
,
id
)
{
var
format
=
$$
.
getAxisId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
var
format
=
$$
.
getAxisId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
return
format
.
call
(
$$
,
v
,
ratio
);
return
format
.
call
(
$$
,
v
,
ratio
);
...
@@ -5132,7 +5146,7 @@
...
@@ -5132,7 +5146,7 @@
var
$$
=
this
,
main
=
$$
.
main
,
CLASS
=
$$
.
CLASS
,
d3
=
$$
.
d3
;
var
$$
=
this
,
main
=
$$
.
main
,
CLASS
=
$$
.
CLASS
,
d3
=
$$
.
d3
;
var
sx
,
sy
,
mx
,
my
,
minX
,
maxX
,
minY
,
maxY
;
var
sx
,
sy
,
mx
,
my
,
minX
,
maxX
,
minY
,
maxY
;
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
if
(
$$
.
config
.
zoom_enabled
&&
!
$$
.
zoom
.
altDomain
)
{
return
;
}
// skip if zoomable because of conflict drag dehavior
if
(
$$
.
config
.
zoom_enabled
&&
!
$$
.
zoom
.
altDomain
)
{
return
;
}
// skip if zoomable because of conflict drag dehavior
if
(
!
$$
.
config
.
data_selection_multiple
)
{
return
;
}
// skip when single selection because drag is used for multiple selection
if
(
!
$$
.
config
.
data_selection_multiple
)
{
return
;
}
// skip when single selection because drag is used for multiple selection
...
@@ -5188,7 +5202,7 @@
...
@@ -5188,7 +5202,7 @@
c3_chart_internal_fn
.
dragstart
=
function
(
mouse
)
{
c3_chart_internal_fn
.
dragstart
=
function
(
mouse
)
{
var
$$
=
this
;
var
$$
=
this
;
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
$$
.
dragStart
=
mouse
;
$$
.
dragStart
=
mouse
;
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
chart
).
append
(
'rect'
)
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
chart
).
append
(
'rect'
)
...
@@ -5200,7 +5214,7 @@
...
@@ -5200,7 +5214,7 @@
c3_chart_internal_fn
.
dragend
=
function
()
{
c3_chart_internal_fn
.
dragend
=
function
()
{
var
$$
=
this
;
var
$$
=
this
;
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
return
;
}
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
if
(
!
$$
.
config
.
data_selection_enabled
)
{
return
;
}
// do nothing if not selectable
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
dragarea
)
$$
.
main
.
select
(
'.'
+
$$
.
CLASS
.
dragarea
)
.
transition
().
duration
(
100
)
.
transition
().
duration
(
100
)
...
@@ -5221,7 +5235,7 @@
...
@@ -5221,7 +5235,7 @@
*/
*/
c3_chart_fn
.
focus
=
function
(
targetId
)
{
c3_chart_fn
.
focus
=
function
(
targetId
)
{
var
$$
=
this
.
internal
,
var
$$
=
this
.
internal
,
candidates
=
$$
.
svg
.
selectAll
(
$$
.
selectorTarget
(
targetId
)),
candidates
=
$$
.
svg
.
selectAll
(
selectorTarget
.
call
(
$$
,
targetId
)),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
function
focus
(
targets
)
{
function
focus
(
targets
)
{
...
@@ -5231,7 +5245,7 @@
...
@@ -5231,7 +5245,7 @@
this
.
defocus
();
this
.
defocus
();
focus
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
true
));
focus
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
true
));
focus
(
candidatesForArc
);
focus
(
candidatesForArc
);
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
expandArc
.
call
(
$$
,
targetId
,
true
);
expandArc
.
call
(
$$
,
targetId
,
true
);
}
}
$$
.
toggleFocusLegend
(
targetId
,
true
);
$$
.
toggleFocusLegend
(
targetId
,
true
);
...
@@ -5239,7 +5253,7 @@
...
@@ -5239,7 +5253,7 @@
c3_chart_fn
.
defocus
=
function
(
targetId
)
{
c3_chart_fn
.
defocus
=
function
(
targetId
)
{
var
$$
=
this
.
internal
,
var
$$
=
this
.
internal
,
candidates
=
$$
.
svg
.
selectAll
(
$$
.
selectorTarget
(
targetId
)),
candidates
=
$$
.
svg
.
selectAll
(
selectorTarget
.
call
(
$$
,
targetId
)),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
function
defocus
(
targets
)
{
function
defocus
(
targets
)
{
...
@@ -5248,7 +5262,7 @@
...
@@ -5248,7 +5262,7 @@
this
.
revert
();
this
.
revert
();
defocus
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
false
));
defocus
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
false
));
defocus
(
candidatesForArc
);
defocus
(
candidatesForArc
);
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
unexpandArc
.
call
(
$$
,
targetId
);
unexpandArc
.
call
(
$$
,
targetId
);
}
}
$$
.
toggleFocusLegend
(
targetId
,
false
);
$$
.
toggleFocusLegend
(
targetId
,
false
);
...
@@ -5256,7 +5270,7 @@
...
@@ -5256,7 +5270,7 @@
c3_chart_fn
.
revert
=
function
(
targetId
)
{
c3_chart_fn
.
revert
=
function
(
targetId
)
{
var
$$
=
this
.
internal
,
var
$$
=
this
.
internal
,
candidates
=
$$
.
svg
.
selectAll
(
$$
.
selectorTarget
(
targetId
)),
candidates
=
$$
.
svg
.
selectAll
(
selectorTarget
.
call
(
$$
,
targetId
)),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForNoneArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isNoneArc
(
d
);
}),
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
candidatesForArc
=
candidates
.
filter
(
function
(
d
)
{
return
$$
.
isArc
(
d
);
});
function
revert
(
targets
)
{
function
revert
(
targets
)
{
...
@@ -5264,7 +5278,7 @@
...
@@ -5264,7 +5278,7 @@
}
}
revert
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
false
));
revert
(
candidatesForNoneArc
.
classed
(
$$
.
CLASS
.
focused
,
false
));
revert
(
candidatesForArc
);
revert
(
candidatesForArc
);
if
(
$$
.
hasArcType
(
$$
.
data
.
targets
))
{
if
(
hasArcType
.
call
(
$$
,
$$
.
data
.
targets
))
{
unexpandArc
.
call
(
$$
,
targetId
);
unexpandArc
.
call
(
$$
,
targetId
);
}
}
$$
.
revertLegend
();
$$
.
revertLegend
();
...
@@ -5277,7 +5291,7 @@
...
@@ -5277,7 +5291,7 @@
options
=
options
||
{};
options
=
options
||
{};
$$
.
removeHiddenTargetIds
(
targetIds
);
$$
.
removeHiddenTargetIds
(
targetIds
);
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
))
$$
.
svg
.
selectAll
(
selectorTargets
.
call
(
$$
,
targetIds
))
.
transition
()
.
transition
()
.
style
(
'opacity'
,
1
);
.
style
(
'opacity'
,
1
);
...
@@ -5295,7 +5309,7 @@
...
@@ -5295,7 +5309,7 @@
options
=
options
||
{};
options
=
options
||
{};
$$
.
addHiddenTargetIds
(
targetIds
);
$$
.
addHiddenTargetIds
(
targetIds
);
$$
.
svg
.
selectAll
(
$$
.
selectorTargets
(
targetIds
))
$$
.
svg
.
selectAll
(
selectorTargets
.
call
(
$$
,
targetIds
))
.
transition
()
.
transition
()
.
style
(
'opacity'
,
0
);
.
style
(
'opacity'
,
0
);
...
@@ -5509,7 +5523,7 @@
...
@@ -5509,7 +5523,7 @@
c3_chart_fn
.
selected
=
function
(
targetId
)
{
c3_chart_fn
.
selected
=
function
(
targetId
)
{
var
$$
=
this
.
internal
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
;
var
$$
=
this
.
internal
,
d3
=
$$
.
d3
,
CLASS
=
$$
.
CLASS
;
return
d3
.
merge
(
return
d3
.
merge
(
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
$$
.
getTargetSelectorSuffix
(
targetId
)).
selectAll
(
'.'
+
CLASS
.
shape
)
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
getTargetSelectorSuffix
.
call
(
$$
,
targetId
)).
selectAll
(
'.'
+
CLASS
.
shape
)
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
CLASS
.
SELECTED
);
})
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
CLASS
.
SELECTED
);
})
.
map
(
function
(
d
)
{
return
d
.
map
(
function
(
d
)
{
var
data
=
d
.
__data__
;
return
data
.
data
?
data
.
data
:
data
;
});
})
.
map
(
function
(
d
)
{
return
d
.
map
(
function
(
d
)
{
var
data
=
d
.
__data__
;
return
data
.
data
?
data
.
data
:
data
;
});
})
);
);
...
...
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