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
2cd9c4b9
Commit
2cd9c4b9
authored
Mar 25, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add axis.y.show option - #84
parent
2f167f6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
c3.js
c3.js
+24
-18
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
2cd9c4b9
...
...
@@ -93,6 +93,7 @@
__axis_x_min
=
getConfig
([
'axis'
,
'x'
,
'min'
],
null
),
__axis_x_default
=
getConfig
([
'axis'
,
'x'
,
'default'
],
null
),
__axis_x_label
=
getConfig
([
'axis'
,
'x'
,
'label'
],
null
),
__axis_y_show
=
getConfig
([
'axis'
,
'y'
,
'show'
],
true
),
__axis_y_max
=
getConfig
([
'axis'
,
'y'
,
'max'
],
null
),
__axis_y_min
=
getConfig
([
'axis'
,
'y'
,
'min'
],
null
),
__axis_y_center
=
getConfig
([
'axis'
,
'y'
,
'center'
],
null
),
...
...
@@ -268,7 +269,7 @@
//-- Sizes --//
// TODO: configurabale
var
rotated_padding_left
=
40
,
rotated_padding_right
=
20
;
var
rotated_padding_left
=
40
,
rotated_padding_right
=
20
,
rotated_padding_top
=
5
;
function
updateSizes
()
{
currentWidth
=
getCurrentWidth
();
...
...
@@ -278,9 +279,9 @@
// for main
margin
=
{
top
:
__axis_rotated
&&
__axis_y2_show
?
getAxisHeightByAxisId
(
'y2'
)
:
5
,
top
:
__axis_rotated
?
getHorizontalAxisHeight
(
'y2'
)
:
rotated_padding_top
,
right
:
getCurrentPaddingRight
(),
bottom
:
get
AxisHeightByAxisId
(
__axis_rotated
?
'y'
:
'x'
)
+
(
__axis_rotated
?
0
:
__subchart_size_height
)
+
(
isLegendRight
?
0
:
legendHeight
),
bottom
:
get
HorizontalAxisHeight
(
__axis_rotated
?
'y'
:
'x'
)
+
(
__axis_rotated
?
0
:
__subchart_size_height
)
+
(
isLegendRight
?
0
:
legendHeight
),
left
:
(
__axis_rotated
?
__subchart_size_height
+
rotated_padding_right
:
0
)
+
getCurrentPaddingLeft
()
};
width
=
currentWidth
-
margin
.
left
-
margin
.
right
;
...
...
@@ -318,7 +319,8 @@
}
function
getSvgLeft
()
{
var
leftAxisClass
=
__axis_rotated
?
".x.axis"
:
".y.axis"
,
svgRect
=
d3
.
select
(
leftAxisClass
).
node
().
getBoundingClientRect
(),
leftAxis
=
d3
.
select
(
leftAxisClass
).
node
(),
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
chartRect
=
d3
.
select
(
__bindto
).
node
().
getBoundingClientRect
();
return
svgRect
.
right
-
chartRect
.
left
-
getCurrentPaddingLeft
();
}
...
...
@@ -335,7 +337,7 @@
}
else
if
(
__padding_left
)
{
return
__padding_left
;
}
else
{
return
__axis_rotated
||
__axis_y_inner
?
1
:
getAxisWidthByAxisId
(
'y'
);
return
__axis_rotated
||
!
__axis_y_show
||
__axis_y_inner
?
1
:
getAxisWidthByAxisId
(
'y'
);
}
}
function
getCurrentPaddingRight
()
{
...
...
@@ -356,9 +358,10 @@
var
position
=
getAxisLabelPositionById
(
id
);
return
position
.
isInner
?
20
+
getMaxTickWidth
(
id
)
:
40
+
getMaxTickWidth
(
id
);
}
function
getAxisHeightByAxisId
(
id
)
{
var
position
=
getAxisLabelPositionById
(
id
);
return
(
position
.
isInner
?
30
:
40
)
+
(
id
===
'y2'
?
-
10
:
0
);
function
getHorizontalAxisHeight
(
axisId
)
{
if
(
axisId
===
'y'
&&
!
__axis_y_show
)
{
return
__legend_show
&&
!
isLegendRight
?
10
:
1
;
}
if
(
axisId
===
'y2'
&&
!
__axis_y2_show
)
{
return
rotated_padding_top
;
}
return
(
getAxisLabelPositionById
(
axisId
).
isInner
?
30
:
40
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
}
function
getParentWidth
()
{
return
+
d3
.
select
(
__bindto
).
style
(
"width"
).
replace
(
'px'
,
''
);
// TODO: if rotated, use height
...
...
@@ -1972,16 +1975,19 @@
.
attr
(
"dy"
,
dyForXAxisLabel
)
.
style
(
"text-anchor"
,
textAnchorForXAxisLabel
)
.
text
(
textForXAxisLabel
);
main
.
append
(
"g"
)
.
attr
(
"class"
,
"y axis"
)
.
attr
(
"clip-path"
,
__axis_rotated
?
getClipPath
(
"yaxis-clip"
)
:
""
)
.
append
(
"text"
)
.
attr
(
"class"
,
"-axis-y-label"
)
.
attr
(
"transform"
,
__axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"dx"
,
dxForYAxisLabel
)
.
attr
(
"dy"
,
dyForYAxisLabel
)
.
style
(
"text-anchor"
,
textAnchorForYAxisLabel
)
.
text
(
textForYAxisLabel
);
if
(
__axis_y_show
)
{
main
.
append
(
"g"
)
.
attr
(
"class"
,
"y axis"
)
.
attr
(
"clip-path"
,
__axis_rotated
?
getClipPath
(
"yaxis-clip"
)
:
""
)
.
append
(
"text"
)
.
attr
(
"class"
,
"-axis-y-label"
)
.
attr
(
"transform"
,
__axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
"dx"
,
dxForYAxisLabel
)
.
attr
(
"dy"
,
dyForYAxisLabel
)
.
style
(
"text-anchor"
,
textAnchorForYAxisLabel
)
.
text
(
textForYAxisLabel
);
}
if
(
__axis_y2_show
)
{
main
.
append
(
"g"
)
...
...
c3.min.js
View file @
2cd9c4b9
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment