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
1edb4dde
You need to sign in or sign up before continuing.
Commit
1edb4dde
authored
Mar 07, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Fix conflict
parents
4977298a
5c0c8ecc
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
498 additions
and
516 deletions
+498
-516
c3.js
c3.js
+249
-258
c3.min.js
c3.min.js
+0
-0
api.axis.js
src/api.axis.js
+2
-2
axis.js
src/axis.js
+184
-214
c3.axis.js
src/c3.axis.js
+2
-1
core.js
src/core.js
+33
-13
domain.js
src/domain.js
+9
-9
format.js
src/format.js
+1
-1
scale.js
src/scale.js
+10
-10
size.js
src/size.js
+6
-6
tooltip.js
src/tooltip.js
+2
-2
No files found.
c3.js
View file @
1edb4dde
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
var
c3
=
{
version
:
"0.4.9"
};
var
c3
=
{
version
:
"0.4.9"
};
var
c3_chart_fn
,
c3_chart_internal_fn
;
var
c3_chart_fn
,
c3_chart_internal_fn
,
c3_chart_internal_axis_fn
;
function
API
(
owner
)
{
function
API
(
owner
)
{
this
.
owner
=
owner
;
this
.
owner
=
owner
;
...
@@ -59,12 +61,15 @@
...
@@ -59,12 +61,15 @@
c3
.
chart
=
{
c3
.
chart
=
{
fn
:
Chart
.
prototype
,
fn
:
Chart
.
prototype
,
internal
:
{
internal
:
{
fn
:
ChartInternal
.
prototype
fn
:
ChartInternal
.
prototype
,
axis
:
{
fn
:
Axis
.
prototype
}
}
}
};
};
c3_chart_fn
=
c3
.
chart
.
fn
;
c3_chart_fn
=
c3
.
chart
.
fn
;
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
c3_chart_internal_axis_fn
=
c3
.
chart
.
internal
.
axis
.
fn
;
c3_chart_internal_fn
.
init
=
function
()
{
c3_chart_internal_fn
.
init
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
;
var
$$
=
this
,
config
=
$$
.
config
;
...
@@ -173,7 +178,7 @@
...
@@ -173,7 +178,7 @@
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
defs
,
main
,
binding
=
true
;
var
defs
,
main
,
binding
=
true
;
$$
.
_axis
=
new
_
Axis
(
$$
);
$$
.
axis
=
new
Axis
(
$$
);
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
...
@@ -292,7 +297,7 @@
...
@@ -292,7 +297,7 @@
if
(
config
.
axis_x_extent
)
{
$$
.
brush
.
extent
(
$$
.
getDefaultExtent
());
}
if
(
config
.
axis_x_extent
)
{
$$
.
brush
.
extent
(
$$
.
getDefaultExtent
());
}
// Add Axis
// Add Axis
$$
.
_
axis
.
init
();
$$
.
axis
.
init
();
// Set targets
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
$$
.
updateTargets
(
$$
.
data
.
targets
);
...
@@ -482,7 +487,7 @@
...
@@ -482,7 +487,7 @@
durationForExit
=
withTransitionForExit
?
duration
:
0
;
durationForExit
=
withTransitionForExit
?
duration
:
0
;
durationForAxis
=
withTransitionForAxis
?
duration
:
0
;
durationForAxis
=
withTransitionForAxis
?
duration
:
0
;
transitions
=
transitions
||
$$
.
_
axis
.
generateTransitions
(
durationForAxis
);
transitions
=
transitions
||
$$
.
axis
.
generateTransitions
(
durationForAxis
);
// update legend and transform each g
// update legend and transform each g
if
(
withLegend
&&
config
.
legend_show
)
{
if
(
withLegend
&&
config
.
legend_show
)
{
...
@@ -501,7 +506,7 @@
...
@@ -501,7 +506,7 @@
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
if
(
!
config
.
axis_x_tick_values
)
{
if
(
!
config
.
axis_x_tick_values
)
{
tickValues
=
$$
.
_
axis
.
updateXAxisTickValues
(
targetsToShow
);
tickValues
=
$$
.
axis
.
updateXAxisTickValues
(
targetsToShow
);
}
}
}
else
{
}
else
{
$$
.
xAxis
.
tickValues
([]);
$$
.
xAxis
.
tickValues
([]);
...
@@ -516,17 +521,17 @@
...
@@ -516,17 +521,17 @@
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
$$
.
yAxis
.
tickValues
(
$$
.
_
axis
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
));
$$
.
yAxis
.
tickValues
(
$$
.
axis
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
));
}
}
if
(
!
config
.
axis_y2_tick_values
&&
config
.
axis_y2_tick_count
)
{
if
(
!
config
.
axis_y2_tick_values
&&
config
.
axis_y2_tick_count
)
{
$$
.
y2Axis
.
tickValues
(
$$
.
_
axis
.
generateTickValues
(
$$
.
y2
.
domain
(),
config
.
axis_y2_tick_count
));
$$
.
y2Axis
.
tickValues
(
$$
.
axis
.
generateTickValues
(
$$
.
y2
.
domain
(),
config
.
axis_y2_tick_count
));
}
}
// axes
// axes
$$
.
_
axis
.
redraw
(
transitions
,
hideAxis
);
$$
.
axis
.
redraw
(
transitions
,
hideAxis
);
// Update axis label
// Update axis label
$$
.
_
axis
.
updateLabels
(
withTransition
);
$$
.
axis
.
updateLabels
(
withTransition
);
// show/hide if manual culling needed
// show/hide if manual culling needed
if
((
withUpdateXDomain
||
withUpdateXAxis
)
&&
targetsToShow
.
length
)
{
if
((
withUpdateXDomain
||
withUpdateXAxis
)
&&
targetsToShow
.
length
)
{
...
@@ -637,7 +642,7 @@
...
@@ -637,7 +642,7 @@
});
});
}
}
if
(
duration
)
{
if
(
duration
&&
$$
.
isTabVisible
())
{
// Only use transition if tab visible. See #938.
// transition should be derived from one transition
// transition should be derived from one transition
d3
.
transition
().
duration
(
duration
).
each
(
function
()
{
d3
.
transition
().
duration
(
duration
).
each
(
function
()
{
var
transitionsToWait
=
[];
var
transitionsToWait
=
[];
...
@@ -707,7 +712,7 @@
...
@@ -707,7 +712,7 @@
$$
.
updateSizes
();
$$
.
updateSizes
();
// MEMO: called in updateLegend in redraw if withLegend
// MEMO: called in updateLegend in redraw if withLegend
if
(
!
(
options
.
withLegend
&&
config
.
legend_show
))
{
if
(
!
(
options
.
withLegend
&&
config
.
legend_show
))
{
transitions
=
$$
.
_
axis
.
generateTransitions
(
options
.
withTransitionForAxis
?
config
.
transition_duration
:
0
);
transitions
=
$$
.
axis
.
generateTransitions
(
options
.
withTransitionForAxis
?
config
.
transition_duration
:
0
);
// Update scales
// Update scales
$$
.
updateScales
();
$$
.
updateScales
();
$$
.
updateSvgSize
();
$$
.
updateSvgSize
();
...
@@ -978,6 +983,21 @@
...
@@ -978,6 +983,21 @@
return
parsedDate
;
return
parsedDate
;
};
};
c3_chart_internal_fn
.
isTabVisible
=
function
()
{
var
hidden
;
if
(
typeof
document
.
hidden
!==
"undefined"
)
{
// Opera 12.10 and Firefox 18 and later support
hidden
=
"hidden"
;
}
else
if
(
typeof
document
.
mozHidden
!==
"undefined"
)
{
hidden
=
"mozHidden"
;
}
else
if
(
typeof
document
.
msHidden
!==
"undefined"
)
{
hidden
=
"msHidden"
;
}
else
if
(
typeof
document
.
webkitHidden
!==
"undefined"
)
{
hidden
=
"webkitHidden"
;
}
return
document
[
hidden
]
?
false
:
true
;
};
c3_chart_internal_fn
.
getDefaultConfig
=
function
()
{
c3_chart_internal_fn
.
getDefaultConfig
=
function
()
{
var
config
=
{
var
config
=
{
bindto
:
'#chart'
,
bindto
:
'#chart'
,
...
@@ -1255,10 +1275,10 @@
...
@@ -1255,10 +1275,10 @@
return
scale
;
return
scale
;
};
};
c3_chart_internal_fn
.
getYScale
=
function
(
id
)
{
c3_chart_internal_fn
.
getYScale
=
function
(
id
)
{
return
this
.
_
axis
.
getId
(
id
)
===
'y2'
?
this
.
y2
:
this
.
y
;
return
this
.
axis
.
getId
(
id
)
===
'y2'
?
this
.
y2
:
this
.
y
;
};
};
c3_chart_internal_fn
.
getSubYScale
=
function
(
id
)
{
c3_chart_internal_fn
.
getSubYScale
=
function
(
id
)
{
return
this
.
_
axis
.
getId
(
id
)
===
'y2'
?
this
.
subY2
:
this
.
subY
;
return
this
.
axis
.
getId
(
id
)
===
'y2'
?
this
.
subY2
:
this
.
subY
;
};
};
c3_chart_internal_fn
.
updateScales
=
function
()
{
c3_chart_internal_fn
.
updateScales
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
...
@@ -1280,15 +1300,15 @@
...
@@ -1280,15 +1300,15 @@
$$
.
subY
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y_default
:
$$
.
subY
.
domain
());
$$
.
subY
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y_default
:
$$
.
subY
.
domain
());
$$
.
subY2
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y2_default
:
$$
.
subY2
.
domain
());
$$
.
subY2
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y2_default
:
$$
.
subY2
.
domain
());
// update axes
// update axes
$$
.
xAxisTickFormat
=
$$
.
_
axis
.
getXAxisTickFormat
();
$$
.
xAxisTickFormat
=
$$
.
axis
.
getXAxisTickFormat
();
$$
.
xAxisTickValues
=
$$
.
_
axis
.
getXAxisTickValues
();
$$
.
xAxisTickValues
=
$$
.
axis
.
getXAxisTickValues
();
$$
.
yAxisTickValues
=
$$
.
_
axis
.
getYAxisTickValues
();
$$
.
yAxisTickValues
=
$$
.
axis
.
getYAxisTickValues
();
$$
.
y2AxisTickValues
=
$$
.
_
axis
.
getY2AxisTickValues
();
$$
.
y2AxisTickValues
=
$$
.
axis
.
getY2AxisTickValues
();
$$
.
xAxis
=
$$
.
_
axis
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
xAxis
=
$$
.
axis
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
_
axis
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
axis
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
yAxis
=
$$
.
_
axis
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
$$
.
yAxisTickValues
,
config
.
axis_y_tick_outer
);
$$
.
yAxis
=
$$
.
axis
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
$$
.
yAxisTickValues
,
config
.
axis_y_tick_outer
);
$$
.
y2Axis
=
$$
.
_
axis
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
$$
.
y2AxisTickValues
,
config
.
axis_y2_tick_outer
);
$$
.
y2Axis
=
$$
.
axis
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
$$
.
y2AxisTickValues
,
config
.
axis_y2_tick_outer
);
// Set initialized scales to brush and zoom
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
if
(
!
forInit
)
{
...
@@ -1321,7 +1341,7 @@
...
@@ -1321,7 +1341,7 @@
id
=
idsInGroup
[
k
];
id
=
idsInGroup
[
k
];
if
(
!
ys
[
id
])
{
continue
;
}
if
(
!
ys
[
id
])
{
continue
;
}
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
if
(
$$
.
_axis
.
getId
(
id
)
===
$$
.
_
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasNegativeValue
&&
+
v
>
0
))
{
if
(
$$
.
axis
.
getId
(
id
)
===
$$
.
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasNegativeValue
&&
+
v
>
0
))
{
ys
[
baseId
][
i
]
+=
+
v
;
ys
[
baseId
][
i
]
+=
+
v
;
}
}
});
});
...
@@ -1352,7 +1372,7 @@
...
@@ -1352,7 +1372,7 @@
id
=
idsInGroup
[
k
];
id
=
idsInGroup
[
k
];
if
(
!
ys
[
id
])
{
continue
;
}
if
(
!
ys
[
id
])
{
continue
;
}
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
if
(
$$
.
_axis
.
getId
(
id
)
===
$$
.
_
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasPositiveValue
&&
+
v
<
0
))
{
if
(
$$
.
axis
.
getId
(
id
)
===
$$
.
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasPositiveValue
&&
+
v
<
0
))
{
ys
[
baseId
][
i
]
+=
+
v
;
ys
[
baseId
][
i
]
+=
+
v
;
}
}
});
});
...
@@ -1363,7 +1383,7 @@
...
@@ -1363,7 +1383,7 @@
};
};
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
_
axis
.
getId
(
t
.
id
)
===
axisId
;
}),
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
axis
.
getId
(
t
.
id
)
===
axisId
;
}),
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
...
@@ -1424,16 +1444,16 @@
...
@@ -1424,16 +1444,16 @@
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
else
if
(
showVerticalDataLabel
)
{
}
else
if
(
showVerticalDataLabel
)
{
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
'height'
);
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
'height'
);
padding_top
+=
this
.
_
axis
.
convertPixelsToAxisPadding
(
lengths
[
1
],
domainLength
);
padding_top
+=
$$
.
axis
.
convertPixelsToAxisPadding
(
lengths
[
1
],
domainLength
);
padding_bottom
+=
this
.
_
axis
.
convertPixelsToAxisPadding
(
lengths
[
0
],
domainLength
);
padding_bottom
+=
$$
.
axis
.
convertPixelsToAxisPadding
(
lengths
[
0
],
domainLength
);
}
}
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
padding_top
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y_padding
,
'top'
,
padding_top
,
domainLength
);
padding_top
=
$$
.
axis
.
getPadding
(
config
.
axis_y_padding
,
'top'
,
padding_top
,
domainLength
);
padding_bottom
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
padding_bottom
=
$$
.
axis
.
getPadding
(
config
.
axis_y_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
}
}
if
(
axisId
===
'y2'
&&
notEmpty
(
config
.
axis_y2_padding
))
{
if
(
axisId
===
'y2'
&&
notEmpty
(
config
.
axis_y2_padding
))
{
padding_top
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y2_padding
,
'top'
,
padding_top
,
domainLength
);
padding_top
=
$$
.
axis
.
getPadding
(
config
.
axis_y2_padding
,
'top'
,
padding_top
,
domainLength
);
padding_bottom
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y2_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
padding_bottom
=
$$
.
axis
.
getPadding
(
config
.
axis_y2_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
}
}
// Bar/Area chart should be 0-based if all positive|negative
// Bar/Area chart should be 0-based if all positive|negative
if
(
isZeroBased
)
{
if
(
isZeroBased
)
{
...
@@ -2564,7 +2584,7 @@
...
@@ -2564,7 +2584,7 @@
}
else
if
(
config
.
axis_rotated
)
{
}
else
if
(
config
.
axis_rotated
)
{
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
}
else
if
(
!
config
.
axis_y_show
||
config
.
axis_y_inner
)
{
// && !config.axis_rotated
}
else
if
(
!
config
.
axis_y_show
||
config
.
axis_y_inner
)
{
// && !config.axis_rotated
return
$$
.
_
axis
.
getYAxisLabelPosition
().
isOuter
?
30
:
1
;
return
$$
.
axis
.
getYAxisLabelPosition
().
isOuter
?
30
:
1
;
}
else
{
}
else
{
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
}
}
...
@@ -2577,7 +2597,7 @@
...
@@ -2577,7 +2597,7 @@
}
else
if
(
config
.
axis_rotated
)
{
}
else
if
(
config
.
axis_rotated
)
{
return
defaultPadding
+
legendWidthOnRight
;
return
defaultPadding
+
legendWidthOnRight
;
}
else
if
(
!
config
.
axis_y2_show
||
config
.
axis_y2_inner
)
{
// && !config.axis_rotated
}
else
if
(
!
config
.
axis_y2_show
||
config
.
axis_y2_inner
)
{
// && !config.axis_rotated
return
2
+
legendWidthOnRight
+
(
$$
.
_
axis
.
getY2AxisLabelPosition
().
isOuter
?
20
:
0
);
return
2
+
legendWidthOnRight
+
(
$$
.
axis
.
getY2AxisLabelPosition
().
isOuter
?
20
:
0
);
}
else
{
}
else
{
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y2'
))
+
legendWidthOnRight
;
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y2'
))
+
legendWidthOnRight
;
}
}
...
@@ -2617,8 +2637,8 @@
...
@@ -2617,8 +2637,8 @@
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
var
$$
=
this
,
position
=
$$
.
_
axis
.
getLabelPositionById
(
id
);
var
$$
=
this
,
position
=
$$
.
axis
.
getLabelPositionById
(
id
);
return
$$
.
_
axis
.
getMaxTickWidth
(
id
,
withoutRecompute
)
+
(
position
.
isInner
?
20
:
40
);
return
$$
.
axis
.
getMaxTickWidth
(
id
,
withoutRecompute
)
+
(
position
.
isInner
?
20
:
40
);
};
};
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
...
@@ -2628,9 +2648,9 @@
...
@@ -2628,9 +2648,9 @@
if
(
axisId
===
'y2'
&&
!
config
.
axis_y2_show
)
{
return
$$
.
rotated_padding_top
;
}
if
(
axisId
===
'y2'
&&
!
config
.
axis_y2_show
)
{
return
$$
.
rotated_padding_top
;
}
// Calculate x axis height when tick rotated
// Calculate x axis height when tick rotated
if
(
axisId
===
'x'
&&
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
axisId
===
'x'
&&
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
h
=
$$
.
_
axis
.
getMaxTickWidth
(
axisId
)
*
Math
.
cos
(
Math
.
PI
*
(
90
-
config
.
axis_x_tick_rotate
)
/
180
);
h
=
$$
.
axis
.
getMaxTickWidth
(
axisId
)
*
Math
.
cos
(
Math
.
PI
*
(
90
-
config
.
axis_x_tick_rotate
)
/
180
);
}
}
return
h
+
(
$$
.
_
axis
.
getLabelPositionById
(
axisId
).
isInner
?
0
:
10
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
return
h
+
(
$$
.
axis
.
getLabelPositionById
(
axisId
).
isInner
?
0
:
10
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
};
};
c3_chart_internal_fn
.
getEventRectWidth
=
function
()
{
c3_chart_internal_fn
.
getEventRectWidth
=
function
()
{
...
@@ -3669,7 +3689,7 @@
...
@@ -3669,7 +3689,7 @@
}
}
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
return
$$
.
addName
(
d
.
values
[
config
.
tooltip_init_x
]);
return
$$
.
addName
(
d
.
values
[
config
.
tooltip_init_x
]);
}),
$$
.
_
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
$$
.
hasArcType
()),
$$
.
color
));
}),
$$
.
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
$$
.
hasArcType
()),
$$
.
color
));
$$
.
tooltip
.
style
(
"top"
,
config
.
tooltip_init_position
.
top
)
$$
.
tooltip
.
style
(
"top"
,
config
.
tooltip_init_position
.
top
)
.
style
(
"left"
,
config
.
tooltip_init_position
.
left
)
.
style
(
"left"
,
config
.
tooltip_init_position
.
left
)
.
style
(
"display"
,
"block"
);
.
style
(
"display"
,
"block"
);
...
@@ -3746,7 +3766,7 @@
...
@@ -3746,7 +3766,7 @@
if
(
dataToShow
.
length
===
0
||
!
config
.
tooltip_show
)
{
if
(
dataToShow
.
length
===
0
||
!
config
.
tooltip_show
)
{
return
;
return
;
}
}
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
selectedData
,
$$
.
_
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
forArc
),
$$
.
color
)).
style
(
"display"
,
"block"
);
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
selectedData
,
$$
.
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
forArc
),
$$
.
color
)).
style
(
"display"
,
"block"
);
// Get tooltip dimensions
// Get tooltip dimensions
tWidth
=
$$
.
tooltip
.
property
(
'offsetWidth'
);
tWidth
=
$$
.
tooltip
.
property
(
'offsetWidth'
);
...
@@ -4095,13 +4115,13 @@
...
@@ -4095,13 +4115,13 @@
$$
.
legendHasRendered
=
true
;
$$
.
legendHasRendered
=
true
;
};
};
function
_
Axis
(
owner
)
{
function
Axis
(
owner
)
{
API
.
call
(
this
,
owner
);
API
.
call
(
this
,
owner
);
}
}
inherit
(
API
,
_
Axis
);
inherit
(
API
,
Axis
);
_
Axis
.
prototype
.
init
=
function
init
()
{
Axis
.
prototype
.
init
=
function
init
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
main
=
$$
.
main
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
main
=
$$
.
main
;
$$
.
axes
.
x
=
main
.
append
(
"g"
)
$$
.
axes
.
x
=
main
.
append
(
"g"
)
...
@@ -4112,8 +4132,7 @@
...
@@ -4112,8 +4132,7 @@
$$
.
axes
.
x
.
append
(
"text"
)
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisXLabel
)
.
attr
(
"class"
,
CLASS
.
axisXLabel
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
"rotate(-90)"
:
""
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
_textAnchorForXAxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForXAxisLabel
.
bind
(
this
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY
)
.
attr
(
"clip-path"
,
config
.
axis_y_inner
?
""
:
$$
.
clipPathForYAxis
)
.
attr
(
"clip-path"
,
config
.
axis_y_inner
?
""
:
$$
.
clipPathForYAxis
)
...
@@ -4122,7 +4141,7 @@
...
@@ -4122,7 +4141,7 @@
$$
.
axes
.
y
.
append
(
"text"
)
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisYLabel
)
.
attr
(
"class"
,
CLASS
.
axisYLabel
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
_
textAnchorForYAxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForYAxisLabel
.
bind
(
this
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY2
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY2
)
...
@@ -4132,9 +4151,9 @@
...
@@ -4132,9 +4151,9 @@
$$
.
axes
.
y2
.
append
(
"text"
)
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisY2Label
)
.
attr
(
"class"
,
CLASS
.
axisY2Label
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
_
textAnchorForY2AxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForY2AxisLabel
.
bind
(
this
));
};
};
_
Axis
.
prototype
.
getXAxis
=
function
getXAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
,
withoutTransition
)
{
Axis
.
prototype
.
getXAxis
=
function
getXAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
,
withoutTransition
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
axisParams
=
{
axisParams
=
{
isCategory
:
$$
.
isCategorized
(),
isCategory
:
$$
.
isCategorized
(),
...
@@ -4168,7 +4187,7 @@
...
@@ -4168,7 +4187,7 @@
return
axis
;
return
axis
;
};
};
_
Axis
.
prototype
.
updateXAxisTickValues
=
function
updateXAxisTickValues
(
targets
,
axis
)
{
Axis
.
prototype
.
updateXAxisTickValues
=
function
updateXAxisTickValues
(
targets
,
axis
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
tickValues
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
tickValues
;
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
tickValues
=
this
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targets
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
tickValues
=
this
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targets
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
...
@@ -4181,7 +4200,7 @@
...
@@ -4181,7 +4200,7 @@
}
}
return
tickValues
;
return
tickValues
;
};
};
_
Axis
.
prototype
.
getYAxis
=
function
getYAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
Axis
.
prototype
.
getYAxis
=
function
getYAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
},
var
axisParams
=
{
withOuterTick
:
withOuterTick
},
$$
=
this
.
owner
,
$$
=
this
.
owner
,
d3
=
$$
.
d3
,
d3
=
$$
.
d3
,
...
@@ -4194,11 +4213,11 @@
...
@@ -4194,11 +4213,11 @@
}
}
return
axis
;
return
axis
;
};
};
_
Axis
.
prototype
.
getId
=
function
getId
(
id
)
{
Axis
.
prototype
.
getId
=
function
getId
(
id
)
{
var
config
=
this
.
owner
.
config
;
var
config
=
this
.
owner
.
config
;
return
id
in
config
.
data_axes
?
config
.
data_axes
[
id
]
:
'y'
;
return
id
in
config
.
data_axes
?
config
.
data_axes
[
id
]
:
'y'
;
};
};
_
Axis
.
prototype
.
getXAxisTickFormat
=
function
getXAxisTickFormat
()
{
Axis
.
prototype
.
getXAxisTickFormat
=
function
getXAxisTickFormat
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
if
(
config
.
axis_x_tick_format
)
{
if
(
config
.
axis_x_tick_format
)
{
...
@@ -4212,18 +4231,36 @@
...
@@ -4212,18 +4231,36 @@
}
}
return
isFunction
(
format
)
?
function
(
v
)
{
return
format
.
call
(
$$
,
v
);
}
:
format
;
return
isFunction
(
format
)
?
function
(
v
)
{
return
format
.
call
(
$$
,
v
);
}
:
format
;
};
};
_Axis
.
prototype
.
getXAxisTickValues
=
function
getXAxisTickValues
()
{
Axis
.
prototype
.
getTickValues
=
function
getTickValues
(
tickValues
,
axis
)
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_x_tick_values
,
this
.
owner
.
xAxis
);
return
tickValues
?
tickValues
:
axis
?
axis
.
tickValues
()
:
undefined
;
};
Axis
.
prototype
.
getXAxisTickValues
=
function
getXAxisTickValues
()
{
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_x_tick_values
,
this
.
owner
.
xAxis
);
};
Axis
.
prototype
.
getYAxisTickValues
=
function
getYAxisTickValues
()
{
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_y_tick_values
,
this
.
owner
.
yAxis
);
};
Axis
.
prototype
.
getY2AxisTickValues
=
function
getY2AxisTickValues
()
{
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_y2_tick_values
,
this
.
owner
.
y2Axis
);
};
};
_Axis
.
prototype
.
getYAxisTickValues
=
function
getYAxisTickValues
()
{
Axis
.
prototype
.
getLabelOptionByAxisId
=
function
getLabelOptionByAxisId
(
axisId
)
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_y_tick_values
,
this
.
owner
.
yAxis
);
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
;
if
(
axisId
===
'y'
)
{
option
=
config
.
axis_y_label
;
}
else
if
(
axisId
===
'y2'
)
{
option
=
config
.
axis_y2_label
;
}
else
if
(
axisId
===
'x'
)
{
option
=
config
.
axis_x_label
;
}
return
option
;
};
};
_Axis
.
prototype
.
getY2AxisTickValues
=
function
getY2AxisTickValues
()
{
Axis
.
prototype
.
getLabelText
=
function
getLabelText
(
axisId
)
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_y2_tick_values
,
this
.
owner
.
y2Axis
);
var
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
};
};
_
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
);
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
if
(
isString
(
option
))
{
if
(
isString
(
option
))
{
if
(
axisId
===
'y'
)
{
if
(
axisId
===
'y'
)
{
config
.
axis_y_label
=
text
;
config
.
axis_y_label
=
text
;
...
@@ -4236,17 +4273,136 @@
...
@@ -4236,17 +4273,136 @@
option
.
text
=
text
;
option
.
text
=
text
;
}
}
};
};
_Axis
.
prototype
.
getYAxisLabelPosition
=
function
getYAxisLabelPosition
()
{
Axis
.
prototype
.
getLabelPosition
=
function
getLabelPosition
(
axisId
,
defaultPosition
)
{
return
_getLabelPosition
.
call
(
this
,
'y'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
var
option
=
this
.
getLabelOptionByAxisId
(
axisId
),
position
=
(
option
&&
typeof
option
===
'object'
&&
option
.
position
)
?
option
.
position
:
defaultPosition
;
return
{
isInner
:
position
.
indexOf
(
'inner'
)
>=
0
,
isOuter
:
position
.
indexOf
(
'outer'
)
>=
0
,
isLeft
:
position
.
indexOf
(
'left'
)
>=
0
,
isCenter
:
position
.
indexOf
(
'center'
)
>=
0
,
isRight
:
position
.
indexOf
(
'right'
)
>=
0
,
isTop
:
position
.
indexOf
(
'top'
)
>=
0
,
isMiddle
:
position
.
indexOf
(
'middle'
)
>=
0
,
isBottom
:
position
.
indexOf
(
'bottom'
)
>=
0
};
};
Axis
.
prototype
.
getXAxisLabelPosition
=
function
getXAxisLabelPosition
()
{
return
this
.
getLabelPosition
(
'x'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-top'
:
'inner-right'
);
};
};
_Axis
.
prototype
.
getY2AxisLabelPosition
=
function
getY2
AxisLabelPosition
()
{
Axis
.
prototype
.
getYAxisLabelPosition
=
function
getY
AxisLabelPosition
()
{
return
_getLabelPosition
.
call
(
this
,
'y2
'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
return
this
.
getLabelPosition
(
'y
'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
};
};
_Axis
.
prototype
.
getLabelPositionById
=
function
getLabelPositionById
(
id
)
{
Axis
.
prototype
.
getY2AxisLabelPosition
=
function
getY2AxisLabelPosition
(
)
{
return
id
===
'y2'
?
this
.
getY2AxisLabelPosition
()
:
id
===
'y'
?
this
.
getYAxisLabelPosition
()
:
_getXAxisLabelPosition
.
call
(
this
);
return
this
.
getLabelPosition
(
'y2'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
};
};
Axis
.
prototype
.
getLabelPositionById
=
function
getLabelPositionById
(
id
)
{
_Axis
.
prototype
.
getMaxTickWidth
=
function
getMaxTickWidth
(
id
,
withoutRecompute
)
{
return
id
===
'y2'
?
this
.
getY2AxisLabelPosition
()
:
id
===
'y'
?
this
.
getYAxisLabelPosition
()
:
this
.
getXAxisLabelPosition
();
};
Axis
.
prototype
.
textForXAxisLabel
=
function
textForXAxisLabel
()
{
return
this
.
getLabelText
(
'x'
);
};
Axis
.
prototype
.
textForYAxisLabel
=
function
textForYAxisLabel
()
{
return
this
.
getLabelText
(
'y'
);
};
Axis
.
prototype
.
textForY2AxisLabel
=
function
textForY2AxisLabel
()
{
return
this
.
getLabelText
(
'y2'
);
};
Axis
.
prototype
.
xForAxisLabel
=
function
xForAxisLabel
(
forHorizontal
,
position
)
{
var
$$
=
this
.
owner
;
if
(
forHorizontal
)
{
return
position
.
isLeft
?
0
:
position
.
isCenter
?
$$
.
width
/
2
:
$$
.
width
;
}
else
{
return
position
.
isBottom
?
-
$$
.
height
:
position
.
isMiddle
?
-
$$
.
height
/
2
:
0
;
}
};
Axis
.
prototype
.
dxForAxisLabel
=
function
dxForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
"0.5em"
:
position
.
isRight
?
"-0.5em"
:
"0"
;
}
else
{
return
position
.
isTop
?
"-0.5em"
:
position
.
isBottom
?
"0.5em"
:
"0"
;
}
};
Axis
.
prototype
.
textAnchorForAxisLabel
=
function
textAnchorForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
'start'
:
position
.
isCenter
?
'middle'
:
'end'
;
}
else
{
return
position
.
isBottom
?
'start'
:
position
.
isMiddle
?
'middle'
:
'end'
;
}
};
Axis
.
prototype
.
xForXAxisLabel
=
function
xForXAxisLabel
()
{
return
this
.
xForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
xForYAxisLabel
=
function
xForYAxisLabel
()
{
return
this
.
xForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
xForY2AxisLabel
=
function
xForY2AxisLabel
()
{
return
this
.
xForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
dxForXAxisLabel
=
function
dxForXAxisLabel
()
{
return
this
.
dxForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
dxForYAxisLabel
=
function
dxForYAxisLabel
()
{
return
this
.
dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
dxForY2AxisLabel
=
function
dxForY2AxisLabel
()
{
return
this
.
dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
dyForXAxisLabel
=
function
dyForXAxisLabel
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
position
=
this
.
getXAxisLabelPosition
();
if
(
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
-
25
-
this
.
getMaxTickWidth
(
'x'
);
}
else
{
return
position
.
isInner
?
"-0.5em"
:
config
.
axis_x_height
?
config
.
axis_x_height
-
10
:
"3em"
;
}
};
Axis
.
prototype
.
dyForYAxisLabel
=
function
dyForYAxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getYAxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"-0.5em"
:
"3em"
;
}
else
{
return
position
.
isInner
?
"1.2em"
:
-
10
-
(
$$
.
config
.
axis_y_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y'
)
+
10
));
}
};
Axis
.
prototype
.
dyForY2AxisLabel
=
function
dyForY2AxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getY2AxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
"-2.2em"
;
}
else
{
return
position
.
isInner
?
"-0.5em"
:
15
+
(
$$
.
config
.
axis_y2_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y2'
)
+
15
));
}
};
Axis
.
prototype
.
textAnchorForXAxisLabel
=
function
textAnchorForXAxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
!
$$
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
textAnchorForYAxisLabel
=
function
textAnchorForYAxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
textAnchorForY2AxisLabel
=
function
textAnchorForY2AxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
xForRotatedTickText
=
function
xForRotatedTickText
(
r
)
{
return
8
*
Math
.
sin
(
Math
.
PI
*
(
r
/
180
));
};
Axis
.
prototype
.
yForRotatedTickText
=
function
yForRotatedTickText
(
r
)
{
return
11.5
-
2.5
*
(
r
/
15
)
*
(
r
>
0
?
1
:
-
1
);
};
Axis
.
prototype
.
rotateTickText
=
function
rotateTickText
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
this
.
yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
.
selectAll
(
'tspan'
)
.
attr
(
'dx'
,
this
.
xForRotatedTickText
(
rotate
));
};
Axis
.
prototype
.
getMaxTickWidth
=
function
getMaxTickWidth
(
id
,
withoutRecompute
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
maxWidth
=
0
,
targetsToShow
,
scale
,
axis
,
body
,
svg
;
maxWidth
=
0
,
targetsToShow
,
scale
,
axis
,
body
,
svg
;
if
(
withoutRecompute
&&
$$
.
currentMaxTickWidths
[
id
])
{
if
(
withoutRecompute
&&
$$
.
currentMaxTickWidths
[
id
])
{
...
@@ -4283,29 +4439,28 @@
...
@@ -4283,29 +4439,28 @@
return
$$
.
currentMaxTickWidths
[
id
];
return
$$
.
currentMaxTickWidths
[
id
];
};
};
_
Axis
.
prototype
.
updateLabels
=
function
updateLabels
(
withTransition
)
{
Axis
.
prototype
.
updateLabels
=
function
updateLabels
(
withTransition
)
{
var
$$
=
this
.
owner
;
var
$$
=
this
.
owner
;
var
axisXLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
),
var
axisXLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
),
axisYLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
),
axisYLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
),
axisY2Label
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
);
axisY2Label
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
);
(
withTransition
?
axisXLabel
.
transition
()
:
axisXLabel
)
(
withTransition
?
axisXLabel
.
transition
()
:
axisXLabel
)
.
attr
(
"x"
,
_
xForXAxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForXAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForXAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForXAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForXAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForXAxisLabel
.
bind
(
this
))
.
text
(
_
textForXAxisLabel
.
bind
(
this
));
.
text
(
this
.
textForXAxisLabel
.
bind
(
this
));
(
withTransition
?
axisYLabel
.
transition
()
:
axisYLabel
)
(
withTransition
?
axisYLabel
.
transition
()
:
axisYLabel
)
.
attr
(
"x"
,
_
xForYAxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForYAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForYAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForYAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForYAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForYAxisLabel
.
bind
(
this
))
.
text
(
_
textForYAxisLabel
.
bind
(
this
));
.
text
(
this
.
textForYAxisLabel
.
bind
(
this
));
(
withTransition
?
axisY2Label
.
transition
()
:
axisY2Label
)
(
withTransition
?
axisY2Label
.
transition
()
:
axisY2Label
)
.
attr
(
"x"
,
_
xForY2AxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForY2AxisLabel
.
bind
(
this
))
.
text
(
_
textForY2AxisLabel
.
bind
(
this
));
.
text
(
this
.
textForY2AxisLabel
.
bind
(
this
));
};
};
Axis
.
prototype
.
getPadding
=
function
getPadding
(
padding
,
key
,
defaultValue
,
domainLength
)
{
_Axis
.
prototype
.
getPadding
=
function
getPadding
(
padding
,
key
,
defaultValue
,
domainLength
)
{
if
(
!
isValue
(
padding
[
key
]))
{
if
(
!
isValue
(
padding
[
key
]))
{
return
defaultValue
;
return
defaultValue
;
}
}
...
@@ -4315,13 +4470,12 @@
...
@@ -4315,13 +4470,12 @@
// assume padding is pixels if unit is not specified
// assume padding is pixels if unit is not specified
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
};
};
_
Axis
.
prototype
.
convertPixelsToAxisPadding
=
function
convertPixelsToAxisPadding
(
pixels
,
domainLength
)
{
Axis
.
prototype
.
convertPixelsToAxisPadding
=
function
convertPixelsToAxisPadding
(
pixels
,
domainLength
)
{
var
$$
=
this
.
owner
,
var
$$
=
this
.
owner
,
length
=
$$
.
config
.
axis_rotated
?
$$
.
width
:
$$
.
height
;
length
=
$$
.
config
.
axis_rotated
?
$$
.
width
:
$$
.
height
;
return
domainLength
*
(
pixels
/
length
);
return
domainLength
*
(
pixels
/
length
);
};
};
Axis
.
prototype
.
generateTickValues
=
function
generateTickValues
(
values
,
tickCount
,
forTimeSeries
)
{
_Axis
.
prototype
.
generateTickValues
=
function
generateTickValues
(
values
,
tickCount
,
forTimeSeries
)
{
var
tickValues
=
values
,
targetCount
,
start
,
end
,
count
,
interval
,
i
,
tickValue
;
var
tickValues
=
values
,
targetCount
,
start
,
end
,
count
,
interval
,
i
,
tickValue
;
if
(
tickCount
)
{
if
(
tickCount
)
{
targetCount
=
isFunction
(
tickCount
)
?
tickCount
()
:
tickCount
;
targetCount
=
isFunction
(
tickCount
)
?
tickCount
()
:
tickCount
;
...
@@ -4347,7 +4501,7 @@
...
@@ -4347,7 +4501,7 @@
if
(
!
forTimeSeries
)
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
if
(
!
forTimeSeries
)
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
return
tickValues
;
return
tickValues
;
};
};
_
Axis
.
prototype
.
generateTransitions
=
function
generateTransitions
(
duration
)
{
Axis
.
prototype
.
generateTransitions
=
function
generateTransitions
(
duration
)
{
var
$$
=
this
.
owner
,
axes
=
$$
.
axes
;
var
$$
=
this
.
owner
,
axes
=
$$
.
axes
;
return
{
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
...
@@ -4356,7 +4510,7 @@
...
@@ -4356,7 +4510,7 @@
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
};
};
_
Axis
.
prototype
.
redraw
=
function
redraw
(
transitions
,
isHidden
)
{
Axis
.
prototype
.
redraw
=
function
redraw
(
transitions
,
isHidden
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
;
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
...
@@ -4368,175 +4522,11 @@
...
@@ -4368,175 +4522,11 @@
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
// rotate tick text if needed
// rotate tick text if needed
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
_
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
this
.
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
_
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
this
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
}
}
};
};
function
_getTickValues
(
tickValues
,
axis
)
{
return
tickValues
?
tickValues
:
axis
?
axis
.
tickValues
()
:
undefined
;
}
function
_getLabelOptionByAxisId
(
axisId
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
;
if
(
axisId
===
'y'
)
{
option
=
config
.
axis_y_label
;
}
else
if
(
axisId
===
'y2'
)
{
option
=
config
.
axis_y2_label
;
}
else
if
(
axisId
===
'x'
)
{
option
=
config
.
axis_x_label
;
}
return
option
;
}
function
_getLabelText
(
axisId
)
{
var
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
);
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
}
function
_getLabelPosition
(
axisId
,
defaultPosition
)
{
var
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
),
position
=
(
option
&&
typeof
option
===
'object'
&&
option
.
position
)
?
option
.
position
:
defaultPosition
;
return
{
isInner
:
position
.
indexOf
(
'inner'
)
>=
0
,
isOuter
:
position
.
indexOf
(
'outer'
)
>=
0
,
isLeft
:
position
.
indexOf
(
'left'
)
>=
0
,
isCenter
:
position
.
indexOf
(
'center'
)
>=
0
,
isRight
:
position
.
indexOf
(
'right'
)
>=
0
,
isTop
:
position
.
indexOf
(
'top'
)
>=
0
,
isMiddle
:
position
.
indexOf
(
'middle'
)
>=
0
,
isBottom
:
position
.
indexOf
(
'bottom'
)
>=
0
};
}
function
_getXAxisLabelPosition
()
{
return
_getLabelPosition
.
call
(
this
,
'x'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-top'
:
'inner-right'
);
}
function
_textForXAxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'x'
);
}
function
_textForYAxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'y'
);
}
function
_textForY2AxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'y2'
);
}
function
_xForAxisLabel
(
forHorizontal
,
position
)
{
var
$$
=
this
.
owner
;
if
(
forHorizontal
)
{
return
position
.
isLeft
?
0
:
position
.
isCenter
?
$$
.
width
/
2
:
$$
.
width
;
}
else
{
return
position
.
isBottom
?
-
$$
.
height
:
position
.
isMiddle
?
-
$$
.
height
/
2
:
0
;
}
}
function
_dxForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
"0.5em"
:
position
.
isRight
?
"-0.5em"
:
"0"
;
}
else
{
return
position
.
isTop
?
"-0.5em"
:
position
.
isBottom
?
"0.5em"
:
"0"
;
}
}
function
_textAnchorForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
'start'
:
position
.
isCenter
?
'middle'
:
'end'
;
}
else
{
return
position
.
isBottom
?
'start'
:
position
.
isMiddle
?
'middle'
:
'end'
;
}
}
function
_xForXAxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
!
this
.
owner
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_xForYAxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_xForY2AxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_dxForXAxisLabel
()
{
return
_dxForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_dxForYAxisLabel
()
{
return
_dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_dxForY2AxisLabel
()
{
return
_dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_dyForXAxisLabel
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
position
=
_getXAxisLabelPosition
.
call
(
this
);
if
(
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
-
25
-
this
.
getMaxTickWidth
(
'x'
);
}
else
{
return
position
.
isInner
?
"-0.5em"
:
config
.
axis_x_height
?
config
.
axis_x_height
-
10
:
"3em"
;
}
}
function
_dyForYAxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getYAxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"-0.5em"
:
"3em"
;
}
else
{
return
position
.
isInner
?
"1.2em"
:
-
10
-
(
$$
.
config
.
axis_y_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y'
)
+
10
));
}
}
function
_dyForY2AxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getY2AxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
"-2.2em"
;
}
else
{
return
position
.
isInner
?
"-0.5em"
:
15
+
(
$$
.
config
.
axis_y2_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y2'
)
+
15
));
}
}
function
_textAnchorForXAxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
!
$$
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_textAnchorForYAxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_textAnchorForY2AxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_xForRotatedTickText
(
r
)
{
return
8
*
Math
.
sin
(
Math
.
PI
*
(
r
/
180
));
}
function
_yForRotatedTickText
(
r
)
{
return
11.5
-
2.5
*
(
r
/
15
)
*
(
r
>
0
?
1
:
-
1
);
}
function
_rotateTickText
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
_yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
.
selectAll
(
'tspan'
)
.
attr
(
'dx'
,
_xForRotatedTickText
(
rotate
));
}
c3_chart_internal_fn
.
getClipPath
=
function
(
id
)
{
c3_chart_internal_fn
.
getClipPath
=
function
(
id
)
{
var
isIE9
=
window
.
navigator
.
appVersion
.
toLowerCase
().
indexOf
(
"msie 9."
)
>=
0
;
var
isIE9
=
window
.
navigator
.
appVersion
.
toLowerCase
().
indexOf
(
"msie 9."
)
>=
0
;
return
"url("
+
(
isIE9
?
""
:
document
.
URL
.
split
(
'#'
)[
0
])
+
"#"
+
id
+
")"
;
return
"url("
+
(
isIE9
?
""
:
document
.
URL
.
split
(
'#'
)[
0
])
+
"#"
+
id
+
")"
;
...
@@ -5552,7 +5542,7 @@
...
@@ -5552,7 +5542,7 @@
formatForY
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY2
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
formatForY2
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
return
function
(
v
,
ratio
,
id
)
{
return
function
(
v
,
ratio
,
id
)
{
var
format
=
$$
.
_
axis
.
getId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
var
format
=
$$
.
axis
.
getId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
return
format
.
call
(
$$
,
v
,
ratio
);
return
format
.
call
(
$$
,
v
,
ratio
);
};
};
};
};
...
@@ -6532,9 +6522,9 @@
...
@@ -6532,9 +6522,9 @@
var
$$
=
this
.
internal
;
var
$$
=
this
.
internal
;
if
(
arguments
.
length
)
{
if
(
arguments
.
length
)
{
Object
.
keys
(
labels
).
forEach
(
function
(
axisId
)
{
Object
.
keys
(
labels
).
forEach
(
function
(
axisId
)
{
$$
.
_
axis
.
setLabelText
(
axisId
,
labels
[
axisId
]);
$$
.
axis
.
setLabelText
(
axisId
,
labels
[
axisId
]);
});
});
$$
.
_
axis
.
updateLabels
();
$$
.
axis
.
updateLabels
();
}
}
// TODO: return some values?
// TODO: return some values?
};
};
...
@@ -6714,7 +6704,8 @@
...
@@ -6714,7 +6704,8 @@
return
newScale
;
return
newScale
;
}
}
function
textFormatted
(
v
)
{
function
textFormatted
(
v
)
{
return
tickFormat
?
tickFormat
(
v
)
:
v
;
var
formatted
=
tickFormat
?
tickFormat
(
v
)
:
v
;
return
typeof
formatted
!==
'undefined'
?
formatted
:
''
;
}
}
function
getSizeFor1Char
(
tick
)
{
function
getSizeFor1Char
(
tick
)
{
if
(
tickTextCharSize
)
{
if
(
tickTextCharSize
)
{
...
...
c3.min.js
View file @
1edb4dde
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/api.axis.js
View file @
1edb4dde
...
@@ -3,9 +3,9 @@ c3_chart_fn.axis.labels = function (labels) {
...
@@ -3,9 +3,9 @@ c3_chart_fn.axis.labels = function (labels) {
var
$$
=
this
.
internal
;
var
$$
=
this
.
internal
;
if
(
arguments
.
length
)
{
if
(
arguments
.
length
)
{
Object
.
keys
(
labels
).
forEach
(
function
(
axisId
)
{
Object
.
keys
(
labels
).
forEach
(
function
(
axisId
)
{
$$
.
_
axis
.
setLabelText
(
axisId
,
labels
[
axisId
]);
$$
.
axis
.
setLabelText
(
axisId
,
labels
[
axisId
]);
});
});
$$
.
_
axis
.
updateLabels
();
$$
.
axis
.
updateLabels
();
}
}
// TODO: return some values?
// TODO: return some values?
};
};
...
...
src/axis.js
View file @
1edb4dde
function
_
Axis
(
owner
)
{
function
Axis
(
owner
)
{
API
.
call
(
this
,
owner
);
API
.
call
(
this
,
owner
);
}
}
inherit
(
API
,
_
Axis
);
inherit
(
API
,
Axis
);
_
Axis
.
prototype
.
init
=
function
init
()
{
Axis
.
prototype
.
init
=
function
init
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
main
=
$$
.
main
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
main
=
$$
.
main
;
$$
.
axes
.
x
=
main
.
append
(
"g"
)
$$
.
axes
.
x
=
main
.
append
(
"g"
)
...
@@ -15,8 +15,7 @@ _Axis.prototype.init = function init() {
...
@@ -15,8 +15,7 @@ _Axis.prototype.init = function init() {
$$
.
axes
.
x
.
append
(
"text"
)
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisXLabel
)
.
attr
(
"class"
,
CLASS
.
axisXLabel
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
"rotate(-90)"
:
""
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
_textAnchorForXAxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForXAxisLabel
.
bind
(
this
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY
)
.
attr
(
"clip-path"
,
config
.
axis_y_inner
?
""
:
$$
.
clipPathForYAxis
)
.
attr
(
"clip-path"
,
config
.
axis_y_inner
?
""
:
$$
.
clipPathForYAxis
)
...
@@ -25,7 +24,7 @@ _Axis.prototype.init = function init() {
...
@@ -25,7 +24,7 @@ _Axis.prototype.init = function init() {
$$
.
axes
.
y
.
append
(
"text"
)
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisYLabel
)
.
attr
(
"class"
,
CLASS
.
axisYLabel
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
_
textAnchorForYAxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForYAxisLabel
.
bind
(
this
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY2
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisY2
)
...
@@ -35,9 +34,9 @@ _Axis.prototype.init = function init() {
...
@@ -35,9 +34,9 @@ _Axis.prototype.init = function init() {
$$
.
axes
.
y2
.
append
(
"text"
)
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
.
axisY2Label
)
.
attr
(
"class"
,
CLASS
.
axisY2Label
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
_
textAnchorForY2AxisLabel
.
bind
(
this
));
.
style
(
"text-anchor"
,
this
.
textAnchorForY2AxisLabel
.
bind
(
this
));
};
};
_
Axis
.
prototype
.
getXAxis
=
function
getXAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
,
withoutTransition
)
{
Axis
.
prototype
.
getXAxis
=
function
getXAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
,
withoutTransition
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
axisParams
=
{
axisParams
=
{
isCategory
:
$$
.
isCategorized
(),
isCategory
:
$$
.
isCategorized
(),
...
@@ -71,7 +70,7 @@ _Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValu
...
@@ -71,7 +70,7 @@ _Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValu
return
axis
;
return
axis
;
};
};
_
Axis
.
prototype
.
updateXAxisTickValues
=
function
updateXAxisTickValues
(
targets
,
axis
)
{
Axis
.
prototype
.
updateXAxisTickValues
=
function
updateXAxisTickValues
(
targets
,
axis
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
tickValues
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
tickValues
;
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
tickValues
=
this
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targets
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
tickValues
=
this
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targets
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
...
@@ -84,7 +83,7 @@ _Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets,
...
@@ -84,7 +83,7 @@ _Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets,
}
}
return
tickValues
;
return
tickValues
;
};
};
_
Axis
.
prototype
.
getYAxis
=
function
getYAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
Axis
.
prototype
.
getYAxis
=
function
getYAxis
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
},
var
axisParams
=
{
withOuterTick
:
withOuterTick
},
$$
=
this
.
owner
,
$$
=
this
.
owner
,
d3
=
$$
.
d3
,
d3
=
$$
.
d3
,
...
@@ -97,11 +96,11 @@ _Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValu
...
@@ -97,11 +96,11 @@ _Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValu
}
}
return
axis
;
return
axis
;
};
};
_
Axis
.
prototype
.
getId
=
function
getId
(
id
)
{
Axis
.
prototype
.
getId
=
function
getId
(
id
)
{
var
config
=
this
.
owner
.
config
;
var
config
=
this
.
owner
.
config
;
return
id
in
config
.
data_axes
?
config
.
data_axes
[
id
]
:
'y'
;
return
id
in
config
.
data_axes
?
config
.
data_axes
[
id
]
:
'y'
;
};
};
_
Axis
.
prototype
.
getXAxisTickFormat
=
function
getXAxisTickFormat
()
{
Axis
.
prototype
.
getXAxisTickFormat
=
function
getXAxisTickFormat
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
if
(
config
.
axis_x_tick_format
)
{
if
(
config
.
axis_x_tick_format
)
{
...
@@ -115,18 +114,36 @@ _Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() {
...
@@ -115,18 +114,36 @@ _Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() {
}
}
return
isFunction
(
format
)
?
function
(
v
)
{
return
format
.
call
(
$$
,
v
);
}
:
format
;
return
isFunction
(
format
)
?
function
(
v
)
{
return
format
.
call
(
$$
,
v
);
}
:
format
;
};
};
_Axis
.
prototype
.
getXAxisTickValues
=
function
getXAxisTickValues
()
{
Axis
.
prototype
.
getTickValues
=
function
getTickValues
(
tickValues
,
axis
)
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_x_tick_values
,
this
.
owner
.
xAxis
);
return
tickValues
?
tickValues
:
axis
?
axis
.
tickValues
()
:
undefined
;
};
Axis
.
prototype
.
getXAxisTickValues
=
function
getXAxisTickValues
()
{
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_x_tick_values
,
this
.
owner
.
xAxis
);
};
Axis
.
prototype
.
getYAxisTickValues
=
function
getYAxisTickValues
()
{
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_y_tick_values
,
this
.
owner
.
yAxis
);
};
};
_Axis
.
prototype
.
getYAxisTickValues
=
function
getYAxisTickValues
()
{
Axis
.
prototype
.
getY2AxisTickValues
=
function
getY2AxisTickValues
()
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_y_tick_values
,
this
.
owner
.
yAxis
);
return
this
.
getTickValues
(
this
.
owner
.
config
.
axis_y2_tick_values
,
this
.
owner
.
y2Axis
);
};
Axis
.
prototype
.
getLabelOptionByAxisId
=
function
getLabelOptionByAxisId
(
axisId
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
;
if
(
axisId
===
'y'
)
{
option
=
config
.
axis_y_label
;
}
else
if
(
axisId
===
'y2'
)
{
option
=
config
.
axis_y2_label
;
}
else
if
(
axisId
===
'x'
)
{
option
=
config
.
axis_x_label
;
}
return
option
;
};
};
_Axis
.
prototype
.
getY2AxisTickValues
=
function
getY2AxisTickValues
()
{
Axis
.
prototype
.
getLabelText
=
function
getLabelText
(
axisId
)
{
return
_getTickValues
(
this
.
owner
.
config
.
axis_y2_tick_values
,
this
.
owner
.
y2Axis
);
var
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
};
};
_
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
);
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
if
(
isString
(
option
))
{
if
(
isString
(
option
))
{
if
(
axisId
===
'y'
)
{
if
(
axisId
===
'y'
)
{
config
.
axis_y_label
=
text
;
config
.
axis_y_label
=
text
;
...
@@ -139,17 +156,136 @@ _Axis.prototype.setLabelText = function setLabelText(axisId, text) {
...
@@ -139,17 +156,136 @@ _Axis.prototype.setLabelText = function setLabelText(axisId, text) {
option
.
text
=
text
;
option
.
text
=
text
;
}
}
};
};
_Axis
.
prototype
.
getYAxisLabelPosition
=
function
getYAxisLabelPosition
()
{
Axis
.
prototype
.
getLabelPosition
=
function
getLabelPosition
(
axisId
,
defaultPosition
)
{
return
_getLabelPosition
.
call
(
this
,
'y'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
var
option
=
this
.
getLabelOptionByAxisId
(
axisId
),
position
=
(
option
&&
typeof
option
===
'object'
&&
option
.
position
)
?
option
.
position
:
defaultPosition
;
return
{
isInner
:
position
.
indexOf
(
'inner'
)
>=
0
,
isOuter
:
position
.
indexOf
(
'outer'
)
>=
0
,
isLeft
:
position
.
indexOf
(
'left'
)
>=
0
,
isCenter
:
position
.
indexOf
(
'center'
)
>=
0
,
isRight
:
position
.
indexOf
(
'right'
)
>=
0
,
isTop
:
position
.
indexOf
(
'top'
)
>=
0
,
isMiddle
:
position
.
indexOf
(
'middle'
)
>=
0
,
isBottom
:
position
.
indexOf
(
'bottom'
)
>=
0
};
};
Axis
.
prototype
.
getXAxisLabelPosition
=
function
getXAxisLabelPosition
()
{
return
this
.
getLabelPosition
(
'x'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-top'
:
'inner-right'
);
};
};
_Axis
.
prototype
.
getY2AxisLabelPosition
=
function
getY2
AxisLabelPosition
()
{
Axis
.
prototype
.
getYAxisLabelPosition
=
function
getY
AxisLabelPosition
()
{
return
_getLabelPosition
.
call
(
this
,
'y2
'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
return
this
.
getLabelPosition
(
'y
'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
};
};
_Axis
.
prototype
.
getLabelPositionById
=
function
getLabelPositionById
(
id
)
{
Axis
.
prototype
.
getY2AxisLabelPosition
=
function
getY2AxisLabelPosition
(
)
{
return
id
===
'y2'
?
this
.
getY2AxisLabelPosition
()
:
id
===
'y'
?
this
.
getYAxisLabelPosition
()
:
_getXAxisLabelPosition
.
call
(
this
);
return
this
.
getLabelPosition
(
'y2'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-right'
:
'inner-top'
);
};
};
Axis
.
prototype
.
getLabelPositionById
=
function
getLabelPositionById
(
id
)
{
_Axis
.
prototype
.
getMaxTickWidth
=
function
getMaxTickWidth
(
id
,
withoutRecompute
)
{
return
id
===
'y2'
?
this
.
getY2AxisLabelPosition
()
:
id
===
'y'
?
this
.
getYAxisLabelPosition
()
:
this
.
getXAxisLabelPosition
();
};
Axis
.
prototype
.
textForXAxisLabel
=
function
textForXAxisLabel
()
{
return
this
.
getLabelText
(
'x'
);
};
Axis
.
prototype
.
textForYAxisLabel
=
function
textForYAxisLabel
()
{
return
this
.
getLabelText
(
'y'
);
};
Axis
.
prototype
.
textForY2AxisLabel
=
function
textForY2AxisLabel
()
{
return
this
.
getLabelText
(
'y2'
);
};
Axis
.
prototype
.
xForAxisLabel
=
function
xForAxisLabel
(
forHorizontal
,
position
)
{
var
$$
=
this
.
owner
;
if
(
forHorizontal
)
{
return
position
.
isLeft
?
0
:
position
.
isCenter
?
$$
.
width
/
2
:
$$
.
width
;
}
else
{
return
position
.
isBottom
?
-
$$
.
height
:
position
.
isMiddle
?
-
$$
.
height
/
2
:
0
;
}
};
Axis
.
prototype
.
dxForAxisLabel
=
function
dxForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
"0.5em"
:
position
.
isRight
?
"-0.5em"
:
"0"
;
}
else
{
return
position
.
isTop
?
"-0.5em"
:
position
.
isBottom
?
"0.5em"
:
"0"
;
}
};
Axis
.
prototype
.
textAnchorForAxisLabel
=
function
textAnchorForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
'start'
:
position
.
isCenter
?
'middle'
:
'end'
;
}
else
{
return
position
.
isBottom
?
'start'
:
position
.
isMiddle
?
'middle'
:
'end'
;
}
};
Axis
.
prototype
.
xForXAxisLabel
=
function
xForXAxisLabel
()
{
return
this
.
xForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
xForYAxisLabel
=
function
xForYAxisLabel
()
{
return
this
.
xForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
xForY2AxisLabel
=
function
xForY2AxisLabel
()
{
return
this
.
xForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
dxForXAxisLabel
=
function
dxForXAxisLabel
()
{
return
this
.
dxForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
dxForYAxisLabel
=
function
dxForYAxisLabel
()
{
return
this
.
dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
dxForY2AxisLabel
=
function
dxForY2AxisLabel
()
{
return
this
.
dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
dyForXAxisLabel
=
function
dyForXAxisLabel
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
position
=
this
.
getXAxisLabelPosition
();
if
(
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
-
25
-
this
.
getMaxTickWidth
(
'x'
);
}
else
{
return
position
.
isInner
?
"-0.5em"
:
config
.
axis_x_height
?
config
.
axis_x_height
-
10
:
"3em"
;
}
};
Axis
.
prototype
.
dyForYAxisLabel
=
function
dyForYAxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getYAxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"-0.5em"
:
"3em"
;
}
else
{
return
position
.
isInner
?
"1.2em"
:
-
10
-
(
$$
.
config
.
axis_y_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y'
)
+
10
));
}
};
Axis
.
prototype
.
dyForY2AxisLabel
=
function
dyForY2AxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getY2AxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
"-2.2em"
;
}
else
{
return
position
.
isInner
?
"-0.5em"
:
15
+
(
$$
.
config
.
axis_y2_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y2'
)
+
15
));
}
};
Axis
.
prototype
.
textAnchorForXAxisLabel
=
function
textAnchorForXAxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
!
$$
.
config
.
axis_rotated
,
this
.
getXAxisLabelPosition
());
};
Axis
.
prototype
.
textAnchorForYAxisLabel
=
function
textAnchorForYAxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
};
Axis
.
prototype
.
textAnchorForY2AxisLabel
=
function
textAnchorForY2AxisLabel
()
{
var
$$
=
this
.
owner
;
return
this
.
textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
};
Axis
.
prototype
.
xForRotatedTickText
=
function
xForRotatedTickText
(
r
)
{
return
8
*
Math
.
sin
(
Math
.
PI
*
(
r
/
180
));
};
Axis
.
prototype
.
yForRotatedTickText
=
function
yForRotatedTickText
(
r
)
{
return
11.5
-
2.5
*
(
r
/
15
)
*
(
r
>
0
?
1
:
-
1
);
};
Axis
.
prototype
.
rotateTickText
=
function
rotateTickText
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
this
.
yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
.
selectAll
(
'tspan'
)
.
attr
(
'dx'
,
this
.
xForRotatedTickText
(
rotate
));
};
Axis
.
prototype
.
getMaxTickWidth
=
function
getMaxTickWidth
(
id
,
withoutRecompute
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
maxWidth
=
0
,
targetsToShow
,
scale
,
axis
,
body
,
svg
;
maxWidth
=
0
,
targetsToShow
,
scale
,
axis
,
body
,
svg
;
if
(
withoutRecompute
&&
$$
.
currentMaxTickWidths
[
id
])
{
if
(
withoutRecompute
&&
$$
.
currentMaxTickWidths
[
id
])
{
...
@@ -186,29 +322,28 @@ _Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute)
...
@@ -186,29 +322,28 @@ _Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute)
return
$$
.
currentMaxTickWidths
[
id
];
return
$$
.
currentMaxTickWidths
[
id
];
};
};
_
Axis
.
prototype
.
updateLabels
=
function
updateLabels
(
withTransition
)
{
Axis
.
prototype
.
updateLabels
=
function
updateLabels
(
withTransition
)
{
var
$$
=
this
.
owner
;
var
$$
=
this
.
owner
;
var
axisXLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
),
var
axisXLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
),
axisYLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
),
axisYLabel
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
),
axisY2Label
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
);
axisY2Label
=
$$
.
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
);
(
withTransition
?
axisXLabel
.
transition
()
:
axisXLabel
)
(
withTransition
?
axisXLabel
.
transition
()
:
axisXLabel
)
.
attr
(
"x"
,
_
xForXAxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForXAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForXAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForXAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForXAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForXAxisLabel
.
bind
(
this
))
.
text
(
_
textForXAxisLabel
.
bind
(
this
));
.
text
(
this
.
textForXAxisLabel
.
bind
(
this
));
(
withTransition
?
axisYLabel
.
transition
()
:
axisYLabel
)
(
withTransition
?
axisYLabel
.
transition
()
:
axisYLabel
)
.
attr
(
"x"
,
_
xForYAxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForYAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForYAxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForYAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForYAxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForYAxisLabel
.
bind
(
this
))
.
text
(
_
textForYAxisLabel
.
bind
(
this
));
.
text
(
this
.
textForYAxisLabel
.
bind
(
this
));
(
withTransition
?
axisY2Label
.
transition
()
:
axisY2Label
)
(
withTransition
?
axisY2Label
.
transition
()
:
axisY2Label
)
.
attr
(
"x"
,
_
xForY2AxisLabel
.
bind
(
this
))
.
attr
(
"x"
,
this
.
xForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
_
dxForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dx"
,
this
.
dxForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
_
dyForY2AxisLabel
.
bind
(
this
))
.
attr
(
"dy"
,
this
.
dyForY2AxisLabel
.
bind
(
this
))
.
text
(
_
textForY2AxisLabel
.
bind
(
this
));
.
text
(
this
.
textForY2AxisLabel
.
bind
(
this
));
};
};
Axis
.
prototype
.
getPadding
=
function
getPadding
(
padding
,
key
,
defaultValue
,
domainLength
)
{
_Axis
.
prototype
.
getPadding
=
function
getPadding
(
padding
,
key
,
defaultValue
,
domainLength
)
{
if
(
!
isValue
(
padding
[
key
]))
{
if
(
!
isValue
(
padding
[
key
]))
{
return
defaultValue
;
return
defaultValue
;
}
}
...
@@ -218,13 +353,12 @@ _Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, dom
...
@@ -218,13 +353,12 @@ _Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, dom
// assume padding is pixels if unit is not specified
// assume padding is pixels if unit is not specified
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
};
};
_
Axis
.
prototype
.
convertPixelsToAxisPadding
=
function
convertPixelsToAxisPadding
(
pixels
,
domainLength
)
{
Axis
.
prototype
.
convertPixelsToAxisPadding
=
function
convertPixelsToAxisPadding
(
pixels
,
domainLength
)
{
var
$$
=
this
.
owner
,
var
$$
=
this
.
owner
,
length
=
$$
.
config
.
axis_rotated
?
$$
.
width
:
$$
.
height
;
length
=
$$
.
config
.
axis_rotated
?
$$
.
width
:
$$
.
height
;
return
domainLength
*
(
pixels
/
length
);
return
domainLength
*
(
pixels
/
length
);
};
};
Axis
.
prototype
.
generateTickValues
=
function
generateTickValues
(
values
,
tickCount
,
forTimeSeries
)
{
_Axis
.
prototype
.
generateTickValues
=
function
generateTickValues
(
values
,
tickCount
,
forTimeSeries
)
{
var
tickValues
=
values
,
targetCount
,
start
,
end
,
count
,
interval
,
i
,
tickValue
;
var
tickValues
=
values
,
targetCount
,
start
,
end
,
count
,
interval
,
i
,
tickValue
;
if
(
tickCount
)
{
if
(
tickCount
)
{
targetCount
=
isFunction
(
tickCount
)
?
tickCount
()
:
tickCount
;
targetCount
=
isFunction
(
tickCount
)
?
tickCount
()
:
tickCount
;
...
@@ -250,7 +384,7 @@ _Axis.prototype.generateTickValues = function generateTickValues(values, tickCou
...
@@ -250,7 +384,7 @@ _Axis.prototype.generateTickValues = function generateTickValues(values, tickCou
if
(
!
forTimeSeries
)
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
if
(
!
forTimeSeries
)
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
return
tickValues
;
return
tickValues
;
};
};
_
Axis
.
prototype
.
generateTransitions
=
function
generateTransitions
(
duration
)
{
Axis
.
prototype
.
generateTransitions
=
function
generateTransitions
(
duration
)
{
var
$$
=
this
.
owner
,
axes
=
$$
.
axes
;
var
$$
=
this
.
owner
,
axes
=
$$
.
axes
;
return
{
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
...
@@ -259,7 +393,7 @@ _Axis.prototype.generateTransitions = function generateTransitions(duration) {
...
@@ -259,7 +393,7 @@ _Axis.prototype.generateTransitions = function generateTransitions(duration) {
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
};
};
_
Axis
.
prototype
.
redraw
=
function
redraw
(
transitions
,
isHidden
)
{
Axis
.
prototype
.
redraw
=
function
redraw
(
transitions
,
isHidden
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
;
var
$$
=
this
.
owner
,
config
=
$$
.
config
;
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
...
@@ -271,171 +405,7 @@ _Axis.prototype.redraw = function redraw(transitions, isHidden) {
...
@@ -271,171 +405,7 @@ _Axis.prototype.redraw = function redraw(transitions, isHidden) {
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
// rotate tick text if needed
// rotate tick text if needed
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
_
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
this
.
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
_
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
this
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
}
}
};
};
function
_getTickValues
(
tickValues
,
axis
)
{
return
tickValues
?
tickValues
:
axis
?
axis
.
tickValues
()
:
undefined
;
}
function
_getLabelOptionByAxisId
(
axisId
)
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
;
if
(
axisId
===
'y'
)
{
option
=
config
.
axis_y_label
;
}
else
if
(
axisId
===
'y2'
)
{
option
=
config
.
axis_y2_label
;
}
else
if
(
axisId
===
'x'
)
{
option
=
config
.
axis_x_label
;
}
return
option
;
}
function
_getLabelText
(
axisId
)
{
var
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
);
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
}
function
_getLabelPosition
(
axisId
,
defaultPosition
)
{
var
option
=
_getLabelOptionByAxisId
.
call
(
this
,
axisId
),
position
=
(
option
&&
typeof
option
===
'object'
&&
option
.
position
)
?
option
.
position
:
defaultPosition
;
return
{
isInner
:
position
.
indexOf
(
'inner'
)
>=
0
,
isOuter
:
position
.
indexOf
(
'outer'
)
>=
0
,
isLeft
:
position
.
indexOf
(
'left'
)
>=
0
,
isCenter
:
position
.
indexOf
(
'center'
)
>=
0
,
isRight
:
position
.
indexOf
(
'right'
)
>=
0
,
isTop
:
position
.
indexOf
(
'top'
)
>=
0
,
isMiddle
:
position
.
indexOf
(
'middle'
)
>=
0
,
isBottom
:
position
.
indexOf
(
'bottom'
)
>=
0
};
}
function
_getXAxisLabelPosition
()
{
return
_getLabelPosition
.
call
(
this
,
'x'
,
this
.
owner
.
config
.
axis_rotated
?
'inner-top'
:
'inner-right'
);
}
function
_textForXAxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'x'
);
}
function
_textForYAxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'y'
);
}
function
_textForY2AxisLabel
()
{
return
_getLabelText
.
call
(
this
,
'y2'
);
}
function
_xForAxisLabel
(
forHorizontal
,
position
)
{
var
$$
=
this
.
owner
;
if
(
forHorizontal
)
{
return
position
.
isLeft
?
0
:
position
.
isCenter
?
$$
.
width
/
2
:
$$
.
width
;
}
else
{
return
position
.
isBottom
?
-
$$
.
height
:
position
.
isMiddle
?
-
$$
.
height
/
2
:
0
;
}
}
function
_dxForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
"0.5em"
:
position
.
isRight
?
"-0.5em"
:
"0"
;
}
else
{
return
position
.
isTop
?
"-0.5em"
:
position
.
isBottom
?
"0.5em"
:
"0"
;
}
}
function
_textAnchorForAxisLabel
(
forHorizontal
,
position
)
{
if
(
forHorizontal
)
{
return
position
.
isLeft
?
'start'
:
position
.
isCenter
?
'middle'
:
'end'
;
}
else
{
return
position
.
isBottom
?
'start'
:
position
.
isMiddle
?
'middle'
:
'end'
;
}
}
function
_xForXAxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
!
this
.
owner
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_xForYAxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_xForY2AxisLabel
()
{
return
_xForAxisLabel
.
call
(
this
,
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_dxForXAxisLabel
()
{
return
_dxForAxisLabel
(
!
this
.
owner
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_dxForYAxisLabel
()
{
return
_dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_dxForY2AxisLabel
()
{
return
_dxForAxisLabel
(
this
.
owner
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_dyForXAxisLabel
()
{
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
position
=
_getXAxisLabelPosition
.
call
(
this
);
if
(
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
-
25
-
this
.
getMaxTickWidth
(
'x'
);
}
else
{
return
position
.
isInner
?
"-0.5em"
:
config
.
axis_x_height
?
config
.
axis_x_height
-
10
:
"3em"
;
}
}
function
_dyForYAxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getYAxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"-0.5em"
:
"3em"
;
}
else
{
return
position
.
isInner
?
"1.2em"
:
-
10
-
(
$$
.
config
.
axis_y_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y'
)
+
10
));
}
}
function
_dyForY2AxisLabel
()
{
var
$$
=
this
.
owner
,
position
=
this
.
getY2AxisLabelPosition
();
if
(
$$
.
config
.
axis_rotated
)
{
return
position
.
isInner
?
"1.2em"
:
"-2.2em"
;
}
else
{
return
position
.
isInner
?
"-0.5em"
:
15
+
(
$$
.
config
.
axis_y2_inner
?
0
:
(
this
.
getMaxTickWidth
(
'y2'
)
+
15
));
}
}
function
_textAnchorForXAxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
!
$$
.
config
.
axis_rotated
,
_getXAxisLabelPosition
.
call
(
this
));
}
function
_textAnchorForYAxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getYAxisLabelPosition
());
}
function
_textAnchorForY2AxisLabel
()
{
var
$$
=
this
.
owner
;
return
_textAnchorForAxisLabel
(
$$
.
config
.
axis_rotated
,
this
.
getY2AxisLabelPosition
());
}
function
_xForRotatedTickText
(
r
)
{
return
8
*
Math
.
sin
(
Math
.
PI
*
(
r
/
180
));
}
function
_yForRotatedTickText
(
r
)
{
return
11.5
-
2.5
*
(
r
/
15
)
*
(
r
>
0
?
1
:
-
1
);
}
function
_rotateTickText
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
_yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
.
selectAll
(
'tspan'
)
.
attr
(
'dx'
,
_xForRotatedTickText
(
rotate
));
}
src/c3.axis.js
View file @
1edb4dde
...
@@ -48,7 +48,8 @@ function c3_axis(d3, params) {
...
@@ -48,7 +48,8 @@ function c3_axis(d3, params) {
return
newScale
;
return
newScale
;
}
}
function
textFormatted
(
v
)
{
function
textFormatted
(
v
)
{
return
tickFormat
?
tickFormat
(
v
)
:
v
;
var
formatted
=
tickFormat
?
tickFormat
(
v
)
:
v
;
return
typeof
formatted
!==
'undefined'
?
formatted
:
''
;
}
}
function
getSizeFor1Char
(
tick
)
{
function
getSizeFor1Char
(
tick
)
{
if
(
tickTextCharSize
)
{
if
(
tickTextCharSize
)
{
...
...
src/core.js
View file @
1edb4dde
var
c3
=
{
version
:
"0.4.9"
};
var
c3
=
{
version
:
"0.4.9"
};
var
c3_chart_fn
,
c3_chart_internal_fn
;
var
c3_chart_fn
,
c3_chart_internal_fn
,
c3_chart_internal_axis_fn
;
function
API
(
owner
)
{
function
API
(
owner
)
{
this
.
owner
=
owner
;
this
.
owner
=
owner
;
...
@@ -54,12 +56,15 @@ c3.generate = function (config) {
...
@@ -54,12 +56,15 @@ c3.generate = function (config) {
c3
.
chart
=
{
c3
.
chart
=
{
fn
:
Chart
.
prototype
,
fn
:
Chart
.
prototype
,
internal
:
{
internal
:
{
fn
:
ChartInternal
.
prototype
fn
:
ChartInternal
.
prototype
,
axis
:
{
fn
:
Axis
.
prototype
}
}
}
};
};
c3_chart_fn
=
c3
.
chart
.
fn
;
c3_chart_fn
=
c3
.
chart
.
fn
;
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
c3_chart_internal_axis_fn
=
c3
.
chart
.
internal
.
axis
.
fn
;
c3_chart_internal_fn
.
init
=
function
()
{
c3_chart_internal_fn
.
init
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
;
var
$$
=
this
,
config
=
$$
.
config
;
...
@@ -168,7 +173,7 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -168,7 +173,7 @@ c3_chart_internal_fn.initWithData = function (data) {
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
defs
,
main
,
binding
=
true
;
var
defs
,
main
,
binding
=
true
;
$$
.
_axis
=
new
_
Axis
(
$$
);
$$
.
axis
=
new
Axis
(
$$
);
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
...
@@ -287,7 +292,7 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -287,7 +292,7 @@ c3_chart_internal_fn.initWithData = function (data) {
if
(
config
.
axis_x_extent
)
{
$$
.
brush
.
extent
(
$$
.
getDefaultExtent
());
}
if
(
config
.
axis_x_extent
)
{
$$
.
brush
.
extent
(
$$
.
getDefaultExtent
());
}
// Add Axis
// Add Axis
$$
.
_
axis
.
init
();
$$
.
axis
.
init
();
// Set targets
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
$$
.
updateTargets
(
$$
.
data
.
targets
);
...
@@ -477,7 +482,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -477,7 +482,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
durationForExit
=
withTransitionForExit
?
duration
:
0
;
durationForExit
=
withTransitionForExit
?
duration
:
0
;
durationForAxis
=
withTransitionForAxis
?
duration
:
0
;
durationForAxis
=
withTransitionForAxis
?
duration
:
0
;
transitions
=
transitions
||
$$
.
_
axis
.
generateTransitions
(
durationForAxis
);
transitions
=
transitions
||
$$
.
axis
.
generateTransitions
(
durationForAxis
);
// update legend and transform each g
// update legend and transform each g
if
(
withLegend
&&
config
.
legend_show
)
{
if
(
withLegend
&&
config
.
legend_show
)
{
...
@@ -496,7 +501,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -496,7 +501,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
if
(
!
config
.
axis_x_tick_values
)
{
if
(
!
config
.
axis_x_tick_values
)
{
tickValues
=
$$
.
_
axis
.
updateXAxisTickValues
(
targetsToShow
);
tickValues
=
$$
.
axis
.
updateXAxisTickValues
(
targetsToShow
);
}
}
}
else
{
}
else
{
$$
.
xAxis
.
tickValues
([]);
$$
.
xAxis
.
tickValues
([]);
...
@@ -511,17 +516,17 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -511,17 +516,17 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
$$
.
yAxis
.
tickValues
(
$$
.
_
axis
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
));
$$
.
yAxis
.
tickValues
(
$$
.
axis
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
));
}
}
if
(
!
config
.
axis_y2_tick_values
&&
config
.
axis_y2_tick_count
)
{
if
(
!
config
.
axis_y2_tick_values
&&
config
.
axis_y2_tick_count
)
{
$$
.
y2Axis
.
tickValues
(
$$
.
_
axis
.
generateTickValues
(
$$
.
y2
.
domain
(),
config
.
axis_y2_tick_count
));
$$
.
y2Axis
.
tickValues
(
$$
.
axis
.
generateTickValues
(
$$
.
y2
.
domain
(),
config
.
axis_y2_tick_count
));
}
}
// axes
// axes
$$
.
_
axis
.
redraw
(
transitions
,
hideAxis
);
$$
.
axis
.
redraw
(
transitions
,
hideAxis
);
// Update axis label
// Update axis label
$$
.
_
axis
.
updateLabels
(
withTransition
);
$$
.
axis
.
updateLabels
(
withTransition
);
// show/hide if manual culling needed
// show/hide if manual culling needed
if
((
withUpdateXDomain
||
withUpdateXAxis
)
&&
targetsToShow
.
length
)
{
if
((
withUpdateXDomain
||
withUpdateXAxis
)
&&
targetsToShow
.
length
)
{
...
@@ -632,7 +637,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -632,7 +637,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
});
});
}
}
if
(
duration
)
{
if
(
duration
&&
$$
.
isTabVisible
())
{
// Only use transition if tab visible. See #938.
// transition should be derived from one transition
// transition should be derived from one transition
d3
.
transition
().
duration
(
duration
).
each
(
function
()
{
d3
.
transition
().
duration
(
duration
).
each
(
function
()
{
var
transitionsToWait
=
[];
var
transitionsToWait
=
[];
...
@@ -702,7 +707,7 @@ c3_chart_internal_fn.updateAndRedraw = function (options) {
...
@@ -702,7 +707,7 @@ c3_chart_internal_fn.updateAndRedraw = function (options) {
$$
.
updateSizes
();
$$
.
updateSizes
();
// MEMO: called in updateLegend in redraw if withLegend
// MEMO: called in updateLegend in redraw if withLegend
if
(
!
(
options
.
withLegend
&&
config
.
legend_show
))
{
if
(
!
(
options
.
withLegend
&&
config
.
legend_show
))
{
transitions
=
$$
.
_
axis
.
generateTransitions
(
options
.
withTransitionForAxis
?
config
.
transition_duration
:
0
);
transitions
=
$$
.
axis
.
generateTransitions
(
options
.
withTransitionForAxis
?
config
.
transition_duration
:
0
);
// Update scales
// Update scales
$$
.
updateScales
();
$$
.
updateScales
();
$$
.
updateSvgSize
();
$$
.
updateSvgSize
();
...
@@ -972,3 +977,18 @@ c3_chart_internal_fn.parseDate = function (date) {
...
@@ -972,3 +977,18 @@ c3_chart_internal_fn.parseDate = function (date) {
}
}
return
parsedDate
;
return
parsedDate
;
};
};
c3_chart_internal_fn
.
isTabVisible
=
function
()
{
var
hidden
;
if
(
typeof
document
.
hidden
!==
"undefined"
)
{
// Opera 12.10 and Firefox 18 and later support
hidden
=
"hidden"
;
}
else
if
(
typeof
document
.
mozHidden
!==
"undefined"
)
{
hidden
=
"mozHidden"
;
}
else
if
(
typeof
document
.
msHidden
!==
"undefined"
)
{
hidden
=
"msHidden"
;
}
else
if
(
typeof
document
.
webkitHidden
!==
"undefined"
)
{
hidden
=
"webkitHidden"
;
}
return
document
[
hidden
]
?
false
:
true
;
};
src/domain.js
View file @
1edb4dde
...
@@ -20,7 +20,7 @@ c3_chart_internal_fn.getYDomainMin = function (targets) {
...
@@ -20,7 +20,7 @@ c3_chart_internal_fn.getYDomainMin = function (targets) {
id
=
idsInGroup
[
k
];
id
=
idsInGroup
[
k
];
if
(
!
ys
[
id
])
{
continue
;
}
if
(
!
ys
[
id
])
{
continue
;
}
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
if
(
$$
.
_axis
.
getId
(
id
)
===
$$
.
_
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasNegativeValue
&&
+
v
>
0
))
{
if
(
$$
.
axis
.
getId
(
id
)
===
$$
.
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasNegativeValue
&&
+
v
>
0
))
{
ys
[
baseId
][
i
]
+=
+
v
;
ys
[
baseId
][
i
]
+=
+
v
;
}
}
});
});
...
@@ -51,7 +51,7 @@ c3_chart_internal_fn.getYDomainMax = function (targets) {
...
@@ -51,7 +51,7 @@ c3_chart_internal_fn.getYDomainMax = function (targets) {
id
=
idsInGroup
[
k
];
id
=
idsInGroup
[
k
];
if
(
!
ys
[
id
])
{
continue
;
}
if
(
!
ys
[
id
])
{
continue
;
}
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
ys
[
id
].
forEach
(
function
(
v
,
i
)
{
if
(
$$
.
_axis
.
getId
(
id
)
===
$$
.
_
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasPositiveValue
&&
+
v
<
0
))
{
if
(
$$
.
axis
.
getId
(
id
)
===
$$
.
axis
.
getId
(
baseId
)
&&
ys
[
baseId
]
&&
!
(
hasPositiveValue
&&
+
v
<
0
))
{
ys
[
baseId
][
i
]
+=
+
v
;
ys
[
baseId
][
i
]
+=
+
v
;
}
}
});
});
...
@@ -62,7 +62,7 @@ c3_chart_internal_fn.getYDomainMax = function (targets) {
...
@@ -62,7 +62,7 @@ c3_chart_internal_fn.getYDomainMax = function (targets) {
};
};
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
_
axis
.
getId
(
t
.
id
)
===
axisId
;
}),
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
axis
.
getId
(
t
.
id
)
===
axisId
;
}),
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
...
@@ -123,16 +123,16 @@ c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) {
...
@@ -123,16 +123,16 @@ c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) {
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
else
if
(
showVerticalDataLabel
)
{
}
else
if
(
showVerticalDataLabel
)
{
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
'height'
);
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
'height'
);
padding_top
+=
this
.
_
axis
.
convertPixelsToAxisPadding
(
lengths
[
1
],
domainLength
);
padding_top
+=
$$
.
axis
.
convertPixelsToAxisPadding
(
lengths
[
1
],
domainLength
);
padding_bottom
+=
this
.
_
axis
.
convertPixelsToAxisPadding
(
lengths
[
0
],
domainLength
);
padding_bottom
+=
$$
.
axis
.
convertPixelsToAxisPadding
(
lengths
[
0
],
domainLength
);
}
}
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
padding_top
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y_padding
,
'top'
,
padding_top
,
domainLength
);
padding_top
=
$$
.
axis
.
getPadding
(
config
.
axis_y_padding
,
'top'
,
padding_top
,
domainLength
);
padding_bottom
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
padding_bottom
=
$$
.
axis
.
getPadding
(
config
.
axis_y_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
}
}
if
(
axisId
===
'y2'
&&
notEmpty
(
config
.
axis_y2_padding
))
{
if
(
axisId
===
'y2'
&&
notEmpty
(
config
.
axis_y2_padding
))
{
padding_top
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y2_padding
,
'top'
,
padding_top
,
domainLength
);
padding_top
=
$$
.
axis
.
getPadding
(
config
.
axis_y2_padding
,
'top'
,
padding_top
,
domainLength
);
padding_bottom
=
$$
.
_
axis
.
getPadding
(
config
.
axis_y2_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
padding_bottom
=
$$
.
axis
.
getPadding
(
config
.
axis_y2_padding
,
'bottom'
,
padding_bottom
,
domainLength
);
}
}
// Bar/Area chart should be 0-based if all positive|negative
// Bar/Area chart should be 0-based if all positive|negative
if
(
isZeroBased
)
{
if
(
isZeroBased
)
{
...
...
src/format.js
View file @
1edb4dde
...
@@ -3,7 +3,7 @@ c3_chart_internal_fn.getYFormat = function (forArc) {
...
@@ -3,7 +3,7 @@ c3_chart_internal_fn.getYFormat = function (forArc) {
formatForY
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
yFormat
,
formatForY2
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
formatForY2
=
forArc
&&
!
$$
.
hasType
(
'gauge'
)
?
$$
.
defaultArcValueFormat
:
$$
.
y2Format
;
return
function
(
v
,
ratio
,
id
)
{
return
function
(
v
,
ratio
,
id
)
{
var
format
=
$$
.
_
axis
.
getId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
var
format
=
$$
.
axis
.
getId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
return
format
.
call
(
$$
,
v
,
ratio
);
return
format
.
call
(
$$
,
v
,
ratio
);
};
};
};
};
...
...
src/scale.js
View file @
1edb4dde
...
@@ -44,10 +44,10 @@ c3_chart_internal_fn.getY = function (min, max, domain) {
...
@@ -44,10 +44,10 @@ c3_chart_internal_fn.getY = function (min, max, domain) {
return
scale
;
return
scale
;
};
};
c3_chart_internal_fn
.
getYScale
=
function
(
id
)
{
c3_chart_internal_fn
.
getYScale
=
function
(
id
)
{
return
this
.
_
axis
.
getId
(
id
)
===
'y2'
?
this
.
y2
:
this
.
y
;
return
this
.
axis
.
getId
(
id
)
===
'y2'
?
this
.
y2
:
this
.
y
;
};
};
c3_chart_internal_fn
.
getSubYScale
=
function
(
id
)
{
c3_chart_internal_fn
.
getSubYScale
=
function
(
id
)
{
return
this
.
_
axis
.
getId
(
id
)
===
'y2'
?
this
.
subY2
:
this
.
subY
;
return
this
.
axis
.
getId
(
id
)
===
'y2'
?
this
.
subY2
:
this
.
subY
;
};
};
c3_chart_internal_fn
.
updateScales
=
function
()
{
c3_chart_internal_fn
.
updateScales
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
...
@@ -69,15 +69,15 @@ c3_chart_internal_fn.updateScales = function () {
...
@@ -69,15 +69,15 @@ c3_chart_internal_fn.updateScales = function () {
$$
.
subY
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y_default
:
$$
.
subY
.
domain
());
$$
.
subY
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y_default
:
$$
.
subY
.
domain
());
$$
.
subY2
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y2_default
:
$$
.
subY2
.
domain
());
$$
.
subY2
=
$$
.
getY
(
$$
.
subYMin
,
$$
.
subYMax
,
forInit
?
config
.
axis_y2_default
:
$$
.
subY2
.
domain
());
// update axes
// update axes
$$
.
xAxisTickFormat
=
$$
.
_
axis
.
getXAxisTickFormat
();
$$
.
xAxisTickFormat
=
$$
.
axis
.
getXAxisTickFormat
();
$$
.
xAxisTickValues
=
$$
.
_
axis
.
getXAxisTickValues
();
$$
.
xAxisTickValues
=
$$
.
axis
.
getXAxisTickValues
();
$$
.
yAxisTickValues
=
$$
.
_
axis
.
getYAxisTickValues
();
$$
.
yAxisTickValues
=
$$
.
axis
.
getYAxisTickValues
();
$$
.
y2AxisTickValues
=
$$
.
_
axis
.
getY2AxisTickValues
();
$$
.
y2AxisTickValues
=
$$
.
axis
.
getY2AxisTickValues
();
$$
.
xAxis
=
$$
.
_
axis
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
xAxis
=
$$
.
axis
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
_
axis
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
axis
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
yAxis
=
$$
.
_
axis
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
$$
.
yAxisTickValues
,
config
.
axis_y_tick_outer
);
$$
.
yAxis
=
$$
.
axis
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
$$
.
yAxisTickValues
,
config
.
axis_y_tick_outer
);
$$
.
y2Axis
=
$$
.
_
axis
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
$$
.
y2AxisTickValues
,
config
.
axis_y2_tick_outer
);
$$
.
y2Axis
=
$$
.
axis
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
$$
.
y2AxisTickValues
,
config
.
axis_y2_tick_outer
);
// Set initialized scales to brush and zoom
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
if
(
!
forInit
)
{
...
...
src/size.js
View file @
1edb4dde
...
@@ -22,7 +22,7 @@ c3_chart_internal_fn.getCurrentPaddingLeft = function (withoutRecompute) {
...
@@ -22,7 +22,7 @@ c3_chart_internal_fn.getCurrentPaddingLeft = function (withoutRecompute) {
}
else
if
(
config
.
axis_rotated
)
{
}
else
if
(
config
.
axis_rotated
)
{
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
}
else
if
(
!
config
.
axis_y_show
||
config
.
axis_y_inner
)
{
// && !config.axis_rotated
}
else
if
(
!
config
.
axis_y_show
||
config
.
axis_y_inner
)
{
// && !config.axis_rotated
return
$$
.
_
axis
.
getYAxisLabelPosition
().
isOuter
?
30
:
1
;
return
$$
.
axis
.
getYAxisLabelPosition
().
isOuter
?
30
:
1
;
}
else
{
}
else
{
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
}
}
...
@@ -35,7 +35,7 @@ c3_chart_internal_fn.getCurrentPaddingRight = function () {
...
@@ -35,7 +35,7 @@ c3_chart_internal_fn.getCurrentPaddingRight = function () {
}
else
if
(
config
.
axis_rotated
)
{
}
else
if
(
config
.
axis_rotated
)
{
return
defaultPadding
+
legendWidthOnRight
;
return
defaultPadding
+
legendWidthOnRight
;
}
else
if
(
!
config
.
axis_y2_show
||
config
.
axis_y2_inner
)
{
// && !config.axis_rotated
}
else
if
(
!
config
.
axis_y2_show
||
config
.
axis_y2_inner
)
{
// && !config.axis_rotated
return
2
+
legendWidthOnRight
+
(
$$
.
_
axis
.
getY2AxisLabelPosition
().
isOuter
?
20
:
0
);
return
2
+
legendWidthOnRight
+
(
$$
.
axis
.
getY2AxisLabelPosition
().
isOuter
?
20
:
0
);
}
else
{
}
else
{
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y2'
))
+
legendWidthOnRight
;
return
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y2'
))
+
legendWidthOnRight
;
}
}
...
@@ -75,8 +75,8 @@ c3_chart_internal_fn.getSvgLeft = function (withoutRecompute) {
...
@@ -75,8 +75,8 @@ c3_chart_internal_fn.getSvgLeft = function (withoutRecompute) {
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
var
$$
=
this
,
position
=
$$
.
_
axis
.
getLabelPositionById
(
id
);
var
$$
=
this
,
position
=
$$
.
axis
.
getLabelPositionById
(
id
);
return
$$
.
_
axis
.
getMaxTickWidth
(
id
,
withoutRecompute
)
+
(
position
.
isInner
?
20
:
40
);
return
$$
.
axis
.
getMaxTickWidth
(
id
,
withoutRecompute
)
+
(
position
.
isInner
?
20
:
40
);
};
};
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
...
@@ -86,9 +86,9 @@ c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) {
...
@@ -86,9 +86,9 @@ c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) {
if
(
axisId
===
'y2'
&&
!
config
.
axis_y2_show
)
{
return
$$
.
rotated_padding_top
;
}
if
(
axisId
===
'y2'
&&
!
config
.
axis_y2_show
)
{
return
$$
.
rotated_padding_top
;
}
// Calculate x axis height when tick rotated
// Calculate x axis height when tick rotated
if
(
axisId
===
'x'
&&
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
axisId
===
'x'
&&
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
h
=
$$
.
_
axis
.
getMaxTickWidth
(
axisId
)
*
Math
.
cos
(
Math
.
PI
*
(
90
-
config
.
axis_x_tick_rotate
)
/
180
);
h
=
$$
.
axis
.
getMaxTickWidth
(
axisId
)
*
Math
.
cos
(
Math
.
PI
*
(
90
-
config
.
axis_x_tick_rotate
)
/
180
);
}
}
return
h
+
(
$$
.
_
axis
.
getLabelPositionById
(
axisId
).
isInner
?
0
:
10
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
return
h
+
(
$$
.
axis
.
getLabelPositionById
(
axisId
).
isInner
?
0
:
10
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
};
};
c3_chart_internal_fn
.
getEventRectWidth
=
function
()
{
c3_chart_internal_fn
.
getEventRectWidth
=
function
()
{
...
...
src/tooltip.js
View file @
1edb4dde
...
@@ -18,7 +18,7 @@ c3_chart_internal_fn.initTooltip = function () {
...
@@ -18,7 +18,7 @@ c3_chart_internal_fn.initTooltip = function () {
}
}
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
$$
.
data
.
targets
.
map
(
function
(
d
)
{
return
$$
.
addName
(
d
.
values
[
config
.
tooltip_init_x
]);
return
$$
.
addName
(
d
.
values
[
config
.
tooltip_init_x
]);
}),
$$
.
_
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
$$
.
hasArcType
()),
$$
.
color
));
}),
$$
.
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
$$
.
hasArcType
()),
$$
.
color
));
$$
.
tooltip
.
style
(
"top"
,
config
.
tooltip_init_position
.
top
)
$$
.
tooltip
.
style
(
"top"
,
config
.
tooltip_init_position
.
top
)
.
style
(
"left"
,
config
.
tooltip_init_position
.
left
)
.
style
(
"left"
,
config
.
tooltip_init_position
.
left
)
.
style
(
"display"
,
"block"
);
.
style
(
"display"
,
"block"
);
...
@@ -95,7 +95,7 @@ c3_chart_internal_fn.showTooltip = function (selectedData, element) {
...
@@ -95,7 +95,7 @@ c3_chart_internal_fn.showTooltip = function (selectedData, element) {
if
(
dataToShow
.
length
===
0
||
!
config
.
tooltip_show
)
{
if
(
dataToShow
.
length
===
0
||
!
config
.
tooltip_show
)
{
return
;
return
;
}
}
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
selectedData
,
$$
.
_
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
forArc
),
$$
.
color
)).
style
(
"display"
,
"block"
);
$$
.
tooltip
.
html
(
config
.
tooltip_contents
.
call
(
$$
,
selectedData
,
$$
.
axis
.
getXAxisTickFormat
(),
$$
.
getYFormat
(
forArc
),
$$
.
color
)).
style
(
"display"
,
"block"
);
// Get tooltip dimensions
// Get tooltip dimensions
tWidth
=
$$
.
tooltip
.
property
(
'offsetWidth'
);
tWidth
=
$$
.
tooltip
.
property
(
'offsetWidth'
);
...
...
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