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
c0f5426b
You need to sign in or sign up before continuing.
Commit
c0f5426b
authored
Nov 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ticks after hide and show when axis.x.tick.fit = false - #638
parent
61705c2b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
7 deletions
+121
-7
c3.js
c3.js
+6
-3
c3.min.js
c3.min.js
+0
-0
axis-spec.js
spec/axis-spec.js
+109
-1
core.js
src/core.js
+6
-3
No files found.
c3.js
View file @
c0f5426b
...
@@ -463,9 +463,12 @@
...
@@ -463,9 +463,12 @@
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
// update axis tick values according to options
if
(
!
config
.
axis_x_tick_values
)
{
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
}
else
{
tickValues
=
undefined
;
}
$$
.
xAxis
.
tickValues
(
tickValues
);
$$
.
xAxis
.
tickValues
(
tickValues
);
$$
.
subXAxis
.
tickValues
(
tickValues
);
$$
.
subXAxis
.
tickValues
(
tickValues
);
}
}
...
...
c3.min.js
View file @
c0f5426b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/axis-spec.js
View file @
c0f5426b
...
@@ -46,7 +46,7 @@ describe('c3 chart axis', function () {
...
@@ -46,7 +46,7 @@ describe('c3 chart axis', function () {
done
();
done
();
},
10
);
},
10
);
});
});
/*
describe('axis.y.tick.count', function () {
describe('axis.y.tick.count', function () {
var i = 1;
var i = 1;
...
@@ -487,4 +487,112 @@ describe('c3 chart axis', function () {
...
@@ -487,4 +487,112 @@ describe('c3 chart axis', function () {
});
});
*/
describe
(
'axis.x.tick.fit'
,
function
()
{
describe
(
'axis.x.tick.fit = true'
,
function
()
{
it
(
'should set args for indexed data'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
]
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should show fitted ticks on indexed data'
,
function
()
{
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
6
);
});
it
(
'should set args for x-based data'
,
function
()
{
args
=
{
data
:
{
x
:
'x'
,
columns
:
[
[
'x'
,
10
,
20
,
100
,
110
,
200
,
1000
],
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
]
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should show fitted ticks on indexed data'
,
function
()
{
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
6
);
});
it
(
'should show fitted ticks after hide and show'
,
function
()
{
chart
.
hide
();
chart
.
show
();
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
6
);
});
});
describe
(
'axis.x.tick.fit = false'
,
function
()
{
it
(
'should set args for indexed data'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
]
},
axis
:
{
x
:
{
tick
:
{
fit
:
false
}
}
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should show fitted ticks on indexed data'
,
function
()
{
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
11
);
});
it
(
'should set args for x-based data'
,
function
()
{
args
.
data
=
{
x
:
'x'
,
columns
:
[
[
'x'
,
10
,
20
,
100
,
110
,
200
,
1000
],
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
]
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should show fitted ticks on indexed data'
,
function
()
{
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
10
);
});
it
(
'should show fitted ticks after hide and show'
,
function
()
{
chart
.
hide
();
chart
.
show
();
var
ticks
=
chart
.
internal
.
main
.
selectAll
(
'.c3-axis-x g.tick'
);
expect
(
ticks
.
size
()).
toBe
(
10
);
});
});
});
});
});
src/core.js
View file @
c0f5426b
...
@@ -458,9 +458,12 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -458,9 +458,12 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
// update axis tick values according to options
if
(
!
config
.
axis_x_tick_values
)
{
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
if
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
)
{
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
,
$$
.
isTimeSeries
());
}
else
{
tickValues
=
undefined
;
}
$$
.
xAxis
.
tickValues
(
tickValues
);
$$
.
xAxis
.
tickValues
(
tickValues
);
$$
.
subXAxis
.
tickValues
(
tickValues
);
$$
.
subXAxis
.
tickValues
(
tickValues
);
}
}
...
...
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