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
c51dc602
Commit
c51dc602
authored
Dec 21, 2013
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add axis_x_tick_fomat option
parent
9594e6ba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
c3.js
c3.js
+3
-2
c3.min.js
c3.min.js
+0
-0
timeseries.html
htdocs/samples/timeseries.html
+4
-1
No files found.
c3.js
View file @
c51dc602
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
var
__axis_x_type
=
getConfig
([
'axis'
,
'x'
,
'type'
],
'indexed'
),
var
__axis_x_type
=
getConfig
([
'axis'
,
'x'
,
'type'
],
'indexed'
),
__axis_x_categories
=
getConfig
([
'axis'
,
'x'
,
'categories'
],
[]),
__axis_x_categories
=
getConfig
([
'axis'
,
'x'
,
'categories'
],
[]),
__axis_x_tick_centered
=
getConfig
([
'axis'
,
'x'
,
'tick'
,
'centered'
],
false
),
__axis_x_tick_centered
=
getConfig
([
'axis'
,
'x'
,
'tick'
,
'centered'
],
false
),
__axis_x_tick_format
=
getConfig
([
'axis'
,
'x'
,
'tick'
,
'format'
],
null
),
__axis_x_default
=
getConfig
([
'axis'
,
'x'
,
'default'
],
null
),
__axis_x_default
=
getConfig
([
'axis'
,
'x'
,
'default'
],
null
),
__axis_y_max
=
getConfig
([
'axis'
,
'y'
,
'max'
],
null
),
__axis_y_max
=
getConfig
([
'axis'
,
'y'
,
'max'
],
null
),
__axis_y_min
=
getConfig
([
'axis'
,
'y'
,
'min'
],
null
),
__axis_y_min
=
getConfig
([
'axis'
,
'y'
,
'min'
],
null
),
...
@@ -157,7 +158,7 @@
...
@@ -157,7 +158,7 @@
var
color
=
generateColor
(
__data_colors
,
__color_pattern
);
var
color
=
generateColor
(
__data_colors
,
__color_pattern
);
var
custom
TimeFormat
=
(
function
()
{
var
default
TimeFormat
=
(
function
()
{
var
formats
=
[
var
formats
=
[
[
d3
.
time
.
format
(
"%Y/%-m/%-d"
),
function
()
{
return
true
;
}],
[
d3
.
time
.
format
(
"%Y/%-m/%-d"
),
function
()
{
return
true
;
}],
[
d3
.
time
.
format
(
"%-m/%-d"
),
function
(
d
)
{
return
d
.
getMonth
();
}],
[
d3
.
time
.
format
(
"%-m/%-d"
),
function
(
d
)
{
return
d
.
getMonth
();
}],
...
@@ -293,7 +294,7 @@
...
@@ -293,7 +294,7 @@
function
getXAxis
(
scale
,
orient
)
{
function
getXAxis
(
scale
,
orient
)
{
var
axis
=
(
isCategorized
?
categoryAxis
()
:
d3
.
svg
.
axis
()).
scale
(
scale
).
orient
(
orient
);
var
axis
=
(
isCategorized
?
categoryAxis
()
:
d3
.
svg
.
axis
()).
scale
(
scale
).
orient
(
orient
);
if
(
isTimeSeries
)
{
if
(
isTimeSeries
)
{
axis
.
tickFormat
(
custom
TimeFormat
);
axis
.
tickFormat
(
__axis_x_tick_format
?
function
(
date
)
{
return
d3
.
time
.
format
(
__axis_x_tick_format
)(
date
);
}
:
default
TimeFormat
);
}
}
if
(
isCategorized
)
{
if
(
isCategorized
)
{
axis
.
categories
(
__axis_x_categories
).
tickCentered
(
__axis_x_tick_centered
);
axis
.
categories
(
__axis_x_categories
).
tickCentered
(
__axis_x_tick_centered
);
...
...
c3.min.js
View file @
c51dc602
This diff is collapsed.
Click to expand it.
htdocs/samples/timeseries.html
View file @
c51dc602
...
@@ -21,7 +21,10 @@
...
@@ -21,7 +21,10 @@
},
},
axis
:
{
axis
:
{
x
:
{
x
:
{
type
:
'timeseries'
type
:
'timeseries'
,
tick
:
{
format
:
"%m/%d"
// https://github.com/mbostock/d3/wiki/Time-Formatting#wiki-format
}
}
}
}
}
});
});
...
...
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