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
c011b34a
Commit
c011b34a
authored
Apr 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix axis.x.tick.culling when axis.x.tick.fit enabled
parent
0ff7afe3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
c3.js
c3.js
+24
-4
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
c011b34a
...
...
@@ -1909,8 +1909,12 @@
function
parseDate
(
date
)
{
var
parsedDate
;
if
(
!
date
)
{
throw
Error
(
date
+
" can not be parsed as d3.time with format "
+
__data_x_format
+
". Maybe 'x' of this data is not defined. See data.x or data.xs option."
);
}
parsedDate
=
__data_x_format
?
d3
.
time
.
format
(
__data_x_format
).
parse
(
date
)
:
new
Date
(
date
);
if
(
!
parsedDate
)
{
throw
Error
(
"Failed to parse '"
+
date
+
"' with format "
+
__data_x_format
);
}
try
{
parsedDate
=
__data_x_format
?
d3
.
time
.
format
(
__data_x_format
).
parse
(
date
)
:
new
Date
(
date
);
}
catch
(
e
)
{
parsedDate
=
undefined
;
}
if
(
!
parsedDate
)
{
window
.
console
.
error
(
"Failed to parse x '"
+
date
+
"' to Date with format "
+
__data_x_format
);
}
return
parsedDate
;
}
...
...
@@ -2837,7 +2841,7 @@
var
hideAxis
=
hasArcType
(
c3
.
data
.
targets
);
var
drawBar
,
drawBarOnSub
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
var
targetsToShow
=
filterTargetsToShow
(
c3
.
data
.
targets
),
uniqueXs
;
var
targetsToShow
=
filterTargetsToShow
(
c3
.
data
.
targets
),
uniqueXs
,
i
,
intervalForCulling
;
// abort if no targets to show
if
(
targetsToShow
.
length
===
0
)
{
...
...
@@ -2879,10 +2883,19 @@
y2
.
domain
(
getYDomain
(
targetsToShow
,
'y2'
));
// Fix tick position to data
if
(
__axis_x_tick_fit
)
{
if
(
__axis_x_tick_fit
)
{
// MEMO: supposed to be non categorized axis
uniqueXs
=
mapTargetsToUniqueXs
(
targetsToShow
);
xAxis
.
tickValues
(
uniqueXs
);
subXAxis
.
tickValues
(
uniqueXs
);
// compute interval for culling if needed
if
(
__axis_x_tick_culling
)
{
for
(
i
=
1
;
i
<
uniqueXs
.
length
;
i
++
)
{
if
(
uniqueXs
.
length
/
i
<
__axis_x_tick_count
)
{
intervalForCulling
=
i
;
break
;
}
}
}
}
// axis
...
...
@@ -2890,6 +2903,13 @@
main
.
select
(
'.'
+
CLASS
.
axisY
).
style
(
"opacity"
,
hideAxis
?
0
:
1
).
transition
().
duration
(
durationForAxis
).
call
(
yAxis
);
main
.
select
(
'.'
+
CLASS
.
axisY2
).
style
(
"opacity"
,
hideAxis
?
0
:
1
).
transition
().
duration
(
durationForAxis
).
call
(
yAxis2
);
// show/hide if manual culling needed
if
(
__axis_x_tick_fit
&&
__axis_x_tick_culling
)
{
d3
.
selectAll
(
'.'
+
CLASS
.
axisX
+
' .tick text'
).
each
(
function
(
e
,
i
)
{
d3
.
select
(
this
).
style
(
'display'
,
i
%
intervalForCulling
?
'none'
:
'block'
);
});
}
// setup drawer - MEMO: these must be called after axis updated
drawBar
=
generateDrawBar
(
barIndices
);
xForText
=
generateXYForText
(
barIndices
,
true
);
...
...
c3.min.js
View file @
c011b34a
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