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
bab6c75f
You need to sign in or sign up before continuing.
Commit
bab6c75f
authored
Sep 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix axis.x.tick.values for timeseries - #408
parent
beed6436
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
0 deletions
+66
-0
c3.js
c3.js
+4
-0
c3.min.js
c3.min.js
+0
-0
index.html
htdocs/index.html
+3
-0
axes_x_tick_values.html
htdocs/samples/axes_x_tick_values.html
+55
-0
axis.js
src/axis.js
+4
-0
No files found.
c3.js
View file @
bab6c75f
...
...
@@ -3744,6 +3744,10 @@
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
if
(
$$
.
isTimeSeries
()
&&
tickValues
)
{
tickValues
=
tickValues
.
map
(
function
(
v
)
{
return
$$
.
parseDate
(
v
);
});
}
// Set tick
axis
.
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
if
(
$$
.
isCategorized
())
{
...
...
c3.min.js
View file @
bab6c75f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/index.html
View file @
bab6c75f
...
...
@@ -142,6 +142,9 @@
</div>
<div
class=
"col-md-4"
>
<h3>
X Axis Tick
</h3>
<a
href=
"./samples/axes_x_tick_values.html"
>
Set values for x axis
</a>
<a
href=
"./samples/axes_x_tick_culling.html"
>
Set culling for x axis
</a>
...
...
htdocs/samples/axes_x_tick_values.html
0 → 100644
View file @
bab6c75f
<html>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/css/c3.css"
>
</head>
<body>
<div
id=
"chart1"
></div>
<div
id=
"chart2"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
var
chart1
=
c3
.
generate
({
bindto
:
'#chart1'
,
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
]
],
},
axis
:
{
x
:
{
tick
:
{
values
:
[
2
,
4
]
}
}
}
});
var
chart2
=
c3
.
generate
({
bindto
:
'#chart2'
,
data
:
{
x
:
'date'
,
xFormat
:
'%Y%m%d'
,
columns
:
[
[
'date'
,
'20130101'
,
'20130102'
,
'20130103'
,
'20130104'
,
'20130105'
,
'20130106'
],
[
'sample'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'sample2'
,
130
,
300
,
200
,
450
,
250
,
350
]
]
},
axis
:
{
x
:
{
type
:
'timeseries'
,
tick
:
{
format
:
"%e %b %y"
,
// https://github.com/mbostock/d3/wiki/Time-Formatting#wiki-format
values
:
[
'20130103'
,
'20130104'
]
}
}
}
});
</script>
</body>
</html>
src/axis.js
View file @
bab6c75f
...
...
@@ -34,6 +34,10 @@ c3_chart_internal_fn.getXAxis = function (scale, orient, tickFormat, tickValues)
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
if
(
$$
.
isTimeSeries
()
&&
tickValues
)
{
tickValues
=
tickValues
.
map
(
function
(
v
)
{
return
$$
.
parseDate
(
v
);
});
}
// Set tick
axis
.
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
if
(
$$
.
isCategorized
())
{
...
...
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