Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charts
c3-closed
Commits
967b5065
Commit
967b5065
authored
Sep 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore axis.x/y/y2.tick.outer
parent
0a2f754b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
24 deletions
+34
-24
c3.js
c3.js
+17
-12
c3.min.js
c3.min.js
+0
-0
axis.js
src/axis.js
+6
-4
c3.axis.js
src/c3.axis.js
+7
-4
scale.js
src/scale.js
+4
-4
No files found.
c3.js
View file @
967b5065
...
...
@@ -1151,10 +1151,10 @@
// update axes
$$
.
xAxisTickFormat
=
$$
.
getXAxisTickFormat
();
$$
.
xAxisTickValues
=
config
.
axis_x_tick_values
?
config
.
axis_x_tick_values
:
(
forInit
?
undefined
:
$$
.
xAxis
.
tickValues
());
$$
.
xAxis
=
$$
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
);
$$
.
subXAxis
=
$$
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
);
$$
.
yAxis
=
$$
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
config
.
axis_y_ticks
);
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
config
.
axis_y2_ticks
);
$$
.
xAxis
=
$$
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
yAxis
=
$$
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
config
.
axis_y_ticks
,
config
.
axis_y_tick_outer
);
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
config
.
axis_y2_ticks
,
config
.
axis_y2_tick_outer
);
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
if
(
$$
.
brush
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
}
...
...
@@ -3800,9 +3800,10 @@
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
$$
.
textAnchorForY2AxisLabel
.
bind
(
$$
));
};
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
)
{
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
axisParams
=
{
isCategory
:
$$
.
isCategorized
(),
withOuterTick
:
withOuterTick
},
axis
=
c3_axis
(
$$
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
);
if
(
$$
.
isTimeSeries
()
&&
tickValues
)
{
tickValues
=
tickValues
.
map
(
function
(
v
)
{
return
$$
.
parseDate
(
v
);
});
...
...
@@ -3827,8 +3828,9 @@
return
axis
;
};
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
ticks
)
{
return
c3_axis
(
this
.
d3
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
ticks
);
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
ticks
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
};
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
ticks
);
};
c3_chart_internal_fn
.
getAxisId
=
function
(
id
)
{
var
config
=
this
.
config
;
...
...
@@ -6114,11 +6116,14 @@
// Features:
// 1. category axis
// 2. ceil values of translate/x/y to int for half pixel antialiasing
function
c3_axis
(
d3
,
isCategory
)
{
var
scale
=
d3
.
scale
.
linear
(),
orient
=
"bottom"
,
innerTickSize
=
6
,
outerTickSize
=
6
,
tickPadding
=
3
,
tickValues
=
null
,
tickFormat
,
tickArguments
;
function
c3_axis
(
d3
,
params
)
{
var
scale
=
d3
.
scale
.
linear
(),
orient
=
"bottom"
,
innerTickSize
=
6
,
outerTickSize
,
tickPadding
=
3
,
tickValues
=
null
,
tickFormat
,
tickArguments
;
var
tickOffset
=
0
,
tickCulling
=
true
,
tickCentered
;
params
=
params
||
{};
outerTickSize
=
params
.
withOuterTick
?
6
:
0
;
function
axisX
(
selection
,
x
)
{
selection
.
attr
(
"transform"
,
function
(
d
)
{
return
"translate("
+
Math
.
ceil
(
x
(
d
)
+
tickOffset
)
+
", 0)"
;
...
...
@@ -6149,7 +6154,7 @@
}
function
copyScale
()
{
var
newScale
=
scale
.
copy
(),
domain
;
if
(
isCategory
)
{
if
(
params
.
isCategory
)
{
domain
=
scale
.
domain
();
newScale
.
domain
([
domain
[
0
],
domain
[
1
]
-
1
]);
}
...
...
@@ -6183,7 +6188,7 @@
textEnter
=
tickEnter
.
select
(
"text"
),
textUpdate
=
tickUpdate
.
select
(
"text"
);
if
(
isCategory
)
{
if
(
params
.
isCategory
)
{
tickOffset
=
Math
.
ceil
((
scale1
(
1
)
-
scale1
(
0
))
/
2
);
tickX
=
tickCentered
?
0
:
tickOffset
;
}
else
{
...
...
c3.min.js
View file @
967b5065
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/axis.js
View file @
967b5065
...
...
@@ -30,9 +30,10 @@ c3_chart_internal_fn.initAxis = function () {
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
$$
.
textAnchorForY2AxisLabel
.
bind
(
$$
));
};
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
)
{
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
axisParams
=
{
isCategory
:
$$
.
isCategorized
(),
withOuterTick
:
withOuterTick
},
axis
=
c3_axis
(
$$
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
);
if
(
$$
.
isTimeSeries
()
&&
tickValues
)
{
tickValues
=
tickValues
.
map
(
function
(
v
)
{
return
$$
.
parseDate
(
v
);
});
...
...
@@ -57,8 +58,9 @@ c3_chart_internal_fn.getXAxis = function (scale, orient, tickFormat, tickValues)
return
axis
;
};
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
ticks
)
{
return
c3_axis
(
this
.
d3
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
ticks
);
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
ticks
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
};
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
ticks
);
};
c3_chart_internal_fn
.
getAxisId
=
function
(
id
)
{
var
config
=
this
.
config
;
...
...
src/c3.axis.js
View file @
967b5065
// Features:
// 1. category axis
// 2. ceil values of translate/x/y to int for half pixel antialiasing
function
c3_axis
(
d3
,
isCategory
)
{
var
scale
=
d3
.
scale
.
linear
(),
orient
=
"bottom"
,
innerTickSize
=
6
,
outerTickSize
=
6
,
tickPadding
=
3
,
tickValues
=
null
,
tickFormat
,
tickArguments
;
function
c3_axis
(
d3
,
params
)
{
var
scale
=
d3
.
scale
.
linear
(),
orient
=
"bottom"
,
innerTickSize
=
6
,
outerTickSize
,
tickPadding
=
3
,
tickValues
=
null
,
tickFormat
,
tickArguments
;
var
tickOffset
=
0
,
tickCulling
=
true
,
tickCentered
;
params
=
params
||
{};
outerTickSize
=
params
.
withOuterTick
?
6
:
0
;
function
axisX
(
selection
,
x
)
{
selection
.
attr
(
"transform"
,
function
(
d
)
{
return
"translate("
+
Math
.
ceil
(
x
(
d
)
+
tickOffset
)
+
", 0)"
;
...
...
@@ -36,7 +39,7 @@ function c3_axis(d3, isCategory) {
}
function
copyScale
()
{
var
newScale
=
scale
.
copy
(),
domain
;
if
(
isCategory
)
{
if
(
params
.
isCategory
)
{
domain
=
scale
.
domain
();
newScale
.
domain
([
domain
[
0
],
domain
[
1
]
-
1
]);
}
...
...
@@ -70,7 +73,7 @@ function c3_axis(d3, isCategory) {
textEnter
=
tickEnter
.
select
(
"text"
),
textUpdate
=
tickUpdate
.
select
(
"text"
);
if
(
isCategory
)
{
if
(
params
.
isCategory
)
{
tickOffset
=
Math
.
ceil
((
scale1
(
1
)
-
scale1
(
0
))
/
2
);
tickX
=
tickCentered
?
0
:
tickOffset
;
}
else
{
...
...
src/scale.js
View file @
967b5065
...
...
@@ -71,10 +71,10 @@ c3_chart_internal_fn.updateScales = function () {
// update axes
$$
.
xAxisTickFormat
=
$$
.
getXAxisTickFormat
();
$$
.
xAxisTickValues
=
config
.
axis_x_tick_values
?
config
.
axis_x_tick_values
:
(
forInit
?
undefined
:
$$
.
xAxis
.
tickValues
());
$$
.
xAxis
=
$$
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
);
$$
.
subXAxis
=
$$
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
);
$$
.
yAxis
=
$$
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
config
.
axis_y_ticks
);
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
config
.
axis_y2_ticks
);
$$
.
xAxis
=
$$
.
getXAxis
(
$$
.
x
,
$$
.
xOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
subXAxis
=
$$
.
getXAxis
(
$$
.
subX
,
$$
.
subXOrient
,
$$
.
xAxisTickFormat
,
$$
.
xAxisTickValues
,
config
.
axis_x_tick_outer
);
$$
.
yAxis
=
$$
.
getYAxis
(
$$
.
y
,
$$
.
yOrient
,
config
.
axis_y_tick_format
,
config
.
axis_y_ticks
,
config
.
axis_y_tick_outer
);
$$
.
y2Axis
=
$$
.
getYAxis
(
$$
.
y2
,
$$
.
y2Orient
,
config
.
axis_y2_tick_format
,
config
.
axis_y2_ticks
,
config
.
axis_y2_tick_outer
);
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
if
(
$$
.
brush
)
{
$$
.
brush
.
scale
(
$$
.
subX
);
}
...
...
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